26 #include <linux/module.h>
28 #include <linux/slab.h>
30 #include <linux/i2c.h>
38 static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e,
I2C_CLIENT_END };
40 static int gpio_input[17] = { -1, -1, -1, -1, -1, -1, -1, -1, -1,
41 -1, -1, -1, -1, -1, -1, -1, -1 };
42 static int gpio_output[17] = { -1, -1, -1, -1, -1, -1, -1, -1, -1,
43 -1, -1, -1, -1, -1, -1, -1, -1 };
44 static int gpio_inverted[17] = { -1, -1, -1, -1, -1, -1, -1, -1, -1,
45 -1, -1, -1, -1, -1, -1, -1, -1 };
46 static int gpio_normal[17] = { -1, -1, -1, -1, -1, -1, -1, -1, -1,
47 -1, -1, -1, -1, -1, -1, -1, -1 };
48 static int gpio_fan[8] = { -1, -1, -1, -1, -1, -1, -1, -1 };
50 MODULE_PARM_DESC(gpio_input,
"List of GPIO pins (0-16) to program as inputs");
59 "normal/non-inverted");
61 MODULE_PARM_DESC(gpio_fan,
"List of GPIO pins (0-7) to program as fan tachs");
66 #define ADM1026_REG_CONFIG1 0x00
67 #define CFG1_MONITOR 0x01
68 #define CFG1_INT_ENABLE 0x02
69 #define CFG1_INT_CLEAR 0x04
70 #define CFG1_AIN8_9 0x08
71 #define CFG1_THERM_HOT 0x10
72 #define CFG1_DAC_AFC 0x20
73 #define CFG1_PWM_AFC 0x40
74 #define CFG1_RESET 0x80
76 #define ADM1026_REG_CONFIG2 0x01
79 #define ADM1026_REG_CONFIG3 0x07
80 #define CFG3_GPIO16_ENABLE 0x01
81 #define CFG3_CI_CLEAR 0x02
82 #define CFG3_VREF_250 0x04
83 #define CFG3_GPIO16_DIR 0x40
84 #define CFG3_GPIO16_POL 0x80
86 #define ADM1026_REG_E2CONFIG 0x13
87 #define E2CFG_READ 0x01
88 #define E2CFG_WRITE 0x02
89 #define E2CFG_ERASE 0x04
90 #define E2CFG_ROM 0x08
91 #define E2CFG_CLK_EXT 0x80
105 static u16 ADM1026_REG_IN[] = {
106 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
107 0x36, 0x37, 0x27, 0x29, 0x26, 0x2a,
108 0x2b, 0x2c, 0x2d, 0x2e, 0x2f
110 static u16 ADM1026_REG_IN_MIN[] = {
111 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d,
112 0x5e, 0x5f, 0x6d, 0x49, 0x6b, 0x4a,
113 0x4b, 0x4c, 0x4d, 0x4e, 0x4f
115 static u16 ADM1026_REG_IN_MAX[] = {
116 0x50, 0x51, 0x52, 0x53, 0x54, 0x55,
117 0x56, 0x57, 0x6c, 0x41, 0x6a, 0x42,
118 0x43, 0x44, 0x45, 0x46, 0x47
127 static u16 ADM1026_REG_TEMP[] = { 0x1f, 0x28, 0x29 };
128 static u16 ADM1026_REG_TEMP_MIN[] = { 0x69, 0x48, 0x49 };
129 static u16 ADM1026_REG_TEMP_MAX[] = { 0x68, 0x40, 0x41 };
130 static u16 ADM1026_REG_TEMP_TMIN[] = { 0x10, 0x11, 0x12 };
131 static u16 ADM1026_REG_TEMP_THERM[] = { 0x0d, 0x0e, 0x0f };
132 static u16 ADM1026_REG_TEMP_OFFSET[] = { 0x1e, 0x6e, 0x6f };
134 #define ADM1026_REG_FAN(nr) (0x38 + (nr))
135 #define ADM1026_REG_FAN_MIN(nr) (0x60 + (nr))
136 #define ADM1026_REG_FAN_DIV_0_3 0x02
137 #define ADM1026_REG_FAN_DIV_4_7 0x03
139 #define ADM1026_REG_DAC 0x04
140 #define ADM1026_REG_PWM 0x05
142 #define ADM1026_REG_GPIO_CFG_0_3 0x08
143 #define ADM1026_REG_GPIO_CFG_4_7 0x09
144 #define ADM1026_REG_GPIO_CFG_8_11 0x0a
145 #define ADM1026_REG_GPIO_CFG_12_15 0x0b
147 #define ADM1026_REG_GPIO_STATUS_0_7 0x24
148 #define ADM1026_REG_GPIO_STATUS_8_15 0x25
150 #define ADM1026_REG_GPIO_MASK_0_7 0x1c
151 #define ADM1026_REG_GPIO_MASK_8_15 0x1d
154 #define ADM1026_REG_COMPANY 0x16
155 #define ADM1026_REG_VERSTEP 0x17
157 #define ADM1026_COMPANY_ANALOG_DEV 0x41
158 #define ADM1026_VERSTEP_GENERIC 0x40
159 #define ADM1026_VERSTEP_ADM1026 0x44
161 #define ADM1026_REG_MASK1 0x18
162 #define ADM1026_REG_MASK2 0x19
163 #define ADM1026_REG_MASK3 0x1a
164 #define ADM1026_REG_MASK4 0x1b
166 #define ADM1026_REG_STATUS1 0x20
167 #define ADM1026_REG_STATUS2 0x21
168 #define ADM1026_REG_STATUS3 0x22
169 #define ADM1026_REG_STATUS4 0x23
171 #define ADM1026_FAN_ACTIVATION_TEMP_HYST -6
172 #define ADM1026_FAN_CONTROL_TEMP_RANGE 20
173 #define ADM1026_PWM_MAX 255
193 static int adm1026_scaling[] = {
194 2250, 2250, 2250, 2250, 2250, 2250,
195 1875, 1875, 1875, 1875, 3000, 3330,
196 3330, 4995, 2250, 12000, 13875
198 #define NEG12_OFFSET 16000
199 #define SCALE(val, from, to) (((val)*(to) + ((from)/2))/(from))
200 #define INS_TO_REG(n, val) (SENSORS_LIMIT(SCALE(val, adm1026_scaling[n], 192),\
202 #define INS_FROM_REG(n, val) (SCALE(val, 192, adm1026_scaling[n]))
209 #define FAN_TO_REG(val, div) ((val) <= 0 ? 0xff : \
210 SENSORS_LIMIT(1350000 / ((val) * (div)), \
212 #define FAN_FROM_REG(val, div) ((val) == 0 ? -1 : (val) == 0xff ? 0 : \
213 1350000 / ((val) * (div)))
214 #define DIV_FROM_REG(val) (1 << (val))
215 #define DIV_TO_REG(val) ((val) >= 8 ? 3 : (val) >= 4 ? 2 : (val) >= 2 ? 1 : 0)
218 #define TEMP_TO_REG(val) (SENSORS_LIMIT(((val) + ((val) < 0 ? -500 : 500)) \
220 #define TEMP_FROM_REG(val) ((val) * 1000)
221 #define OFFSET_TO_REG(val) (SENSORS_LIMIT(((val) + ((val) < 0 ? -500 : 500)) \
223 #define OFFSET_FROM_REG(val) ((val) * 1000)
225 #define PWM_TO_REG(val) (SENSORS_LIMIT(val, 0, 255))
226 #define PWM_FROM_REG(val) (val)
228 #define PWM_MIN_TO_REG(val) ((val) & 0xf0)
229 #define PWM_MIN_FROM_REG(val) (((val) & 0xf0) + ((val) >> 4))
236 #define DAC_TO_REG(val) (SENSORS_LIMIT(((((val) * 255) + 500) / 2500), 0, 255))
237 #define DAC_FROM_REG(val) (((val) * 2500) / 255)
251 #define ADM1026_DATA_INTERVAL (1 * HZ)
252 #define ADM1026_CONFIG_INTERVAL (5 * 60 * HZ)
325 .probe = adm1026_probe,
326 .remove = adm1026_remove,
327 .id_table = adm1026_id,
328 .detect = adm1026_detect,
329 .address_list = normal_i2c,
360 static void adm1026_init_client(
struct i2c_client *client)
365 dev_dbg(&client->
dev,
"Initializing device\n");
372 dev_dbg(&client->
dev,
"ADM1026_REG_CONFIG1 is: 0x%02x\n",
375 dev_dbg(&client->
dev,
"Monitoring not currently "
379 dev_dbg(&client->
dev,
"SMBALERT interrupts are "
384 "temp3 disabled.\n");
386 dev_dbg(&client->
dev,
"temp3 enabled. in8 and "
390 dev_dbg(&client->
dev,
"Automatic THERM, PWM, "
391 "and temp limits enabled.\n");
395 dev_dbg(&client->
dev,
"GPIO16 enabled. THERM "
399 "GPIO16 disabled.\n");
402 dev_dbg(&client->
dev,
"Vref is 2.50 Volts.\n");
404 dev_dbg(&client->
dev,
"Vref is 1.82 Volts.\n");
407 for (i = 0; i <= 15; ++
i) {
408 if ((i & 0x03) == 0) {
409 value = adm1026_read_value(client,
418 adm1026_print_gpio(client);
424 if (gpio_input[0] != -1 || gpio_output[0] != -1
425 || gpio_inverted[0] != -1 || gpio_normal[0] != -1
426 || gpio_fan[0] != -1) {
427 adm1026_fixup_gpio(client);
442 data->
pwm1.auto_pwm_min = 255;
447 dev_dbg(&client->
dev,
"Setting CONFIG to: 0x%02x\n", value);
454 for (i = 0; i <= 7; ++
i) {
460 static void adm1026_print_gpio(
struct i2c_client *client)
466 for (i = 0; i <= 7; ++
i) {
467 if (data->
config2 & (1 << i)) {
476 for (i = 8; i <= 15; ++
i) {
492 static void adm1026_fixup_gpio(
struct i2c_client *client)
506 for (i = 0; i <= 16; ++
i) {
507 if (gpio_output[i] >= 0 && gpio_output[i] <= 16)
510 if (gpio_output[i] >= 0 && gpio_output[i] <= 7)
511 data->
config2 |= 1 << gpio_output[
i];
515 for (i = 0; i <= 16; ++
i) {
516 if (gpio_input[i] >= 0 && gpio_input[i] <= 16)
519 if (gpio_input[i] >= 0 && gpio_input[i] <= 7)
520 data->
config2 |= 1 << gpio_input[
i];
524 for (i = 0; i <= 16; ++
i) {
525 if (gpio_inverted[i] >= 0 && gpio_inverted[i] <= 16)
530 for (i = 0; i <= 16; ++
i) {
531 if (gpio_normal[i] >= 0 && gpio_normal[i] <= 16)
536 for (i = 0; i <= 7; ++
i) {
537 if (gpio_fan[i] >= 0 && gpio_fan[i] <= 7)
538 data->
config2 &= ~(1 << gpio_fan[
i]);
546 for (i = 15, value = 0; i >= 0; --
i) {
549 if ((i & 0x03) == 0) {
550 adm1026_write_value(client,
558 adm1026_print_gpio(client);
574 dev_dbg(&client->
dev,
"Reading sensor values\n");
575 for (i = 0; i <= 16; ++
i) {
577 adm1026_read_value(client, ADM1026_REG_IN[i]);
580 for (i = 0; i <= 7; ++
i) {
585 for (i = 0; i <= 2; ++
i) {
591 adm1026_read_value(client, ADM1026_REG_TEMP[i]);
594 data->
pwm1.pwm = adm1026_read_value(client,
600 gpio = alarms & 0x80 ? 0x0100 : 0;
611 gpio |= adm1026_read_value(client,
614 gpio |= adm1026_read_value(client,
624 dev_dbg(&client->
dev,
"Reading config values\n");
625 for (i = 0; i <= 16; ++
i) {
626 data->
in_min[
i] = adm1026_read_value(client,
627 ADM1026_REG_IN_MIN[i]);
628 data->
in_max[
i] = adm1026_read_value(client,
629 ADM1026_REG_IN_MAX[i]);
635 for (i = 0; i <= 7; ++
i) {
636 data->
fan_min[
i] = adm1026_read_value(client,
642 for (i = 0; i <= 2; ++
i) {
647 data->
temp_min[
i] = adm1026_read_value(client,
648 ADM1026_REG_TEMP_MIN[i]);
649 data->
temp_max[
i] = adm1026_read_value(client,
650 ADM1026_REG_TEMP_MAX[i]);
651 data->
temp_tmin[
i] = adm1026_read_value(client,
652 ADM1026_REG_TEMP_TMIN[i]);
653 data->
temp_crit[
i] = adm1026_read_value(client,
654 ADM1026_REG_TEMP_THERM[i]);
656 ADM1026_REG_TEMP_OFFSET[i]);
661 gpio = alarms & 0x80 ? 0x0100 : 0;
662 alarms = (alarms & 0x7f) << 8;
671 gpio |= adm1026_read_value(client,
678 data->
config1 = adm1026_read_value(client,
681 data->
pwm1.enable = 2;
682 data->
pwm1.auto_pwm_min =
686 data->
config2 = adm1026_read_value(client,
688 data->
config3 = adm1026_read_value(client,
693 for (i = 0; i <= 15; ++
i) {
694 if ((i & 0x03) == 0) {
695 value = adm1026_read_value(client,
722 int nr = sensor_attr->
index;
727 const char *buf,
size_t count)
730 int nr = sensor_attr->
index;
736 err = kstrtol(buf, 10, &val);
742 adm1026_write_value(client, ADM1026_REG_IN_MIN[nr], data->
in_min[nr]);
750 int nr = sensor_attr->
index;
755 const char *buf,
size_t count)
758 int nr = sensor_attr->
index;
764 err = kstrtol(buf, 10, &val);
770 adm1026_write_value(client, ADM1026_REG_IN_MAX[nr], data->
in_max[nr]);
775 #define in_reg(offset) \
776 static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in, \
778 static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \
779 show_in_min, set_in_min, offset); \
780 static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
781 show_in_max, set_in_max, offset);
816 const char *buf,
size_t count)
823 err = kstrtol(buf, 10, &val);
829 adm1026_write_value(client, ADM1026_REG_IN_MIN[16], data->
in_min[16]);
841 const char *buf,
size_t count)
848 err = kstrtol(buf, 10, &val);
854 adm1026_write_value(client, ADM1026_REG_IN_MAX[16], data->
in_max[16]);
872 int nr = sensor_attr->
index;
881 int nr = sensor_attr->
index;
887 const char *buf,
size_t count)
890 int nr = sensor_attr->
index;
896 err = kstrtol(buf, 10, &val);
908 #define fan_offset(offset) \
909 static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan, NULL, \
911 static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \
912 show_fan_min, set_fan_min, offset - 1);
924 static void fixup_fan_min(
struct device *dev,
int fan,
int old_div)
935 new_min = data->
fan_min[
fan] * old_div / new_div;
936 new_min = SENSORS_LIMIT(new_min, 1, 254);
946 int nr = sensor_attr->
index;
951 const char *buf,
size_t count)
954 int nr = sensor_attr->
index;
958 int orig_div, new_div;
961 err = kstrtol(buf, 10, &val);
985 if (data->
fan_div[nr] != orig_div)
986 fixup_fan_min(dev, nr, orig_div);
992 #define fan_offset_div(offset) \
993 static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \
994 show_fan_div, set_fan_div, offset - 1);
1010 int nr = sensor_attr->
index;
1011 struct adm1026_data *data = adm1026_update_device(dev);
1018 int nr = sensor_attr->
index;
1019 struct adm1026_data *data = adm1026_update_device(dev);
1023 const char *buf,
size_t count)
1026 int nr = sensor_attr->
index;
1028 struct adm1026_data *data = i2c_get_clientdata(client);
1032 err = kstrtol(buf, 10, &val);
1038 adm1026_write_value(client, ADM1026_REG_TEMP_MIN[nr],
1047 int nr = sensor_attr->
index;
1048 struct adm1026_data *data = adm1026_update_device(dev);
1052 const char *buf,
size_t count)
1055 int nr = sensor_attr->
index;
1057 struct adm1026_data *data = i2c_get_clientdata(client);
1061 err = kstrtol(buf, 10, &val);
1067 adm1026_write_value(client, ADM1026_REG_TEMP_MAX[nr],
1073 #define temp_reg(offset) \
1074 static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp, \
1075 NULL, offset - 1); \
1076 static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \
1077 show_temp_min, set_temp_min, offset - 1); \
1078 static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
1079 show_temp_max, set_temp_max, offset - 1);
1090 int nr = sensor_attr->
index;
1091 struct adm1026_data *data = adm1026_update_device(dev);
1099 int nr = sensor_attr->
index;
1101 struct adm1026_data *data = i2c_get_clientdata(client);
1105 err = kstrtol(buf, 10, &val);
1111 adm1026_write_value(client, ADM1026_REG_TEMP_OFFSET[nr],
1117 #define temp_offset_reg(offset) \
1118 static SENSOR_DEVICE_ATTR(temp##offset##_offset, S_IRUGO | S_IWUSR, \
1119 show_temp_offset, set_temp_offset, offset - 1);
1125 static ssize_t show_temp_auto_point1_temp_hyst(
struct device *dev,
1129 int nr = sensor_attr->
index;
1130 struct adm1026_data *data = adm1026_update_device(dev);
1134 static ssize_t show_temp_auto_point2_temp(
struct device *dev,
1138 int nr = sensor_attr->
index;
1139 struct adm1026_data *data = adm1026_update_device(dev);
1143 static ssize_t show_temp_auto_point1_temp(
struct device *dev,
1147 int nr = sensor_attr->
index;
1148 struct adm1026_data *data = adm1026_update_device(dev);
1151 static ssize_t set_temp_auto_point1_temp(
struct device *dev,
1155 int nr = sensor_attr->
index;
1157 struct adm1026_data *data = i2c_get_clientdata(client);
1161 err = kstrtol(buf, 10, &val);
1167 adm1026_write_value(client, ADM1026_REG_TEMP_TMIN[nr],
1173 #define temp_auto_point(offset) \
1174 static SENSOR_DEVICE_ATTR(temp##offset##_auto_point1_temp, \
1175 S_IRUGO | S_IWUSR, show_temp_auto_point1_temp, \
1176 set_temp_auto_point1_temp, offset - 1); \
1177 static SENSOR_DEVICE_ATTR(temp##offset##_auto_point1_temp_hyst, S_IRUGO,\
1178 show_temp_auto_point1_temp_hyst, NULL, offset - 1); \
1179 static SENSOR_DEVICE_ATTR(temp##offset##_auto_point2_temp, S_IRUGO, \
1180 show_temp_auto_point2_temp, NULL, offset - 1);
1189 struct adm1026_data *data = adm1026_update_device(dev);
1196 struct adm1026_data *data = i2c_get_clientdata(client);
1200 err = kstrtoul(buf, 10, &val);
1215 #define temp_crit_enable(offset) \
1216 static DEVICE_ATTR(temp##offset##_crit_enable, S_IRUGO | S_IWUSR, \
1217 show_temp_crit_enable, set_temp_crit_enable);
1227 int nr = sensor_attr->
index;
1228 struct adm1026_data *data = adm1026_update_device(dev);
1232 const char *buf,
size_t count)
1235 int nr = sensor_attr->
index;
1237 struct adm1026_data *data = i2c_get_clientdata(client);
1241 err = kstrtol(buf, 10, &val);
1247 adm1026_write_value(client, ADM1026_REG_TEMP_THERM[nr],
1253 #define temp_crit_reg(offset) \
1254 static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IRUGO | S_IWUSR, \
1255 show_temp_crit, set_temp_crit, offset - 1);
1264 struct adm1026_data *data = adm1026_update_device(dev);
1269 const char *buf,
size_t count)
1272 struct adm1026_data *data = i2c_get_clientdata(client);
1276 err = kstrtol(buf, 10, &val);
1288 set_analog_out_reg);
1293 struct adm1026_data *data = adm1026_update_device(dev);
1294 int vid = (data->
gpio >> 11) & 0x1f;
1296 dev_dbg(dev,
"Setting VID from GPIO11-15.\n");
1310 const char *buf,
size_t count)
1316 err = kstrtoul(buf, 10, &val);
1329 struct adm1026_data *data = adm1026_update_device(dev);
1338 struct adm1026_data *data = adm1026_update_device(dev);
1375 struct adm1026_data *data = adm1026_update_device(dev);
1379 const char *buf,
size_t count)
1382 struct adm1026_data *data = i2c_get_clientdata(client);
1387 err = kstrtol(buf, 10, &val);
1394 | (data->
gpio_mask & 0x10000 ? 0x80000000 : 0);
1417 struct adm1026_data *data = adm1026_update_device(dev);
1421 const char *buf,
size_t count)
1424 struct adm1026_data *data = i2c_get_clientdata(client);
1429 err = kstrtol(buf, 10, &val);
1434 data->
gpio = val & 0x1ffff;
1439 gpio = ((gpio >> 1) & 0x80) | (data->
alarms >> 24 & 0x7f);
1450 struct adm1026_data *data = adm1026_update_device(dev);
1454 const char *buf,
size_t count)
1457 struct adm1026_data *data = i2c_get_clientdata(client);
1462 err = kstrtol(buf, 10, &val);
1472 mask = ((mask >> 1) & 0x80) | (data->
alarm_mask >> 24 & 0x7f);
1483 struct adm1026_data *data = adm1026_update_device(dev);
1488 const char *buf,
size_t count)
1491 struct adm1026_data *data = i2c_get_clientdata(client);
1493 if (data->
pwm1.enable == 1) {
1497 err = kstrtol(buf, 10, &val);
1512 struct adm1026_data *data = adm1026_update_device(dev);
1513 return sprintf(buf,
"%d\n", data->
pwm1.auto_pwm_min);
1521 struct adm1026_data *data = i2c_get_clientdata(client);
1525 err = kstrtoul(buf, 10, &val);
1530 data->
pwm1.auto_pwm_min = SENSORS_LIMIT(val, 0, 255);
1531 if (data->
pwm1.enable == 2) {
1549 struct adm1026_data *data = adm1026_update_device(dev);
1554 const char *buf,
size_t count)
1557 struct adm1026_data *data = i2c_get_clientdata(client);
1562 err = kstrtoul(buf, 10, &val);
1570 old_enable = data->
pwm1.enable;
1579 }
else if (!((old_enable == 1) && (val == 1))) {
1581 data->
pwm1.pwm = 255;
1600 show_auto_pwm_min, set_auto_pwm_min);
1602 show_auto_pwm_min, set_auto_pwm_min);
1604 show_auto_pwm_min, set_auto_pwm_min);
1610 static struct attribute *adm1026_attributes[] = {
1611 &sensor_dev_attr_in0_input.dev_attr.attr,
1612 &sensor_dev_attr_in0_max.dev_attr.attr,
1613 &sensor_dev_attr_in0_min.dev_attr.attr,
1614 &sensor_dev_attr_in0_alarm.dev_attr.attr,
1615 &sensor_dev_attr_in1_input.dev_attr.attr,
1616 &sensor_dev_attr_in1_max.dev_attr.attr,
1617 &sensor_dev_attr_in1_min.dev_attr.attr,
1618 &sensor_dev_attr_in1_alarm.dev_attr.attr,
1619 &sensor_dev_attr_in2_input.dev_attr.attr,
1620 &sensor_dev_attr_in2_max.dev_attr.attr,
1621 &sensor_dev_attr_in2_min.dev_attr.attr,
1622 &sensor_dev_attr_in2_alarm.dev_attr.attr,
1623 &sensor_dev_attr_in3_input.dev_attr.attr,
1624 &sensor_dev_attr_in3_max.dev_attr.attr,
1625 &sensor_dev_attr_in3_min.dev_attr.attr,
1626 &sensor_dev_attr_in3_alarm.dev_attr.attr,
1627 &sensor_dev_attr_in4_input.dev_attr.attr,
1628 &sensor_dev_attr_in4_max.dev_attr.attr,
1629 &sensor_dev_attr_in4_min.dev_attr.attr,
1630 &sensor_dev_attr_in4_alarm.dev_attr.attr,
1631 &sensor_dev_attr_in5_input.dev_attr.attr,
1632 &sensor_dev_attr_in5_max.dev_attr.attr,
1633 &sensor_dev_attr_in5_min.dev_attr.attr,
1634 &sensor_dev_attr_in5_alarm.dev_attr.attr,
1635 &sensor_dev_attr_in6_input.dev_attr.attr,
1636 &sensor_dev_attr_in6_max.dev_attr.attr,
1637 &sensor_dev_attr_in6_min.dev_attr.attr,
1638 &sensor_dev_attr_in6_alarm.dev_attr.attr,
1639 &sensor_dev_attr_in7_input.dev_attr.attr,
1640 &sensor_dev_attr_in7_max.dev_attr.attr,
1641 &sensor_dev_attr_in7_min.dev_attr.attr,
1642 &sensor_dev_attr_in7_alarm.dev_attr.attr,
1643 &sensor_dev_attr_in10_input.dev_attr.attr,
1644 &sensor_dev_attr_in10_max.dev_attr.attr,
1645 &sensor_dev_attr_in10_min.dev_attr.attr,
1646 &sensor_dev_attr_in10_alarm.dev_attr.attr,
1647 &sensor_dev_attr_in11_input.dev_attr.attr,
1648 &sensor_dev_attr_in11_max.dev_attr.attr,
1649 &sensor_dev_attr_in11_min.dev_attr.attr,
1650 &sensor_dev_attr_in11_alarm.dev_attr.attr,
1651 &sensor_dev_attr_in12_input.dev_attr.attr,
1652 &sensor_dev_attr_in12_max.dev_attr.attr,
1653 &sensor_dev_attr_in12_min.dev_attr.attr,
1654 &sensor_dev_attr_in12_alarm.dev_attr.attr,
1655 &sensor_dev_attr_in13_input.dev_attr.attr,
1656 &sensor_dev_attr_in13_max.dev_attr.attr,
1657 &sensor_dev_attr_in13_min.dev_attr.attr,
1658 &sensor_dev_attr_in13_alarm.dev_attr.attr,
1659 &sensor_dev_attr_in14_input.dev_attr.attr,
1660 &sensor_dev_attr_in14_max.dev_attr.attr,
1661 &sensor_dev_attr_in14_min.dev_attr.attr,
1662 &sensor_dev_attr_in14_alarm.dev_attr.attr,
1663 &sensor_dev_attr_in15_input.dev_attr.attr,
1664 &sensor_dev_attr_in15_max.dev_attr.attr,
1665 &sensor_dev_attr_in15_min.dev_attr.attr,
1666 &sensor_dev_attr_in15_alarm.dev_attr.attr,
1667 &sensor_dev_attr_in16_input.dev_attr.attr,
1668 &sensor_dev_attr_in16_max.dev_attr.attr,
1669 &sensor_dev_attr_in16_min.dev_attr.attr,
1670 &sensor_dev_attr_in16_alarm.dev_attr.attr,
1671 &sensor_dev_attr_fan1_input.dev_attr.attr,
1672 &sensor_dev_attr_fan1_div.dev_attr.attr,
1673 &sensor_dev_attr_fan1_min.dev_attr.attr,
1674 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
1675 &sensor_dev_attr_fan2_input.dev_attr.attr,
1676 &sensor_dev_attr_fan2_div.dev_attr.attr,
1677 &sensor_dev_attr_fan2_min.dev_attr.attr,
1678 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
1679 &sensor_dev_attr_fan3_input.dev_attr.attr,
1680 &sensor_dev_attr_fan3_div.dev_attr.attr,
1681 &sensor_dev_attr_fan3_min.dev_attr.attr,
1682 &sensor_dev_attr_fan3_alarm.dev_attr.attr,
1683 &sensor_dev_attr_fan4_input.dev_attr.attr,
1684 &sensor_dev_attr_fan4_div.dev_attr.attr,
1685 &sensor_dev_attr_fan4_min.dev_attr.attr,
1686 &sensor_dev_attr_fan4_alarm.dev_attr.attr,
1687 &sensor_dev_attr_fan5_input.dev_attr.attr,
1688 &sensor_dev_attr_fan5_div.dev_attr.attr,
1689 &sensor_dev_attr_fan5_min.dev_attr.attr,
1690 &sensor_dev_attr_fan5_alarm.dev_attr.attr,
1691 &sensor_dev_attr_fan6_input.dev_attr.attr,
1692 &sensor_dev_attr_fan6_div.dev_attr.attr,
1693 &sensor_dev_attr_fan6_min.dev_attr.attr,
1694 &sensor_dev_attr_fan6_alarm.dev_attr.attr,
1695 &sensor_dev_attr_fan7_input.dev_attr.attr,
1696 &sensor_dev_attr_fan7_div.dev_attr.attr,
1697 &sensor_dev_attr_fan7_min.dev_attr.attr,
1698 &sensor_dev_attr_fan7_alarm.dev_attr.attr,
1699 &sensor_dev_attr_fan8_input.dev_attr.attr,
1700 &sensor_dev_attr_fan8_div.dev_attr.attr,
1701 &sensor_dev_attr_fan8_min.dev_attr.attr,
1702 &sensor_dev_attr_fan8_alarm.dev_attr.attr,
1703 &sensor_dev_attr_temp1_input.dev_attr.attr,
1704 &sensor_dev_attr_temp1_max.dev_attr.attr,
1705 &sensor_dev_attr_temp1_min.dev_attr.attr,
1706 &sensor_dev_attr_temp1_alarm.dev_attr.attr,
1707 &sensor_dev_attr_temp2_input.dev_attr.attr,
1708 &sensor_dev_attr_temp2_max.dev_attr.attr,
1709 &sensor_dev_attr_temp2_min.dev_attr.attr,
1710 &sensor_dev_attr_temp2_alarm.dev_attr.attr,
1711 &sensor_dev_attr_temp1_offset.dev_attr.attr,
1712 &sensor_dev_attr_temp2_offset.dev_attr.attr,
1713 &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr,
1714 &sensor_dev_attr_temp2_auto_point1_temp.dev_attr.attr,
1715 &sensor_dev_attr_temp1_auto_point1_temp_hyst.dev_attr.attr,
1716 &sensor_dev_attr_temp2_auto_point1_temp_hyst.dev_attr.attr,
1717 &sensor_dev_attr_temp1_auto_point2_temp.dev_attr.attr,
1718 &sensor_dev_attr_temp2_auto_point2_temp.dev_attr.attr,
1719 &sensor_dev_attr_temp1_crit.dev_attr.attr,
1720 &sensor_dev_attr_temp2_crit.dev_attr.attr,
1721 &dev_attr_temp1_crit_enable.attr,
1722 &dev_attr_temp2_crit_enable.attr,
1723 &dev_attr_cpu0_vid.attr,
1725 &dev_attr_alarms.attr,
1726 &dev_attr_alarm_mask.attr,
1727 &dev_attr_gpio.attr,
1728 &dev_attr_gpio_mask.attr,
1729 &dev_attr_pwm1.attr,
1730 &dev_attr_pwm2.attr,
1731 &dev_attr_pwm3.attr,
1732 &dev_attr_pwm1_enable.attr,
1733 &dev_attr_pwm2_enable.attr,
1734 &dev_attr_pwm3_enable.attr,
1735 &dev_attr_temp1_auto_point1_pwm.attr,
1736 &dev_attr_temp2_auto_point1_pwm.attr,
1737 &dev_attr_temp1_auto_point2_pwm.attr,
1738 &dev_attr_temp2_auto_point2_pwm.attr,
1739 &dev_attr_analog_out.attr,
1744 .attrs = adm1026_attributes,
1747 static struct attribute *adm1026_attributes_temp3[] = {
1748 &sensor_dev_attr_temp3_input.dev_attr.attr,
1749 &sensor_dev_attr_temp3_max.dev_attr.attr,
1750 &sensor_dev_attr_temp3_min.dev_attr.attr,
1751 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
1752 &sensor_dev_attr_temp3_offset.dev_attr.attr,
1753 &sensor_dev_attr_temp3_auto_point1_temp.dev_attr.attr,
1754 &sensor_dev_attr_temp3_auto_point1_temp_hyst.dev_attr.attr,
1755 &sensor_dev_attr_temp3_auto_point2_temp.dev_attr.attr,
1756 &sensor_dev_attr_temp3_crit.dev_attr.attr,
1757 &dev_attr_temp3_crit_enable.attr,
1758 &dev_attr_temp3_auto_point1_pwm.attr,
1759 &dev_attr_temp3_auto_point2_pwm.attr,
1764 .attrs = adm1026_attributes_temp3,
1767 static struct attribute *adm1026_attributes_in8_9[] = {
1768 &sensor_dev_attr_in8_input.dev_attr.attr,
1769 &sensor_dev_attr_in8_max.dev_attr.attr,
1770 &sensor_dev_attr_in8_min.dev_attr.attr,
1771 &sensor_dev_attr_in8_alarm.dev_attr.attr,
1772 &sensor_dev_attr_in9_input.dev_attr.attr,
1773 &sensor_dev_attr_in9_max.dev_attr.attr,
1774 &sensor_dev_attr_in9_min.dev_attr.attr,
1775 &sensor_dev_attr_in9_alarm.dev_attr.attr,
1780 .attrs = adm1026_attributes_in8_9,
1784 static int adm1026_detect(
struct i2c_client *client,
1789 int company, verstep;
1801 dev_dbg(&adapter->
dev,
"Detecting device at %d,0x%02x with"
1802 " COMPANY: 0x%02x and VERSTEP: 0x%02x\n",
1807 dev_dbg(&adapter->
dev,
"Autodetecting device at %d,0x%02x...\n",
1808 i2c_adapter_id(adapter), address);
1814 dev_err(&adapter->
dev,
"Unrecognized stepping "
1815 "0x%02x. Defaulting to ADM1026.\n", verstep);
1817 dev_err(&adapter->
dev,
"Found version/stepping "
1818 "0x%02x. Assuming generic ADM1026.\n",
1821 dev_dbg(&adapter->
dev,
"Autodetection failed\n");
1831 static int adm1026_probe(
struct i2c_client *client,
1842 i2c_set_clientdata(client, data);
1849 adm1026_init_client(client);
1857 &adm1026_group_in8_9);
1860 &adm1026_group_temp3);
1882 static int adm1026_remove(
struct i2c_client *client)
1884 struct adm1026_data *data = i2c_get_clientdata(client);