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>

authored by Jean Delvare and committed by Guenter Roeck bf164c58 976d1676

Changed files
+11 -4
drivers
hwmon
+11 -4
drivers/hwmon/w83627ehf.c
··· 1715 1715 } 1716 1716 1717 1717 /* 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) 1719 1720 { 1720 1721 int i; 1721 1722 u8 tmp, diode; ··· 1747 1746 w83627ehf_write_value(data, W83627EHF_REG_VBAT, tmp | 0x01); 1748 1747 1749 1748 /* Get thermal sensor types */ 1750 - diode = w83627ehf_read_value(data, W83627EHF_REG_DIODE); 1749 + switch (kind) { 1750 + case w83627ehf: 1751 + diode = w83627ehf_read_value(data, W83627EHF_REG_DIODE); 1752 + break; 1753 + default: 1754 + diode = 0x70; 1755 + } 1751 1756 for (i = 0; i < 3; i++) { 1752 1757 if ((tmp & (0x02 << i))) 1753 - data->temp_type[i] = (diode & (0x10 << i)) ? 1 : 2; 1758 + data->temp_type[i] = (diode & (0x10 << i)) ? 1 : 3; 1754 1759 else 1755 1760 data->temp_type[i] = 4; /* thermistor */ 1756 1761 } ··· 2023 2016 } 2024 2017 2025 2018 /* Initialize the chip */ 2026 - w83627ehf_init_device(data); 2019 + w83627ehf_init_device(data, sio_data->kind); 2027 2020 2028 2021 data->vrm = vid_which_vrm(); 2029 2022 superio_enter(sio_data->sioreg);