aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2013-01-11 00:16:47 -0500
committerGuenter Roeck <linux@roeck-us.net>2013-02-06 12:57:57 -0500
commit91bba688016be0ba87ecb9d80d6490c2ebc63b0d (patch)
treef16bbaa5947f88b590f73ff3fb0719610637c475 /drivers/hwmon
parentb06367070de3d9f50e4f8f82b92e77ba9a8ebf8f (diff)
hwmon: (lm73) Fix lower and upper temperature limits
While the LM73 is only specified for temperatures from -40 to +150 degrees C, its power-up minimum and maximum temperature limits are -256 and +255.75 degrees C. For better consistency and to avoid confusion, clamp limits to the power-up limits and not to -40 / +150 degrees C. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/lm73.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c
index 5166a8e3a061..dad83fea807d 100644
--- a/drivers/hwmon/lm73.c
+++ b/drivers/hwmon/lm73.c
@@ -36,8 +36,8 @@ static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4c,
36 36
37#define LM73_ID 0x9001 /* 0x0190, byte-swapped */ 37#define LM73_ID 0x9001 /* 0x0190, byte-swapped */
38#define DRVNAME "lm73" 38#define DRVNAME "lm73"
39#define LM73_TEMP_MIN (-40) 39#define LM73_TEMP_MIN (-256000 / 250)
40#define LM73_TEMP_MAX 150 40#define LM73_TEMP_MAX (255750 / 250)
41 41
42/*-----------------------------------------------------------------------*/ 42/*-----------------------------------------------------------------------*/
43 43
@@ -56,8 +56,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
56 return status; 56 return status;
57 57
58 /* Write value */ 58 /* Write value */
59 value = (short) clamp_val(temp / 250, LM73_TEMP_MIN * 4, 59 value = clamp_val(temp / 250, LM73_TEMP_MIN, LM73_TEMP_MAX) << 5;
60 LM73_TEMP_MAX * 4) << 5;
61 err = i2c_smbus_write_word_swapped(client, attr->index, value); 60 err = i2c_smbus_write_word_swapped(client, attr->index, value);
62 return (err < 0) ? err : count; 61 return (err < 0) ? err : count;
63} 62}