diff options
Diffstat (limited to 'drivers/hwmon/w83627ehf.c')
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index f2b377c56a3a..36d7f270b14d 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -390,7 +390,7 @@ temp_from_reg(u16 reg, s16 regval) | |||
390 | { | 390 | { |
391 | if (is_word_sized(reg)) | 391 | if (is_word_sized(reg)) |
392 | return LM75_TEMP_FROM_REG(regval); | 392 | return LM75_TEMP_FROM_REG(regval); |
393 | return regval * 1000; | 393 | return ((s8)regval) * 1000; |
394 | } | 394 | } |
395 | 395 | ||
396 | static inline u16 | 396 | static inline u16 |
@@ -398,7 +398,8 @@ temp_to_reg(u16 reg, long temp) | |||
398 | { | 398 | { |
399 | if (is_word_sized(reg)) | 399 | if (is_word_sized(reg)) |
400 | return LM75_TEMP_TO_REG(temp); | 400 | return LM75_TEMP_TO_REG(temp); |
401 | return DIV_ROUND_CLOSEST(SENSORS_LIMIT(temp, -127000, 128000), 1000); | 401 | return (s8)DIV_ROUND_CLOSEST(SENSORS_LIMIT(temp, -127000, 128000), |
402 | 1000); | ||
402 | } | 403 | } |
403 | 404 | ||
404 | /* Some of analog inputs have internal scaling (2x), 8mV is ADC LSB */ | 405 | /* Some of analog inputs have internal scaling (2x), 8mV is ADC LSB */ |
@@ -1715,7 +1716,8 @@ static void w83627ehf_device_remove_files(struct device *dev) | |||
1715 | } | 1716 | } |
1716 | 1717 | ||
1717 | /* Get the monitoring functions started */ | 1718 | /* Get the monitoring functions started */ |
1718 | static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data) | 1719 | static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data, |
1720 | enum kinds kind) | ||
1719 | { | 1721 | { |
1720 | int i; | 1722 | int i; |
1721 | u8 tmp, diode; | 1723 | u8 tmp, diode; |
@@ -1746,10 +1748,16 @@ static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data) | |||
1746 | w83627ehf_write_value(data, W83627EHF_REG_VBAT, tmp | 0x01); | 1748 | w83627ehf_write_value(data, W83627EHF_REG_VBAT, tmp | 0x01); |
1747 | 1749 | ||
1748 | /* Get thermal sensor types */ | 1750 | /* Get thermal sensor types */ |
1749 | diode = w83627ehf_read_value(data, W83627EHF_REG_DIODE); | 1751 | switch (kind) { |
1752 | case w83627ehf: | ||
1753 | diode = w83627ehf_read_value(data, W83627EHF_REG_DIODE); | ||
1754 | break; | ||
1755 | default: | ||
1756 | diode = 0x70; | ||
1757 | } | ||
1750 | for (i = 0; i < 3; i++) { | 1758 | for (i = 0; i < 3; i++) { |
1751 | if ((tmp & (0x02 << i))) | 1759 | if ((tmp & (0x02 << i))) |
1752 | data->temp_type[i] = (diode & (0x10 << i)) ? 1 : 2; | 1760 | data->temp_type[i] = (diode & (0x10 << i)) ? 1 : 3; |
1753 | else | 1761 | else |
1754 | data->temp_type[i] = 4; /* thermistor */ | 1762 | data->temp_type[i] = 4; /* thermistor */ |
1755 | } | 1763 | } |
@@ -2016,7 +2024,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | |||
2016 | } | 2024 | } |
2017 | 2025 | ||
2018 | /* Initialize the chip */ | 2026 | /* Initialize the chip */ |
2019 | w83627ehf_init_device(data); | 2027 | w83627ehf_init_device(data, sio_data->kind); |
2020 | 2028 | ||
2021 | data->vrm = vid_which_vrm(); | 2029 | data->vrm = vid_which_vrm(); |
2022 | superio_enter(sio_data->sioreg); | 2030 | superio_enter(sio_data->sioreg); |