hwmon: (it87) Fix thermal sensor type values
Subsystems (3)
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.
---
For users of lm-sensors <= 2.10.7, this change will cause the thermistors to be reported as "invalid". I've just fixed that in SVN. For this reason, I do not want to push the it87 driver fix into the kernel immediately. Let's wait for lm-sensors 2.10.8 to be released first. In practice, this means that the it87 driver will be fixed in kernel 2.6.28.
Documentation/hwmon/it87 | 4 ++-- drivers/hwmon/it87.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-)
Documentation/hwmon/it87 +2 -2
@@ -136,10 +136,10 @@ once-only alarms. The IT87xx only updates its values each 1.5 seconds; reading it more often will do no harm, but will return 'old' values. -To change sensor N to a thermistor, 'echo 2 > tempN_type' where N is 1, 2, +To change sensor N to a thermistor, 'echo 4 > tempN_type' where N is 1, 2, or 3. To change sensor N to a thermal diode, 'echo 3 > tempN_type'. Give 0 for unused sensor. Any other value is invalid. To configure this at -startup, consult lm_sensors's /etc/sensors.conf. (2 = thermistor; +startup, consult lm_sensors's /etc/sensors.conf. (4 = thermistor; 3 = thermal diode)
drivers/hwmon/it87.c +8 -3
@@ -477,7 +477,7 @@ static ssize_t show_sensor(struct deviceif (reg & (1 << nr))return sprintf (buf,"3\n" );/* thermal diode */ if (reg & (8 << nr)) -return sprintf (buf,"2\n" );/* thermistor */ +return sprintf (buf,"4\n" );/* thermistor */ return sprintf (buf,"0\n" );/* disabled */ } static ssize_t set_sensor(struct device *dev, struct device_attribute *attr,
@@ -493,10 +493,15 @@ static ssize_t set_sensor(struct device data->sensor &= ~(1 << nr); data->sensor &= ~(8 << nr); -/* 3 = thermal diode; 2 = thermistor; 0 = disabled */ +if (val =2 ) {/* backwards compatibility */ +dev_warn (dev,"Sensor type 2 is deprecated, please use 4 " +"instead\n" ); + val =4 ; + } +/* 3 = thermal diode; 4 = thermistor; 0 = disabled */ if (val =3 ) data->sensor |=1 << nr; -else if (val =2 ) +else if (val =4 ) data->sensor |=8 << nr;else if (val !=0 ) {mutex_unlock (&data->update_lock);
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hans de Goede
Acked-byQuoted 10 lines · Jean Delvare
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.
Looks good,
Quoted 49 lines
Signed-off-by Jean Delvare <[email protected]>---
For users of lm-sensors <= 2.10.7, this change will cause the thermistors to be reported as "invalid". I've just fixed that in SVN. For this reason, I do not want to push the it87 driver fix into the kernel immediately. Let's wait for lm-sensors 2.10.8 to be released first. In practice, this means that the it87 driver will be fixed in kernel 2.6.28.Documentation/hwmon/it87 | 4 ++-- drivers/hwmon/it87.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-)Documentation/hwmon/it87 +2
-2@@ -136,10 +136,10 @@ once-only alarms. The IT87xx only updates its values each 1.5 seconds; reading it more often will do no harm, but will return 'old' values. -To change sensor N to a thermistor, 'echo 2 > tempN_type' where N is 1, 2, +To change sensor N to a thermistor, 'echo 4 > tempN_type' where N is 1, 2, or 3. To change sensor N to a thermal diode, 'echo 3 > tempN_type'. Give 0 for unused sensor. Any other value is invalid. To configure this at -startup, consult lm_sensors's /etc/sensors.conf. (2 = thermistor; +startup, consult lm_sensors's /etc/sensors.conf. (4 = thermistor; 3 = thermal diode)drivers/hwmon/it87.c +4
-2@@ -477,7 +477,7 @@ static ssize_t show_sensor(struct deviceif (reg & (1 << nr))return sprintf (buf,"3\n" );/* thermal diode */ if (reg & (8 << nr)) -return sprintf (buf,"2\n" );/* thermistor */ +return sprintf (buf,"4\n" );/* thermistor */ return sprintf (buf,"0\n" );/* disabled */ } static ssize_t set_sensor(struct device *dev, struct device_attribute *attr,@@ -493,10 +493,15 @@ static ssize_t set_sensor(struct device data->sensor &= ~(1 << nr); data->sensor &= ~(8 << nr); -/* 3 = thermal diode; 2 = thermistor; 0 = disabled */ +if (val =2 ) {/* backwards compatibility */ +dev_warn (dev,"Sensor type 2 is deprecated, please use 4 " +"instead\n" );
drivers/hwmon/it87.c static ssize_t set_sensor(struct device · line 507
Quoted 10 lines
drivers/hwmon/it87.c +4
-1+ val =4 ; + } +/* 3 = thermal diode; 4 = thermistor; 0 = disabled */ if (val =3 ) data->sensor |=1 << nr; -else if (val =2 ) +else if (val =4 ) data->sensor |=8 << nr;else if (val !=0 ) {mutex_unlock (&data->update_lock);
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors