diff options
Diffstat (limited to 'drivers/hwmon/pc87360.c')
-rw-r--r-- | drivers/hwmon/pc87360.c | 248 |
1 files changed, 225 insertions, 23 deletions
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index 9b462bb13fa3..5fbfa34c110e 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c | |||
@@ -75,7 +75,8 @@ MODULE_PARM_DESC(force_id, "Override the detected device ID"); | |||
75 | #define FSCM 0x09 /* Logical device: fans */ | 75 | #define FSCM 0x09 /* Logical device: fans */ |
76 | #define VLM 0x0d /* Logical device: voltages */ | 76 | #define VLM 0x0d /* Logical device: voltages */ |
77 | #define TMS 0x0e /* Logical device: temperatures */ | 77 | #define TMS 0x0e /* Logical device: temperatures */ |
78 | static const u8 logdev[3] = { FSCM, VLM, TMS }; | 78 | #define LDNI_MAX 3 |
79 | static const u8 logdev[LDNI_MAX] = { FSCM, VLM, TMS }; | ||
79 | 80 | ||
80 | #define LD_FAN 0 | 81 | #define LD_FAN 0 |
81 | #define LD_IN 1 | 82 | #define LD_IN 1 |
@@ -489,11 +490,66 @@ static struct sensor_device_attribute in_max[] = { | |||
489 | SENSOR_ATTR(in10_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 10), | 490 | SENSOR_ATTR(in10_max, S_IWUSR | S_IRUGO, show_in_max, set_in_max, 10), |
490 | }; | 491 | }; |
491 | 492 | ||
493 | /* (temp & vin) channel status register alarm bits (pdf sec.11.5.12) */ | ||
494 | #define CHAN_ALM_MIN 0x02 /* min limit crossed */ | ||
495 | #define CHAN_ALM_MAX 0x04 /* max limit exceeded */ | ||
496 | #define TEMP_ALM_CRIT 0x08 /* temp crit exceeded (temp only) */ | ||
497 | |||
498 | /* show_in_min/max_alarm() reads data from the per-channel status | ||
499 | register (sec 11.5.12), not the vin event status registers (sec | ||
500 | 11.5.2) that (legacy) show_in_alarm() resds (via data->in_alarms) */ | ||
501 | |||
502 | static ssize_t show_in_min_alarm(struct device *dev, | ||
503 | struct device_attribute *devattr, char *buf) | ||
504 | { | ||
505 | struct pc87360_data *data = pc87360_update_device(dev); | ||
506 | unsigned nr = to_sensor_dev_attr(devattr)->index; | ||
507 | |||
508 | return sprintf(buf, "%u\n", !!(data->in_status[nr] & CHAN_ALM_MIN)); | ||
509 | } | ||
510 | static ssize_t show_in_max_alarm(struct device *dev, | ||
511 | struct device_attribute *devattr, char *buf) | ||
512 | { | ||
513 | struct pc87360_data *data = pc87360_update_device(dev); | ||
514 | unsigned nr = to_sensor_dev_attr(devattr)->index; | ||
515 | |||
516 | return sprintf(buf, "%u\n", !!(data->in_status[nr] & CHAN_ALM_MAX)); | ||
517 | } | ||
518 | |||
519 | static struct sensor_device_attribute in_min_alarm[] = { | ||
520 | SENSOR_ATTR(in0_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 0), | ||
521 | SENSOR_ATTR(in1_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 1), | ||
522 | SENSOR_ATTR(in2_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 2), | ||
523 | SENSOR_ATTR(in3_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 3), | ||
524 | SENSOR_ATTR(in4_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 4), | ||
525 | SENSOR_ATTR(in5_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 5), | ||
526 | SENSOR_ATTR(in6_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 6), | ||
527 | SENSOR_ATTR(in7_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 7), | ||
528 | SENSOR_ATTR(in8_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 8), | ||
529 | SENSOR_ATTR(in9_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 9), | ||
530 | SENSOR_ATTR(in10_min_alarm, S_IRUGO, show_in_min_alarm, NULL, 10), | ||
531 | }; | ||
532 | static struct sensor_device_attribute in_max_alarm[] = { | ||
533 | SENSOR_ATTR(in0_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 0), | ||
534 | SENSOR_ATTR(in1_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 1), | ||
535 | SENSOR_ATTR(in2_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 2), | ||
536 | SENSOR_ATTR(in3_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 3), | ||
537 | SENSOR_ATTR(in4_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 4), | ||
538 | SENSOR_ATTR(in5_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 5), | ||
539 | SENSOR_ATTR(in6_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 6), | ||
540 | SENSOR_ATTR(in7_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 7), | ||
541 | SENSOR_ATTR(in8_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 8), | ||
542 | SENSOR_ATTR(in9_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 9), | ||
543 | SENSOR_ATTR(in10_max_alarm, S_IRUGO, show_in_max_alarm, NULL, 10), | ||
544 | }; | ||
545 | |||
492 | #define VIN_UNIT_ATTRS(X) \ | 546 | #define VIN_UNIT_ATTRS(X) \ |
493 | &in_input[X].dev_attr.attr, \ | 547 | &in_input[X].dev_attr.attr, \ |
494 | &in_status[X].dev_attr.attr, \ | 548 | &in_status[X].dev_attr.attr, \ |
495 | &in_min[X].dev_attr.attr, \ | 549 | &in_min[X].dev_attr.attr, \ |
496 | &in_max[X].dev_attr.attr | 550 | &in_max[X].dev_attr.attr, \ |
551 | &in_min_alarm[X].dev_attr.attr, \ | ||
552 | &in_max_alarm[X].dev_attr.attr | ||
497 | 553 | ||
498 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) | 554 | static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) |
499 | { | 555 | { |
@@ -658,12 +714,68 @@ static struct sensor_device_attribute therm_crit[] = { | |||
658 | show_therm_crit, set_therm_crit, 2+11), | 714 | show_therm_crit, set_therm_crit, 2+11), |
659 | }; | 715 | }; |
660 | 716 | ||
717 | /* show_therm_min/max_alarm() reads data from the per-channel voltage | ||
718 | status register (sec 11.5.12) */ | ||
719 | |||
720 | static ssize_t show_therm_min_alarm(struct device *dev, | ||
721 | struct device_attribute *devattr, char *buf) | ||
722 | { | ||
723 | struct pc87360_data *data = pc87360_update_device(dev); | ||
724 | unsigned nr = to_sensor_dev_attr(devattr)->index; | ||
725 | |||
726 | return sprintf(buf, "%u\n", !!(data->in_status[nr] & CHAN_ALM_MIN)); | ||
727 | } | ||
728 | static ssize_t show_therm_max_alarm(struct device *dev, | ||
729 | struct device_attribute *devattr, char *buf) | ||
730 | { | ||
731 | struct pc87360_data *data = pc87360_update_device(dev); | ||
732 | unsigned nr = to_sensor_dev_attr(devattr)->index; | ||
733 | |||
734 | return sprintf(buf, "%u\n", !!(data->in_status[nr] & CHAN_ALM_MAX)); | ||
735 | } | ||
736 | static ssize_t show_therm_crit_alarm(struct device *dev, | ||
737 | struct device_attribute *devattr, char *buf) | ||
738 | { | ||
739 | struct pc87360_data *data = pc87360_update_device(dev); | ||
740 | unsigned nr = to_sensor_dev_attr(devattr)->index; | ||
741 | |||
742 | return sprintf(buf, "%u\n", !!(data->in_status[nr] & TEMP_ALM_CRIT)); | ||
743 | } | ||
744 | |||
745 | static struct sensor_device_attribute therm_min_alarm[] = { | ||
746 | SENSOR_ATTR(temp4_min_alarm, S_IRUGO, | ||
747 | show_therm_min_alarm, NULL, 0+11), | ||
748 | SENSOR_ATTR(temp5_min_alarm, S_IRUGO, | ||
749 | show_therm_min_alarm, NULL, 1+11), | ||
750 | SENSOR_ATTR(temp6_min_alarm, S_IRUGO, | ||
751 | show_therm_min_alarm, NULL, 2+11), | ||
752 | }; | ||
753 | static struct sensor_device_attribute therm_max_alarm[] = { | ||
754 | SENSOR_ATTR(temp4_max_alarm, S_IRUGO, | ||
755 | show_therm_max_alarm, NULL, 0+11), | ||
756 | SENSOR_ATTR(temp5_max_alarm, S_IRUGO, | ||
757 | show_therm_max_alarm, NULL, 1+11), | ||
758 | SENSOR_ATTR(temp6_max_alarm, S_IRUGO, | ||
759 | show_therm_max_alarm, NULL, 2+11), | ||
760 | }; | ||
761 | static struct sensor_device_attribute therm_crit_alarm[] = { | ||
762 | SENSOR_ATTR(temp4_crit_alarm, S_IRUGO, | ||
763 | show_therm_crit_alarm, NULL, 0+11), | ||
764 | SENSOR_ATTR(temp5_crit_alarm, S_IRUGO, | ||
765 | show_therm_crit_alarm, NULL, 1+11), | ||
766 | SENSOR_ATTR(temp6_crit_alarm, S_IRUGO, | ||
767 | show_therm_crit_alarm, NULL, 2+11), | ||
768 | }; | ||
769 | |||
661 | #define THERM_UNIT_ATTRS(X) \ | 770 | #define THERM_UNIT_ATTRS(X) \ |
662 | &therm_input[X].dev_attr.attr, \ | 771 | &therm_input[X].dev_attr.attr, \ |
663 | &therm_status[X].dev_attr.attr, \ | 772 | &therm_status[X].dev_attr.attr, \ |
664 | &therm_min[X].dev_attr.attr, \ | 773 | &therm_min[X].dev_attr.attr, \ |
665 | &therm_max[X].dev_attr.attr, \ | 774 | &therm_max[X].dev_attr.attr, \ |
666 | &therm_crit[X].dev_attr.attr | 775 | &therm_crit[X].dev_attr.attr, \ |
776 | &therm_min_alarm[X].dev_attr.attr, \ | ||
777 | &therm_max_alarm[X].dev_attr.attr, \ | ||
778 | &therm_crit_alarm[X].dev_attr.attr | ||
667 | 779 | ||
668 | static struct attribute * pc8736x_therm_attr_array[] = { | 780 | static struct attribute * pc8736x_therm_attr_array[] = { |
669 | THERM_UNIT_ATTRS(0), | 781 | THERM_UNIT_ATTRS(0), |
@@ -790,12 +902,76 @@ static ssize_t show_temp_alarms(struct device *dev, struct device_attribute *att | |||
790 | } | 902 | } |
791 | static DEVICE_ATTR(alarms_temp, S_IRUGO, show_temp_alarms, NULL); | 903 | static DEVICE_ATTR(alarms_temp, S_IRUGO, show_temp_alarms, NULL); |
792 | 904 | ||
905 | /* show_temp_min/max_alarm() reads data from the per-channel status | ||
906 | register (sec 12.3.7), not the temp event status registers (sec | ||
907 | 12.3.2) that show_temp_alarm() reads (via data->temp_alarms) */ | ||
908 | |||
909 | static ssize_t show_temp_min_alarm(struct device *dev, | ||
910 | struct device_attribute *devattr, char *buf) | ||
911 | { | ||
912 | struct pc87360_data *data = pc87360_update_device(dev); | ||
913 | unsigned nr = to_sensor_dev_attr(devattr)->index; | ||
914 | |||
915 | return sprintf(buf, "%u\n", !!(data->temp_status[nr] & CHAN_ALM_MIN)); | ||
916 | } | ||
917 | static ssize_t show_temp_max_alarm(struct device *dev, | ||
918 | struct device_attribute *devattr, char *buf) | ||
919 | { | ||
920 | struct pc87360_data *data = pc87360_update_device(dev); | ||
921 | unsigned nr = to_sensor_dev_attr(devattr)->index; | ||
922 | |||
923 | return sprintf(buf, "%u\n", !!(data->temp_status[nr] & CHAN_ALM_MAX)); | ||
924 | } | ||
925 | static ssize_t show_temp_crit_alarm(struct device *dev, | ||
926 | struct device_attribute *devattr, char *buf) | ||
927 | { | ||
928 | struct pc87360_data *data = pc87360_update_device(dev); | ||
929 | unsigned nr = to_sensor_dev_attr(devattr)->index; | ||
930 | |||
931 | return sprintf(buf, "%u\n", !!(data->temp_status[nr] & TEMP_ALM_CRIT)); | ||
932 | } | ||
933 | |||
934 | static struct sensor_device_attribute temp_min_alarm[] = { | ||
935 | SENSOR_ATTR(temp1_min_alarm, S_IRUGO, show_temp_min_alarm, NULL, 0), | ||
936 | SENSOR_ATTR(temp2_min_alarm, S_IRUGO, show_temp_min_alarm, NULL, 1), | ||
937 | SENSOR_ATTR(temp3_min_alarm, S_IRUGO, show_temp_min_alarm, NULL, 2), | ||
938 | }; | ||
939 | static struct sensor_device_attribute temp_max_alarm[] = { | ||
940 | SENSOR_ATTR(temp1_max_alarm, S_IRUGO, show_temp_max_alarm, NULL, 0), | ||
941 | SENSOR_ATTR(temp2_max_alarm, S_IRUGO, show_temp_max_alarm, NULL, 1), | ||
942 | SENSOR_ATTR(temp3_max_alarm, S_IRUGO, show_temp_max_alarm, NULL, 2), | ||
943 | }; | ||
944 | static struct sensor_device_attribute temp_crit_alarm[] = { | ||
945 | SENSOR_ATTR(temp1_crit_alarm, S_IRUGO, show_temp_crit_alarm, NULL, 0), | ||
946 | SENSOR_ATTR(temp2_crit_alarm, S_IRUGO, show_temp_crit_alarm, NULL, 1), | ||
947 | SENSOR_ATTR(temp3_crit_alarm, S_IRUGO, show_temp_crit_alarm, NULL, 2), | ||
948 | }; | ||
949 | |||
950 | #define TEMP_FAULT 0x40 /* open diode */ | ||
951 | static ssize_t show_temp_fault(struct device *dev, | ||
952 | struct device_attribute *devattr, char *buf) | ||
953 | { | ||
954 | struct pc87360_data *data = pc87360_update_device(dev); | ||
955 | unsigned nr = to_sensor_dev_attr(devattr)->index; | ||
956 | |||
957 | return sprintf(buf, "%u\n", !!(data->temp_status[nr] & TEMP_FAULT)); | ||
958 | } | ||
959 | static struct sensor_device_attribute temp_fault[] = { | ||
960 | SENSOR_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0), | ||
961 | SENSOR_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1), | ||
962 | SENSOR_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2), | ||
963 | }; | ||
964 | |||
793 | #define TEMP_UNIT_ATTRS(X) \ | 965 | #define TEMP_UNIT_ATTRS(X) \ |
794 | &temp_input[X].dev_attr.attr, \ | 966 | &temp_input[X].dev_attr.attr, \ |
795 | &temp_status[X].dev_attr.attr, \ | 967 | &temp_status[X].dev_attr.attr, \ |
796 | &temp_min[X].dev_attr.attr, \ | 968 | &temp_min[X].dev_attr.attr, \ |
797 | &temp_max[X].dev_attr.attr, \ | 969 | &temp_max[X].dev_attr.attr, \ |
798 | &temp_crit[X].dev_attr.attr | 970 | &temp_crit[X].dev_attr.attr, \ |
971 | &temp_min_alarm[X].dev_attr.attr, \ | ||
972 | &temp_max_alarm[X].dev_attr.attr, \ | ||
973 | &temp_crit_alarm[X].dev_attr.attr, \ | ||
974 | &temp_fault[X].dev_attr.attr | ||
799 | 975 | ||
800 | static struct attribute * pc8736x_temp_attr_array[] = { | 976 | static struct attribute * pc8736x_temp_attr_array[] = { |
801 | TEMP_UNIT_ATTRS(0), | 977 | TEMP_UNIT_ATTRS(0), |
@@ -809,8 +985,8 @@ static const struct attribute_group pc8736x_temp_group = { | |||
809 | .attrs = pc8736x_temp_attr_array, | 985 | .attrs = pc8736x_temp_attr_array, |
810 | }; | 986 | }; |
811 | 987 | ||
812 | static ssize_t show_name(struct device *dev, struct device_attribute | 988 | static ssize_t show_name(struct device *dev, |
813 | *devattr, char *buf) | 989 | struct device_attribute *devattr, char *buf) |
814 | { | 990 | { |
815 | struct pc87360_data *data = dev_get_drvdata(dev); | 991 | struct pc87360_data *data = dev_get_drvdata(dev); |
816 | return sprintf(buf, "%s\n", data->name); | 992 | return sprintf(buf, "%s\n", data->name); |
@@ -955,7 +1131,7 @@ static int __devinit pc87360_probe(struct platform_device *pdev) | |||
955 | mutex_init(&data->update_lock); | 1131 | mutex_init(&data->update_lock); |
956 | platform_set_drvdata(pdev, data); | 1132 | platform_set_drvdata(pdev, data); |
957 | 1133 | ||
958 | for (i = 0; i < 3; i++) { | 1134 | for (i = 0; i < LDNI_MAX; i++) { |
959 | if (((data->address[i] = extra_isa[i])) | 1135 | if (((data->address[i] = extra_isa[i])) |
960 | && !request_region(extra_isa[i], PC87360_EXTENT, | 1136 | && !request_region(extra_isa[i], PC87360_EXTENT, |
961 | pc87360_driver.driver.name)) { | 1137 | pc87360_driver.driver.name)) { |
@@ -1031,7 +1207,15 @@ static int __devinit pc87360_probe(struct platform_device *pdev) | |||
1031 | || (err = device_create_file(dev, | 1207 | || (err = device_create_file(dev, |
1032 | &temp_crit[i].dev_attr)) | 1208 | &temp_crit[i].dev_attr)) |
1033 | || (err = device_create_file(dev, | 1209 | || (err = device_create_file(dev, |
1034 | &temp_status[i].dev_attr))) | 1210 | &temp_status[i].dev_attr)) |
1211 | || (err = device_create_file(dev, | ||
1212 | &temp_min_alarm[i].dev_attr)) | ||
1213 | || (err = device_create_file(dev, | ||
1214 | &temp_max_alarm[i].dev_attr)) | ||
1215 | || (err = device_create_file(dev, | ||
1216 | &temp_crit_alarm[i].dev_attr)) | ||
1217 | || (err = device_create_file(dev, | ||
1218 | &temp_fault[i].dev_attr))) | ||
1035 | goto ERROR3; | 1219 | goto ERROR3; |
1036 | } | 1220 | } |
1037 | if ((err = device_create_file(dev, &dev_attr_alarms_temp))) | 1221 | if ((err = device_create_file(dev, &dev_attr_alarms_temp))) |
@@ -1131,6 +1315,16 @@ static void pc87360_write_value(struct pc87360_data *data, u8 ldi, u8 bank, | |||
1131 | mutex_unlock(&(data->lock)); | 1315 | mutex_unlock(&(data->lock)); |
1132 | } | 1316 | } |
1133 | 1317 | ||
1318 | /* (temp & vin) channel conversion status register flags (pdf sec.11.5.12) */ | ||
1319 | #define CHAN_CNVRTD 0x80 /* new data ready */ | ||
1320 | #define CHAN_ENA 0x01 /* enabled channel (temp or vin) */ | ||
1321 | #define CHAN_ALM_ENA 0x10 /* propagate to alarms-reg ?? (chk val!) */ | ||
1322 | #define CHAN_READY (CHAN_ENA|CHAN_CNVRTD) /* sample ready mask */ | ||
1323 | |||
1324 | #define TEMP_OTS_OE 0x20 /* OTS Output Enable */ | ||
1325 | #define VIN_RW1C_MASK (CHAN_READY|CHAN_ALM_MAX|CHAN_ALM_MIN) /* 0x87 */ | ||
1326 | #define TEMP_RW1C_MASK (VIN_RW1C_MASK|TEMP_ALM_CRIT|TEMP_FAULT) /* 0xCF */ | ||
1327 | |||
1134 | static void pc87360_init_device(struct platform_device *pdev, | 1328 | static void pc87360_init_device(struct platform_device *pdev, |
1135 | int use_thermistors) | 1329 | int use_thermistors) |
1136 | { | 1330 | { |
@@ -1152,11 +1346,12 @@ static void pc87360_init_device(struct platform_device *pdev, | |||
1152 | 1346 | ||
1153 | nr = data->innr < 11 ? data->innr : 11; | 1347 | nr = data->innr < 11 ? data->innr : 11; |
1154 | for (i = 0; i < nr; i++) { | 1348 | for (i = 0; i < nr; i++) { |
1349 | reg = pc87360_read_value(data, LD_IN, i, | ||
1350 | PC87365_REG_IN_STATUS); | ||
1351 | dev_dbg(&pdev->dev, "bios in%d status:0x%02x\n", i, reg); | ||
1155 | if (init >= init_in[i]) { | 1352 | if (init >= init_in[i]) { |
1156 | /* Forcibly enable voltage channel */ | 1353 | /* Forcibly enable voltage channel */ |
1157 | reg = pc87360_read_value(data, LD_IN, i, | 1354 | if (!(reg & CHAN_ENA)) { |
1158 | PC87365_REG_IN_STATUS); | ||
1159 | if (!(reg & 0x01)) { | ||
1160 | dev_dbg(&pdev->dev, "Forcibly " | 1355 | dev_dbg(&pdev->dev, "Forcibly " |
1161 | "enabling in%d\n", i); | 1356 | "enabling in%d\n", i); |
1162 | pc87360_write_value(data, LD_IN, i, | 1357 | pc87360_write_value(data, LD_IN, i, |
@@ -1168,19 +1363,24 @@ static void pc87360_init_device(struct platform_device *pdev, | |||
1168 | 1363 | ||
1169 | /* We can't blindly trust the Super-I/O space configuration bit, | 1364 | /* We can't blindly trust the Super-I/O space configuration bit, |
1170 | most BIOS won't set it properly */ | 1365 | most BIOS won't set it properly */ |
1366 | dev_dbg(&pdev->dev, "bios thermistors:%d\n", use_thermistors); | ||
1171 | for (i = 11; i < data->innr; i++) { | 1367 | for (i = 11; i < data->innr; i++) { |
1172 | reg = pc87360_read_value(data, LD_IN, i, | 1368 | reg = pc87360_read_value(data, LD_IN, i, |
1173 | PC87365_REG_TEMP_STATUS); | 1369 | PC87365_REG_TEMP_STATUS); |
1174 | use_thermistors = use_thermistors || (reg & 0x01); | 1370 | use_thermistors = use_thermistors || (reg & CHAN_ENA); |
1371 | /* thermistors are temp[4-6], measured on vin[11-14] */ | ||
1372 | dev_dbg(&pdev->dev, "bios temp%d_status:0x%02x\n", i-7, reg); | ||
1175 | } | 1373 | } |
1374 | dev_dbg(&pdev->dev, "using thermistors:%d\n", use_thermistors); | ||
1176 | 1375 | ||
1177 | i = use_thermistors ? 2 : 0; | 1376 | i = use_thermistors ? 2 : 0; |
1178 | for (; i < data->tempnr; i++) { | 1377 | for (; i < data->tempnr; i++) { |
1378 | reg = pc87360_read_value(data, LD_TEMP, i, | ||
1379 | PC87365_REG_TEMP_STATUS); | ||
1380 | dev_dbg(&pdev->dev, "bios temp%d_status:0x%02x\n", i+1, reg); | ||
1179 | if (init >= init_temp[i]) { | 1381 | if (init >= init_temp[i]) { |
1180 | /* Forcibly enable temperature channel */ | 1382 | /* Forcibly enable temperature channel */ |
1181 | reg = pc87360_read_value(data, LD_TEMP, i, | 1383 | if (!(reg & CHAN_ENA)) { |
1182 | PC87365_REG_TEMP_STATUS); | ||
1183 | if (!(reg & 0x01)) { | ||
1184 | dev_dbg(&pdev->dev, "Forcibly " | 1384 | dev_dbg(&pdev->dev, "Forcibly " |
1185 | "enabling temp%d\n", i+1); | 1385 | "enabling temp%d\n", i+1); |
1186 | pc87360_write_value(data, LD_TEMP, i, | 1386 | pc87360_write_value(data, LD_TEMP, i, |
@@ -1197,7 +1397,7 @@ static void pc87360_init_device(struct platform_device *pdev, | |||
1197 | diodes */ | 1397 | diodes */ |
1198 | reg = pc87360_read_value(data, LD_TEMP, | 1398 | reg = pc87360_read_value(data, LD_TEMP, |
1199 | (i-11)/2, PC87365_REG_TEMP_STATUS); | 1399 | (i-11)/2, PC87365_REG_TEMP_STATUS); |
1200 | if (reg & 0x01) { | 1400 | if (reg & CHAN_ENA) { |
1201 | dev_dbg(&pdev->dev, "Skipping " | 1401 | dev_dbg(&pdev->dev, "Skipping " |
1202 | "temp%d, pin already in use " | 1402 | "temp%d, pin already in use " |
1203 | "by temp%d\n", i-7, (i-11)/2); | 1403 | "by temp%d\n", i-7, (i-11)/2); |
@@ -1207,7 +1407,7 @@ static void pc87360_init_device(struct platform_device *pdev, | |||
1207 | /* Forcibly enable thermistor channel */ | 1407 | /* Forcibly enable thermistor channel */ |
1208 | reg = pc87360_read_value(data, LD_IN, i, | 1408 | reg = pc87360_read_value(data, LD_IN, i, |
1209 | PC87365_REG_IN_STATUS); | 1409 | PC87365_REG_IN_STATUS); |
1210 | if (!(reg & 0x01)) { | 1410 | if (!(reg & CHAN_ENA)) { |
1211 | dev_dbg(&pdev->dev, "Forcibly " | 1411 | dev_dbg(&pdev->dev, "Forcibly " |
1212 | "enabling temp%d\n", i-7); | 1412 | "enabling temp%d\n", i-7); |
1213 | pc87360_write_value(data, LD_IN, i, | 1413 | pc87360_write_value(data, LD_IN, i, |
@@ -1221,7 +1421,8 @@ static void pc87360_init_device(struct platform_device *pdev, | |||
1221 | if (data->innr) { | 1421 | if (data->innr) { |
1222 | reg = pc87360_read_value(data, LD_IN, NO_BANK, | 1422 | reg = pc87360_read_value(data, LD_IN, NO_BANK, |
1223 | PC87365_REG_IN_CONFIG); | 1423 | PC87365_REG_IN_CONFIG); |
1224 | if (reg & 0x01) { | 1424 | dev_dbg(&pdev->dev, "bios vin-cfg:0x%02x\n", reg); |
1425 | if (reg & CHAN_ENA) { | ||
1225 | dev_dbg(&pdev->dev, "Forcibly " | 1426 | dev_dbg(&pdev->dev, "Forcibly " |
1226 | "enabling monitoring (VLM)\n"); | 1427 | "enabling monitoring (VLM)\n"); |
1227 | pc87360_write_value(data, LD_IN, NO_BANK, | 1428 | pc87360_write_value(data, LD_IN, NO_BANK, |
@@ -1233,7 +1434,8 @@ static void pc87360_init_device(struct platform_device *pdev, | |||
1233 | if (data->tempnr) { | 1434 | if (data->tempnr) { |
1234 | reg = pc87360_read_value(data, LD_TEMP, NO_BANK, | 1435 | reg = pc87360_read_value(data, LD_TEMP, NO_BANK, |
1235 | PC87365_REG_TEMP_CONFIG); | 1436 | PC87365_REG_TEMP_CONFIG); |
1236 | if (reg & 0x01) { | 1437 | dev_dbg(&pdev->dev, "bios temp-cfg:0x%02x\n", reg); |
1438 | if (reg & CHAN_ENA) { | ||
1237 | dev_dbg(&pdev->dev, "Forcibly enabling " | 1439 | dev_dbg(&pdev->dev, "Forcibly enabling " |
1238 | "monitoring (TMS)\n"); | 1440 | "monitoring (TMS)\n"); |
1239 | pc87360_write_value(data, LD_TEMP, NO_BANK, | 1441 | pc87360_write_value(data, LD_TEMP, NO_BANK, |
@@ -1336,11 +1538,11 @@ static struct pc87360_data *pc87360_update_device(struct device *dev) | |||
1336 | pc87360_write_value(data, LD_IN, i, | 1538 | pc87360_write_value(data, LD_IN, i, |
1337 | PC87365_REG_IN_STATUS, | 1539 | PC87365_REG_IN_STATUS, |
1338 | data->in_status[i]); | 1540 | data->in_status[i]); |
1339 | if ((data->in_status[i] & 0x81) == 0x81) { | 1541 | if ((data->in_status[i] & CHAN_READY) == CHAN_READY) { |
1340 | data->in[i] = pc87360_read_value(data, LD_IN, | 1542 | data->in[i] = pc87360_read_value(data, LD_IN, |
1341 | i, PC87365_REG_IN); | 1543 | i, PC87365_REG_IN); |
1342 | } | 1544 | } |
1343 | if (data->in_status[i] & 0x01) { | 1545 | if (data->in_status[i] & CHAN_ENA) { |
1344 | data->in_min[i] = pc87360_read_value(data, | 1546 | data->in_min[i] = pc87360_read_value(data, |
1345 | LD_IN, i, | 1547 | LD_IN, i, |
1346 | PC87365_REG_IN_MIN); | 1548 | PC87365_REG_IN_MIN); |
@@ -1373,12 +1575,12 @@ static struct pc87360_data *pc87360_update_device(struct device *dev) | |||
1373 | pc87360_write_value(data, LD_TEMP, i, | 1575 | pc87360_write_value(data, LD_TEMP, i, |
1374 | PC87365_REG_TEMP_STATUS, | 1576 | PC87365_REG_TEMP_STATUS, |
1375 | data->temp_status[i]); | 1577 | data->temp_status[i]); |
1376 | if ((data->temp_status[i] & 0x81) == 0x81) { | 1578 | if ((data->temp_status[i] & CHAN_READY) == CHAN_READY) { |
1377 | data->temp[i] = pc87360_read_value(data, | 1579 | data->temp[i] = pc87360_read_value(data, |
1378 | LD_TEMP, i, | 1580 | LD_TEMP, i, |
1379 | PC87365_REG_TEMP); | 1581 | PC87365_REG_TEMP); |
1380 | } | 1582 | } |
1381 | if (data->temp_status[i] & 0x01) { | 1583 | if (data->temp_status[i] & CHAN_ENA) { |
1382 | data->temp_min[i] = pc87360_read_value(data, | 1584 | data->temp_min[i] = pc87360_read_value(data, |
1383 | LD_TEMP, i, | 1585 | LD_TEMP, i, |
1384 | PC87365_REG_TEMP_MIN); | 1586 | PC87365_REG_TEMP_MIN); |