diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/hwmon/lm85.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/hwmon/lm85.c')
-rw-r--r-- | drivers/hwmon/lm85.c | 181 |
1 files changed, 119 insertions, 62 deletions
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index b3841a615595..da72dc12068c 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
@@ -41,7 +41,7 @@ static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | |||
41 | enum chips { | 41 | enum chips { |
42 | any_chip, lm85b, lm85c, | 42 | any_chip, lm85b, lm85c, |
43 | adm1027, adt7463, adt7468, | 43 | adm1027, adt7463, adt7468, |
44 | emc6d100, emc6d102 | 44 | emc6d100, emc6d102, emc6d103, emc6d103s |
45 | }; | 45 | }; |
46 | 46 | ||
47 | /* The LM85 registers */ | 47 | /* The LM85 registers */ |
@@ -64,9 +64,12 @@ enum chips { | |||
64 | #define LM85_REG_VERSTEP 0x3f | 64 | #define LM85_REG_VERSTEP 0x3f |
65 | 65 | ||
66 | #define ADT7468_REG_CFG5 0x7c | 66 | #define ADT7468_REG_CFG5 0x7c |
67 | #define ADT7468_OFF64 0x01 | 67 | #define ADT7468_OFF64 (1 << 0) |
68 | #define ADT7468_HFPWM (1 << 1) | ||
68 | #define IS_ADT7468_OFF64(data) \ | 69 | #define IS_ADT7468_OFF64(data) \ |
69 | ((data)->type == adt7468 && !((data)->cfg5 & ADT7468_OFF64)) | 70 | ((data)->type == adt7468 && !((data)->cfg5 & ADT7468_OFF64)) |
71 | #define IS_ADT7468_HFPWM(data) \ | ||
72 | ((data)->type == adt7468 && !((data)->cfg5 & ADT7468_HFPWM)) | ||
70 | 73 | ||
71 | /* These are the recognized values for the above regs */ | 74 | /* These are the recognized values for the above regs */ |
72 | #define LM85_COMPANY_NATIONAL 0x01 | 75 | #define LM85_COMPANY_NATIONAL 0x01 |
@@ -87,6 +90,9 @@ enum chips { | |||
87 | #define LM85_VERSTEP_EMC6D100_A0 0x60 | 90 | #define LM85_VERSTEP_EMC6D100_A0 0x60 |
88 | #define LM85_VERSTEP_EMC6D100_A1 0x61 | 91 | #define LM85_VERSTEP_EMC6D100_A1 0x61 |
89 | #define LM85_VERSTEP_EMC6D102 0x65 | 92 | #define LM85_VERSTEP_EMC6D102 0x65 |
93 | #define LM85_VERSTEP_EMC6D103_A0 0x68 | ||
94 | #define LM85_VERSTEP_EMC6D103_A1 0x69 | ||
95 | #define LM85_VERSTEP_EMC6D103S 0x6A /* Also known as EMC6D103:A2 */ | ||
90 | 96 | ||
91 | #define LM85_REG_CONFIG 0x40 | 97 | #define LM85_REG_CONFIG 0x40 |
92 | 98 | ||
@@ -124,7 +130,7 @@ enum chips { | |||
124 | these macros are called: arguments may be evaluated more than once. | 130 | these macros are called: arguments may be evaluated more than once. |
125 | */ | 131 | */ |
126 | 132 | ||
127 | /* IN are scaled acording to built-in resistors */ | 133 | /* IN are scaled according to built-in resistors */ |
128 | static const int lm85_scaling[] = { /* .001 Volts */ | 134 | static const int lm85_scaling[] = { /* .001 Volts */ |
129 | 2500, 2250, 3300, 5000, 12000, | 135 | 2500, 2250, 3300, 5000, 12000, |
130 | 3300, 1500, 1800 /*EMC6D100*/ | 136 | 3300, 1500, 1800 /*EMC6D100*/ |
@@ -277,10 +283,6 @@ struct lm85_zone { | |||
277 | u8 hyst; /* Low limit hysteresis. (0-15) */ | 283 | u8 hyst; /* Low limit hysteresis. (0-15) */ |
278 | u8 range; /* Temp range, encoded */ | 284 | u8 range; /* Temp range, encoded */ |
279 | s8 critical; /* "All fans ON" temp limit */ | 285 | s8 critical; /* "All fans ON" temp limit */ |
280 | u8 off_desired; /* Actual "off" temperature specified. Preserved | ||
281 | * to prevent "drift" as other autofan control | ||
282 | * values change. | ||
283 | */ | ||
284 | u8 max_desired; /* Actual "max" temperature specified. Preserved | 286 | u8 max_desired; /* Actual "max" temperature specified. Preserved |
285 | * to prevent "drift" as other autofan control | 287 | * to prevent "drift" as other autofan control |
286 | * values change. | 288 | * values change. |
@@ -300,6 +302,8 @@ struct lm85_data { | |||
300 | const int *freq_map; | 302 | const int *freq_map; |
301 | enum chips type; | 303 | enum chips type; |
302 | 304 | ||
305 | bool has_vid5; /* true if VID5 is configured for ADT7463 or ADT7468 */ | ||
306 | |||
303 | struct mutex update_lock; | 307 | struct mutex update_lock; |
304 | int valid; /* !=0 if following fields are valid */ | 308 | int valid; /* !=0 if following fields are valid */ |
305 | unsigned long last_reading; /* In jiffies */ | 309 | unsigned long last_reading; /* In jiffies */ |
@@ -345,6 +349,8 @@ static const struct i2c_device_id lm85_id[] = { | |||
345 | { "emc6d100", emc6d100 }, | 349 | { "emc6d100", emc6d100 }, |
346 | { "emc6d101", emc6d100 }, | 350 | { "emc6d101", emc6d100 }, |
347 | { "emc6d102", emc6d102 }, | 351 | { "emc6d102", emc6d102 }, |
352 | { "emc6d103", emc6d103 }, | ||
353 | { "emc6d103s", emc6d103s }, | ||
348 | { } | 354 | { } |
349 | }; | 355 | }; |
350 | MODULE_DEVICE_TABLE(i2c, lm85_id); | 356 | MODULE_DEVICE_TABLE(i2c, lm85_id); |
@@ -413,8 +419,7 @@ static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, | |||
413 | struct lm85_data *data = lm85_update_device(dev); | 419 | struct lm85_data *data = lm85_update_device(dev); |
414 | int vid; | 420 | int vid; |
415 | 421 | ||
416 | if ((data->type == adt7463 || data->type == adt7468) && | 422 | if (data->has_vid5) { |
417 | (data->vid & 0x80)) { | ||
418 | /* 6-pin VID (VRM 10) */ | 423 | /* 6-pin VID (VRM 10) */ |
419 | vid = vid_from_reg(data->vid & 0x3f, data->vrm); | 424 | vid = vid_from_reg(data->vid & 0x3f, data->vrm); |
420 | } else { | 425 | } else { |
@@ -567,8 +572,14 @@ static ssize_t show_pwm_freq(struct device *dev, | |||
567 | { | 572 | { |
568 | int nr = to_sensor_dev_attr(attr)->index; | 573 | int nr = to_sensor_dev_attr(attr)->index; |
569 | struct lm85_data *data = lm85_update_device(dev); | 574 | struct lm85_data *data = lm85_update_device(dev); |
570 | return sprintf(buf, "%d\n", FREQ_FROM_REG(data->freq_map, | 575 | int freq; |
571 | data->pwm_freq[nr])); | 576 | |
577 | if (IS_ADT7468_HFPWM(data)) | ||
578 | freq = 22500; | ||
579 | else | ||
580 | freq = FREQ_FROM_REG(data->freq_map, data->pwm_freq[nr]); | ||
581 | |||
582 | return sprintf(buf, "%d\n", freq); | ||
572 | } | 583 | } |
573 | 584 | ||
574 | static ssize_t set_pwm_freq(struct device *dev, | 585 | static ssize_t set_pwm_freq(struct device *dev, |
@@ -580,10 +591,22 @@ static ssize_t set_pwm_freq(struct device *dev, | |||
580 | long val = simple_strtol(buf, NULL, 10); | 591 | long val = simple_strtol(buf, NULL, 10); |
581 | 592 | ||
582 | mutex_lock(&data->update_lock); | 593 | mutex_lock(&data->update_lock); |
583 | data->pwm_freq[nr] = FREQ_TO_REG(data->freq_map, val); | 594 | /* The ADT7468 has a special high-frequency PWM output mode, |
584 | lm85_write_value(client, LM85_REG_AFAN_RANGE(nr), | 595 | * where all PWM outputs are driven by a 22.5 kHz clock. |
585 | (data->zone[nr].range << 4) | 596 | * This might confuse the user, but there's not much we can do. */ |
586 | | data->pwm_freq[nr]); | 597 | if (data->type == adt7468 && val >= 11300) { /* High freq. mode */ |
598 | data->cfg5 &= ~ADT7468_HFPWM; | ||
599 | lm85_write_value(client, ADT7468_REG_CFG5, data->cfg5); | ||
600 | } else { /* Low freq. mode */ | ||
601 | data->pwm_freq[nr] = FREQ_TO_REG(data->freq_map, val); | ||
602 | lm85_write_value(client, LM85_REG_AFAN_RANGE(nr), | ||
603 | (data->zone[nr].range << 4) | ||
604 | | data->pwm_freq[nr]); | ||
605 | if (data->type == adt7468) { | ||
606 | data->cfg5 |= ADT7468_HFPWM; | ||
607 | lm85_write_value(client, ADT7468_REG_CFG5, data->cfg5); | ||
608 | } | ||
609 | } | ||
587 | mutex_unlock(&data->update_lock); | 610 | mutex_unlock(&data->update_lock); |
588 | return count; | 611 | return count; |
589 | } | 612 | } |
@@ -866,7 +889,6 @@ static ssize_t set_temp_auto_temp_off(struct device *dev, | |||
866 | 889 | ||
867 | mutex_lock(&data->update_lock); | 890 | mutex_lock(&data->update_lock); |
868 | min = TEMP_FROM_REG(data->zone[nr].limit); | 891 | min = TEMP_FROM_REG(data->zone[nr].limit); |
869 | data->zone[nr].off_desired = TEMP_TO_REG(val); | ||
870 | data->zone[nr].hyst = HYST_TO_REG(min - val); | 892 | data->zone[nr].hyst = HYST_TO_REG(min - val); |
871 | if (nr == 0 || nr == 1) { | 893 | if (nr == 0 || nr == 1) { |
872 | lm85_write_value(client, LM85_REG_AFAN_HYST1, | 894 | lm85_write_value(client, LM85_REG_AFAN_HYST1, |
@@ -909,18 +931,6 @@ static ssize_t set_temp_auto_temp_min(struct device *dev, | |||
909 | ((data->zone[nr].range & 0x0f) << 4) | 931 | ((data->zone[nr].range & 0x0f) << 4) |
910 | | (data->pwm_freq[nr] & 0x07)); | 932 | | (data->pwm_freq[nr] & 0x07)); |
911 | 933 | ||
912 | /* Update temp_auto_hyst and temp_auto_off */ | ||
913 | data->zone[nr].hyst = HYST_TO_REG(TEMP_FROM_REG( | ||
914 | data->zone[nr].limit) - TEMP_FROM_REG( | ||
915 | data->zone[nr].off_desired)); | ||
916 | if (nr == 0 || nr == 1) { | ||
917 | lm85_write_value(client, LM85_REG_AFAN_HYST1, | ||
918 | (data->zone[0].hyst << 4) | ||
919 | | data->zone[1].hyst); | ||
920 | } else { | ||
921 | lm85_write_value(client, LM85_REG_AFAN_HYST2, | ||
922 | (data->zone[2].hyst << 4)); | ||
923 | } | ||
924 | mutex_unlock(&data->update_lock); | 934 | mutex_unlock(&data->update_lock); |
925 | return count; | 935 | return count; |
926 | } | 936 | } |
@@ -1059,13 +1069,7 @@ static struct attribute *lm85_attributes[] = { | |||
1059 | &sensor_dev_attr_pwm1_auto_pwm_min.dev_attr.attr, | 1069 | &sensor_dev_attr_pwm1_auto_pwm_min.dev_attr.attr, |
1060 | &sensor_dev_attr_pwm2_auto_pwm_min.dev_attr.attr, | 1070 | &sensor_dev_attr_pwm2_auto_pwm_min.dev_attr.attr, |
1061 | &sensor_dev_attr_pwm3_auto_pwm_min.dev_attr.attr, | 1071 | &sensor_dev_attr_pwm3_auto_pwm_min.dev_attr.attr, |
1062 | &sensor_dev_attr_pwm1_auto_pwm_minctl.dev_attr.attr, | ||
1063 | &sensor_dev_attr_pwm2_auto_pwm_minctl.dev_attr.attr, | ||
1064 | &sensor_dev_attr_pwm3_auto_pwm_minctl.dev_attr.attr, | ||
1065 | 1072 | ||
1066 | &sensor_dev_attr_temp1_auto_temp_off.dev_attr.attr, | ||
1067 | &sensor_dev_attr_temp2_auto_temp_off.dev_attr.attr, | ||
1068 | &sensor_dev_attr_temp3_auto_temp_off.dev_attr.attr, | ||
1069 | &sensor_dev_attr_temp1_auto_temp_min.dev_attr.attr, | 1073 | &sensor_dev_attr_temp1_auto_temp_min.dev_attr.attr, |
1070 | &sensor_dev_attr_temp2_auto_temp_min.dev_attr.attr, | 1074 | &sensor_dev_attr_temp2_auto_temp_min.dev_attr.attr, |
1071 | &sensor_dev_attr_temp3_auto_temp_min.dev_attr.attr, | 1075 | &sensor_dev_attr_temp3_auto_temp_min.dev_attr.attr, |
@@ -1086,6 +1090,28 @@ static const struct attribute_group lm85_group = { | |||
1086 | .attrs = lm85_attributes, | 1090 | .attrs = lm85_attributes, |
1087 | }; | 1091 | }; |
1088 | 1092 | ||
1093 | static struct attribute *lm85_attributes_minctl[] = { | ||
1094 | &sensor_dev_attr_pwm1_auto_pwm_minctl.dev_attr.attr, | ||
1095 | &sensor_dev_attr_pwm2_auto_pwm_minctl.dev_attr.attr, | ||
1096 | &sensor_dev_attr_pwm3_auto_pwm_minctl.dev_attr.attr, | ||
1097 | NULL | ||
1098 | }; | ||
1099 | |||
1100 | static const struct attribute_group lm85_group_minctl = { | ||
1101 | .attrs = lm85_attributes_minctl, | ||
1102 | }; | ||
1103 | |||
1104 | static struct attribute *lm85_attributes_temp_off[] = { | ||
1105 | &sensor_dev_attr_temp1_auto_temp_off.dev_attr.attr, | ||
1106 | &sensor_dev_attr_temp2_auto_temp_off.dev_attr.attr, | ||
1107 | &sensor_dev_attr_temp3_auto_temp_off.dev_attr.attr, | ||
1108 | NULL | ||
1109 | }; | ||
1110 | |||
1111 | static const struct attribute_group lm85_group_temp_off = { | ||
1112 | .attrs = lm85_attributes_temp_off, | ||
1113 | }; | ||
1114 | |||
1089 | static struct attribute *lm85_attributes_in4[] = { | 1115 | static struct attribute *lm85_attributes_in4[] = { |
1090 | &sensor_dev_attr_in4_input.dev_attr.attr, | 1116 | &sensor_dev_attr_in4_input.dev_attr.attr, |
1091 | &sensor_dev_attr_in4_min.dev_attr.attr, | 1117 | &sensor_dev_attr_in4_min.dev_attr.attr, |
@@ -1229,6 +1255,13 @@ static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info) | |||
1229 | case LM85_VERSTEP_EMC6D102: | 1255 | case LM85_VERSTEP_EMC6D102: |
1230 | type_name = "emc6d102"; | 1256 | type_name = "emc6d102"; |
1231 | break; | 1257 | break; |
1258 | case LM85_VERSTEP_EMC6D103_A0: | ||
1259 | case LM85_VERSTEP_EMC6D103_A1: | ||
1260 | type_name = "emc6d103"; | ||
1261 | break; | ||
1262 | case LM85_VERSTEP_EMC6D103S: | ||
1263 | type_name = "emc6d103s"; | ||
1264 | break; | ||
1232 | } | 1265 | } |
1233 | } else { | 1266 | } else { |
1234 | dev_dbg(&adapter->dev, | 1267 | dev_dbg(&adapter->dev, |
@@ -1241,6 +1274,19 @@ static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info) | |||
1241 | return 0; | 1274 | return 0; |
1242 | } | 1275 | } |
1243 | 1276 | ||
1277 | static void lm85_remove_files(struct i2c_client *client, struct lm85_data *data) | ||
1278 | { | ||
1279 | sysfs_remove_group(&client->dev.kobj, &lm85_group); | ||
1280 | if (data->type != emc6d103s) { | ||
1281 | sysfs_remove_group(&client->dev.kobj, &lm85_group_minctl); | ||
1282 | sysfs_remove_group(&client->dev.kobj, &lm85_group_temp_off); | ||
1283 | } | ||
1284 | if (!data->has_vid5) | ||
1285 | sysfs_remove_group(&client->dev.kobj, &lm85_group_in4); | ||
1286 | if (data->type == emc6d100) | ||
1287 | sysfs_remove_group(&client->dev.kobj, &lm85_group_in567); | ||
1288 | } | ||
1289 | |||
1244 | static int lm85_probe(struct i2c_client *client, | 1290 | static int lm85_probe(struct i2c_client *client, |
1245 | const struct i2c_device_id *id) | 1291 | const struct i2c_device_id *id) |
1246 | { | 1292 | { |
@@ -1259,8 +1305,11 @@ static int lm85_probe(struct i2c_client *client, | |||
1259 | switch (data->type) { | 1305 | switch (data->type) { |
1260 | case adm1027: | 1306 | case adm1027: |
1261 | case adt7463: | 1307 | case adt7463: |
1308 | case adt7468: | ||
1262 | case emc6d100: | 1309 | case emc6d100: |
1263 | case emc6d102: | 1310 | case emc6d102: |
1311 | case emc6d103: | ||
1312 | case emc6d103s: | ||
1264 | data->freq_map = adm1027_freq_map; | 1313 | data->freq_map = adm1027_freq_map; |
1265 | break; | 1314 | break; |
1266 | default: | 1315 | default: |
@@ -1278,11 +1327,26 @@ static int lm85_probe(struct i2c_client *client, | |||
1278 | if (err) | 1327 | if (err) |
1279 | goto err_kfree; | 1328 | goto err_kfree; |
1280 | 1329 | ||
1330 | /* minctl and temp_off exist on all chips except emc6d103s */ | ||
1331 | if (data->type != emc6d103s) { | ||
1332 | err = sysfs_create_group(&client->dev.kobj, &lm85_group_minctl); | ||
1333 | if (err) | ||
1334 | goto err_remove_files; | ||
1335 | err = sysfs_create_group(&client->dev.kobj, | ||
1336 | &lm85_group_temp_off); | ||
1337 | if (err) | ||
1338 | goto err_remove_files; | ||
1339 | } | ||
1340 | |||
1281 | /* The ADT7463/68 have an optional VRM 10 mode where pin 21 is used | 1341 | /* The ADT7463/68 have an optional VRM 10 mode where pin 21 is used |
1282 | as a sixth digital VID input rather than an analog input. */ | 1342 | as a sixth digital VID input rather than an analog input. */ |
1283 | data->vid = lm85_read_value(client, LM85_REG_VID); | 1343 | if (data->type == adt7463 || data->type == adt7468) { |
1284 | if (!((data->type == adt7463 || data->type == adt7468) && | 1344 | u8 vid = lm85_read_value(client, LM85_REG_VID); |
1285 | (data->vid & 0x80))) | 1345 | if (vid & 0x80) |
1346 | data->has_vid5 = true; | ||
1347 | } | ||
1348 | |||
1349 | if (!data->has_vid5) | ||
1286 | if ((err = sysfs_create_group(&client->dev.kobj, | 1350 | if ((err = sysfs_create_group(&client->dev.kobj, |
1287 | &lm85_group_in4))) | 1351 | &lm85_group_in4))) |
1288 | goto err_remove_files; | 1352 | goto err_remove_files; |
@@ -1303,10 +1367,7 @@ static int lm85_probe(struct i2c_client *client, | |||
1303 | 1367 | ||
1304 | /* Error out and cleanup code */ | 1368 | /* Error out and cleanup code */ |
1305 | err_remove_files: | 1369 | err_remove_files: |
1306 | sysfs_remove_group(&client->dev.kobj, &lm85_group); | 1370 | lm85_remove_files(client, data); |
1307 | sysfs_remove_group(&client->dev.kobj, &lm85_group_in4); | ||
1308 | if (data->type == emc6d100) | ||
1309 | sysfs_remove_group(&client->dev.kobj, &lm85_group_in567); | ||
1310 | err_kfree: | 1371 | err_kfree: |
1311 | kfree(data); | 1372 | kfree(data); |
1312 | return err; | 1373 | return err; |
@@ -1316,10 +1377,7 @@ static int lm85_remove(struct i2c_client *client) | |||
1316 | { | 1377 | { |
1317 | struct lm85_data *data = i2c_get_clientdata(client); | 1378 | struct lm85_data *data = i2c_get_clientdata(client); |
1318 | hwmon_device_unregister(data->hwmon_dev); | 1379 | hwmon_device_unregister(data->hwmon_dev); |
1319 | sysfs_remove_group(&client->dev.kobj, &lm85_group); | 1380 | lm85_remove_files(client, data); |
1320 | sysfs_remove_group(&client->dev.kobj, &lm85_group_in4); | ||
1321 | if (data->type == emc6d100) | ||
1322 | sysfs_remove_group(&client->dev.kobj, &lm85_group_in567); | ||
1323 | kfree(data); | 1381 | kfree(data); |
1324 | return 0; | 1382 | return 0; |
1325 | } | 1383 | } |
@@ -1416,11 +1474,8 @@ static struct lm85_data *lm85_update_device(struct device *dev) | |||
1416 | lm85_read_value(client, LM85_REG_FAN(i)); | 1474 | lm85_read_value(client, LM85_REG_FAN(i)); |
1417 | } | 1475 | } |
1418 | 1476 | ||
1419 | if (!((data->type == adt7463 || data->type == adt7468) && | 1477 | if (!data->has_vid5) |
1420 | (data->vid & 0x80))) { | 1478 | data->in[4] = lm85_read_value(client, LM85_REG_IN(4)); |
1421 | data->in[4] = lm85_read_value(client, | ||
1422 | LM85_REG_IN(4)); | ||
1423 | } | ||
1424 | 1479 | ||
1425 | if (data->type == adt7468) | 1480 | if (data->type == adt7468) |
1426 | data->cfg5 = lm85_read_value(client, ADT7468_REG_CFG5); | 1481 | data->cfg5 = lm85_read_value(client, ADT7468_REG_CFG5); |
@@ -1446,7 +1501,8 @@ static struct lm85_data *lm85_update_device(struct device *dev) | |||
1446 | /* More alarm bits */ | 1501 | /* More alarm bits */ |
1447 | data->alarms |= lm85_read_value(client, | 1502 | data->alarms |= lm85_read_value(client, |
1448 | EMC6D100_REG_ALARM3) << 16; | 1503 | EMC6D100_REG_ALARM3) << 16; |
1449 | } else if (data->type == emc6d102) { | 1504 | } else if (data->type == emc6d102 || data->type == emc6d103 || |
1505 | data->type == emc6d103s) { | ||
1450 | /* Have to read LSB bits after the MSB ones because | 1506 | /* Have to read LSB bits after the MSB ones because |
1451 | the reading of the MSB bits has frozen the | 1507 | the reading of the MSB bits has frozen the |
1452 | LSBs (backward from the ADM1027). | 1508 | LSBs (backward from the ADM1027). |
@@ -1487,8 +1543,7 @@ static struct lm85_data *lm85_update_device(struct device *dev) | |||
1487 | lm85_read_value(client, LM85_REG_FAN_MIN(i)); | 1543 | lm85_read_value(client, LM85_REG_FAN_MIN(i)); |
1488 | } | 1544 | } |
1489 | 1545 | ||
1490 | if (!((data->type == adt7463 || data->type == adt7468) && | 1546 | if (!data->has_vid5) { |
1491 | (data->vid & 0x80))) { | ||
1492 | data->in_min[4] = lm85_read_value(client, | 1547 | data->in_min[4] = lm85_read_value(client, |
1493 | LM85_REG_IN_MIN(4)); | 1548 | LM85_REG_IN_MIN(4)); |
1494 | data->in_max[4] = lm85_read_value(client, | 1549 | data->in_max[4] = lm85_read_value(client, |
@@ -1532,17 +1587,19 @@ static struct lm85_data *lm85_update_device(struct device *dev) | |||
1532 | } | 1587 | } |
1533 | } | 1588 | } |
1534 | 1589 | ||
1535 | i = lm85_read_value(client, LM85_REG_AFAN_SPIKE1); | 1590 | if (data->type != emc6d103s) { |
1536 | data->autofan[0].min_off = (i & 0x20) != 0; | 1591 | i = lm85_read_value(client, LM85_REG_AFAN_SPIKE1); |
1537 | data->autofan[1].min_off = (i & 0x40) != 0; | 1592 | data->autofan[0].min_off = (i & 0x20) != 0; |
1538 | data->autofan[2].min_off = (i & 0x80) != 0; | 1593 | data->autofan[1].min_off = (i & 0x40) != 0; |
1594 | data->autofan[2].min_off = (i & 0x80) != 0; | ||
1539 | 1595 | ||
1540 | i = lm85_read_value(client, LM85_REG_AFAN_HYST1); | 1596 | i = lm85_read_value(client, LM85_REG_AFAN_HYST1); |
1541 | data->zone[0].hyst = i >> 4; | 1597 | data->zone[0].hyst = i >> 4; |
1542 | data->zone[1].hyst = i & 0x0f; | 1598 | data->zone[1].hyst = i & 0x0f; |
1543 | 1599 | ||
1544 | i = lm85_read_value(client, LM85_REG_AFAN_HYST2); | 1600 | i = lm85_read_value(client, LM85_REG_AFAN_HYST2); |
1545 | data->zone[2].hyst = i >> 4; | 1601 | data->zone[2].hyst = i >> 4; |
1602 | } | ||
1546 | 1603 | ||
1547 | data->last_config = jiffies; | 1604 | data->last_config = jiffies; |
1548 | } /* last_config */ | 1605 | } /* last_config */ |