diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-10-17 11:51:16 -0400 |
---|---|---|
committer | Jean Delvare <khali@mahadeva.delvare> | 2008-10-17 11:51:16 -0400 |
commit | 4ed1077953f531b3fef4af4b4ade48a828c48869 (patch) | |
tree | aa7e98269aba19ec851521ad2127e87c615fff36 | |
parent | 0c6e97317102a8f480bdfb418f19fe989ad1c047 (diff) |
hwmon: (it87) Fix thermal sensor type values
The it87 driver doesn't follow the standard sensor type values as
documented in Documentation/hwmon/sysfs-interface. It uses value 2 for
thermistors instead of value 4. This causes "sensors" to tell the user
that the chip is setup for a transistor while it is actually setup for
a thermistor.
Using value 4 for thermistors solves the problem. For compatibility
reasons, we still accept value 2 but emit a warning message so that
users update their configuration files.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | Documentation/hwmon/it87 | 4 | ||||
-rw-r--r-- | drivers/hwmon/it87.c | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/Documentation/hwmon/it87 b/Documentation/hwmon/it87 index 3496b7020e7c..042c0415140b 100644 --- a/Documentation/hwmon/it87 +++ b/Documentation/hwmon/it87 | |||
@@ -136,10 +136,10 @@ once-only alarms. | |||
136 | The IT87xx only updates its values each 1.5 seconds; reading it more often | 136 | The IT87xx only updates its values each 1.5 seconds; reading it more often |
137 | will do no harm, but will return 'old' values. | 137 | will do no harm, but will return 'old' values. |
138 | 138 | ||
139 | To change sensor N to a thermistor, 'echo 2 > tempN_type' where N is 1, 2, | 139 | To change sensor N to a thermistor, 'echo 4 > tempN_type' where N is 1, 2, |
140 | or 3. To change sensor N to a thermal diode, 'echo 3 > tempN_type'. | 140 | or 3. To change sensor N to a thermal diode, 'echo 3 > tempN_type'. |
141 | Give 0 for unused sensor. Any other value is invalid. To configure this at | 141 | Give 0 for unused sensor. Any other value is invalid. To configure this at |
142 | startup, consult lm_sensors's /etc/sensors.conf. (2 = thermistor; | 142 | startup, consult lm_sensors's /etc/sensors.conf. (4 = thermistor; |
143 | 3 = thermal diode) | 143 | 3 = thermal diode) |
144 | 144 | ||
145 | 145 | ||
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index d793cc011990..b74c95735f95 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -477,7 +477,7 @@ static ssize_t show_sensor(struct device *dev, struct device_attribute *attr, | |||
477 | if (reg & (1 << nr)) | 477 | if (reg & (1 << nr)) |
478 | return sprintf(buf, "3\n"); /* thermal diode */ | 478 | return sprintf(buf, "3\n"); /* thermal diode */ |
479 | if (reg & (8 << nr)) | 479 | if (reg & (8 << nr)) |
480 | return sprintf(buf, "2\n"); /* thermistor */ | 480 | return sprintf(buf, "4\n"); /* thermistor */ |
481 | return sprintf(buf, "0\n"); /* disabled */ | 481 | return sprintf(buf, "0\n"); /* disabled */ |
482 | } | 482 | } |
483 | static ssize_t set_sensor(struct device *dev, struct device_attribute *attr, | 483 | static ssize_t set_sensor(struct device *dev, struct device_attribute *attr, |
@@ -493,10 +493,15 @@ static ssize_t set_sensor(struct device *dev, struct device_attribute *attr, | |||
493 | 493 | ||
494 | data->sensor &= ~(1 << nr); | 494 | data->sensor &= ~(1 << nr); |
495 | data->sensor &= ~(8 << nr); | 495 | data->sensor &= ~(8 << nr); |
496 | /* 3 = thermal diode; 2 = thermistor; 0 = disabled */ | 496 | if (val == 2) { /* backwards compatibility */ |
497 | dev_warn(dev, "Sensor type 2 is deprecated, please use 4 " | ||
498 | "instead\n"); | ||
499 | val = 4; | ||
500 | } | ||
501 | /* 3 = thermal diode; 4 = thermistor; 0 = disabled */ | ||
497 | if (val == 3) | 502 | if (val == 3) |
498 | data->sensor |= 1 << nr; | 503 | data->sensor |= 1 << nr; |
499 | else if (val == 2) | 504 | else if (val == 4) |
500 | data->sensor |= 8 << nr; | 505 | data->sensor |= 8 << nr; |
501 | else if (val != 0) { | 506 | else if (val != 0) { |
502 | mutex_unlock(&data->update_lock); | 507 | mutex_unlock(&data->update_lock); |