emcfanreg.h revision 1.1 1 /* $NetBSD: emcfanreg.h,v 1.1 2025/03/11 13:56:46 brad Exp $ */
2
3 /*
4 * Copyright (c) 2025 Brad Spencer <brad (at) anduin.eldar.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef _DEV_I2C_EMCFANREG_H_
20 #define _DEV_I2C_EMCFANREG_H_
21
22 #include <dev/i2c/i2c_io.h>
23
24 static const i2c_addr_t emcfan_typical_addrs[] = { 0x2c, 0x2d, 0x2e, 0x2f, 0x4c, 0x4d };
25
26 #define EMCFAN_VOID_READ 0x55
27
28 #define EMCFAN_INTERNAL_TEMP_HIGH 0x00
29 #define EMCFAN_INTERNAL_TEMP_LOW 0x01
30 #define EMCFAN_2101_EXTERNAL_TEMP_HIGH 0x01
31 #define EMCFAN_2101_CHIP_CONFIG 0x03
32 #define EMCFAN_EXTERNAL_1_TEMP_HIGH 0x02
33 #define EMCFAN_2101_EXTERNAL_TEMP_LOW 0x10
34 #define EMCFAN_EXTERNAL_1_TEMP_LOW 0x03
35 #define EMCFAN_EXTERNAL_2_TEMP_HIGH 0x04
36 #define EMCFAN_EXTERNAL_2_TEMP_LOW 0x05
37 #define EMCFAN_EXTERNAL_3_TEMP_HIGH 0x06
38 #define EMCFAN_EXTERNAL_3_TEMP_LOW 0x07
39 #define EMCFAN_EXTERNAL_4_TEMP_HIGH 0x08
40 #define EMCFAN_EXTERNAL_4_TEMP_LOW 0x09
41
42 #define EMCFAN_VIN4_VOLTAGE 0x10
43
44 #define EMCFAN_CHIP_CONFIG 0x20
45 #define EMCFAN_CHIP_CONFIG_2 0x21
46 #define EMCFAN_TEMP_CONFIG_3 0x22
47 #define EMCFAN_210_346_FAN_STATUS 0x27
48 #define EMCFAN_POLARITY_CONFIG 0x2a
49
50 #define EMCFAN_210_346_PWM_BASEFREQ 0x2b
51 #define EMCFAN_2106_FAN_3_DIVIDE 0x2c
52 #define EMCFAN_2106_FAN_3_DRIVE 0x2d
53 #define EMCFAN_2106_FAN_4_DRIVE 0x2e
54 #define EMCFAN_2106_FAN_4_DIVIDE 0x2f
55 #define EMCFAN_2101_TACH_LOW 0x46
56 #define EMCFAN_2101_TACH_HIGH 0x47
57 #define EMCFAN_2101_FAN_CONFIG 0x4a
58 #define EMCFAN_2101_FAN_DRIVE 0x4c
59 #define EMCFAN_2101_FAN_DIVIDE 0x4e
60 #define EMCFAN_210_346_FAN_1_DRIVE 0x40
61 #define EMCFAN_210_346_FAN_1_DIVIDE 0x41
62 #define EMCFAN_210_346_CONFIG_1 0x42
63 #define EMCFAN_210_346_TACH_1_HIGH 0x4e
64 #define EMCFAN_210_346_TACH_1_LOW 0x4f
65 #define EMCFAN_210_346_CONFIG_2 0x82
66 #define EMCFAN_210_346_FAN_2_DRIVE 0x80
67 #define EMCFAN_210_346_FAN_2_DIVIDE 0x81
68 #define EMCFAN_210_346_TACH_2_HIGH 0x8e
69 #define EMCFAN_210_346_TACH_2_LOW 0x8f
70
71 #define EMCFAN_230X_FAN_STATUS 0x24
72 #define EMCFAN_230X_FAN_STALL_STATUS 0x25
73 #define EMCFAN_230X_FAN_SPIN_STATUS 0x26
74 #define EMCFAN_230X_FAN_DRIVE_STATUS 0x27
75 #define EMCFAN_230X_OUTPUT_CONFIG 0x2b
76 #define EMCFAN_230X_BASE_FREQ_45 0x2c
77 #define EMCFAN_230X_BASE_FREQ_123 0x2d
78 #define EMCFAN_230X_FAN_1_DRIVE 0x30
79 #define EMCFAN_230X_FAN_1_DIVIDE 0x31
80 #define EMCFAN_230X_CONFIG_1 0x32
81 #define EMCFAN_230X_TACH_1_HIGH 0x3e
82 #define EMCFAN_230X_TACH_1_LOW 0x3f
83 #define EMCFAN_230X_FAN_2_DRIVE 0x40
84 #define EMCFAN_230X_FAN_2_DIVIDE 0x41
85 #define EMCFAN_230X_CONFIG_2 0x42
86 #define EMCFAN_230X_TACH_2_HIGH 0x4e
87 #define EMCFAN_230X_TACH_2_LOW 0x4f
88 #define EMCFAN_230X_FAN_3_DRIVE 0x50
89 #define EMCFAN_230X_FAN_3_DIVIDE 0x51
90 #define EMCFAN_230X_CONFIG_3 0x52
91 #define EMCFAN_230X_TACH_3_HIGH 0x5e
92 #define EMCFAN_230X_TACH_3_LOW 0x5f
93 #define EMCFAN_230X_FAN_4_DRIVE 0x60
94 #define EMCFAN_230X_FAN_4_DIVIDE 0x61
95 #define EMCFAN_230X_CONFIG_4 0x62
96 #define EMCFAN_230X_TACH_4_HIGH 0x6e
97 #define EMCFAN_230X_TACH_4_LOW 0x6f
98 #define EMCFAN_230X_FAN_5_DRIVE 0x70
99 #define EMCFAN_230X_FAN_5_DIVIDE 0x71
100 #define EMCFAN_230X_CONFIG_5 0x72
101 #define EMCFAN_230X_TACH_5_HIGH 0x7e
102 #define EMCFAN_230X_TACH_5_LOW 0x7f
103
104 #define EMCFAN_PRODUCT_ID 0xfd
105 #define EMCFAN_PRODUCT_2101 0x16
106 #define EMCFAN_PRODUCT_2101R 0x28
107 #define EMCFAN_PRODUCT_2103_1 0x24
108 #define EMCFAN_PRODUCT_2103_24 0x26 /* EMC2103-2 and EMC2103-4 */
109 #define EMCFAN_PRODUCT_2104 0x1d
110 #define EMCFAN_PRODUCT_2106 0x1e
111 #define EMCFAN_PRODUCT_2305 0x34
112 #define EMCFAN_PRODUCT_2303 0x35
113 #define EMCFAN_PRODUCT_2302 0x36
114 #define EMCFAN_PRODUCT_2301 0x37
115 #define EMCFAN_MUX_PINS 0xe0
116 #define EMCFAN_DIR_PINS 0xe1
117 #define EMCFAN_OUTPUT_PIN_CONFIG 0xe2
118 #define EMCFAN_PINS_INPUT 0xe3
119 #define EMCFAN_PINS_OUTPUT 0xe4
120 #define EMCFAN_MANUFACTURER_ID 0xfe
121 #define EMCFAN_VALID_MANUFACTURER_ID 0x5d
122 #define EMCFAN_REVISION 0xff
123
124 #define EMCFAN_FAMILY_210X 1
125 #define EMCFAN_FAMILY_230X 2
126
127 #endif
128