Skip to content

Commit bf164c5

Browse files
Jean DelvareGuenter Roeck
authored andcommitted
hwmon: (w83627ehf) Properly report thermal diode sensors
The w83627ehf driver is improperly reporting thermal diode sensors as type 2, instead of 3. This caused "sensors" and possibly other monitoring tools to report these sensors as "transistor" instead of "thermal diode". Furthermore, diode subtype selection (CPU vs. external) is only supported by the original W83627EHF/EHG. All later models only support CPU diode type, and some (NCT6776F) don't even have the register in question so we should avoid reading from it. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: stable@kernel.org Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
1 parent 976d167 commit bf164c5

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/hwmon/w83627ehf.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,8 @@ static void w83627ehf_device_remove_files(struct device *dev)
17151715
}
17161716

17171717
/* Get the monitoring functions started */
1718-
static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data)
1718+
static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data,
1719+
enum kinds kind)
17191720
{
17201721
int i;
17211722
u8 tmp, diode;
@@ -1746,10 +1747,16 @@ static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data)
17461747
w83627ehf_write_value(data, W83627EHF_REG_VBAT, tmp | 0x01);
17471748

17481749
/* Get thermal sensor types */
1749-
diode = w83627ehf_read_value(data, W83627EHF_REG_DIODE);
1750+
switch (kind) {
1751+
case w83627ehf:
1752+
diode = w83627ehf_read_value(data, W83627EHF_REG_DIODE);
1753+
break;
1754+
default:
1755+
diode = 0x70;
1756+
}
17501757
for (i = 0; i < 3; i++) {
17511758
if ((tmp & (0x02 << i)))
1752-
data->temp_type[i] = (diode & (0x10 << i)) ? 1 : 2;
1759+
data->temp_type[i] = (diode & (0x10 << i)) ? 1 : 3;
17531760
else
17541761
data->temp_type[i] = 4; /* thermistor */
17551762
}
@@ -2016,7 +2023,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
20162023
}
20172024

20182025
/* Initialize the chip */
2019-
w83627ehf_init_device(data);
2026+
w83627ehf_init_device(data, sio_data->kind);
20202027

20212028
data->vrm = vid_which_vrm();
20222029
superio_enter(sio_data->sioreg);

0 commit comments

Comments
 (0)