aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <guenter.roeck@ericsson.com>2012-01-16 16:51:45 -0500
committerJean Delvare <khali@endymion.delvare>2012-01-16 16:51:45 -0500
commit786375f7298dcc78a7cf44be9e15fb79bddc6f25 (patch)
tree1fa888b117ab8e6a9012252599f231620c62aa95 /drivers/hwmon
parent662bda28328b983f842f008a81a5fd4e6de6c5fe (diff)
hwmon: (lm63) Add support for external temperature offset register
LM63 and compatibles support a temperature offset register for the external temperature sensor. Add support for it. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/lm63.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c
index e02d7f01b01b..313aee18be1d 100644
--- a/drivers/hwmon/lm63.c
+++ b/drivers/hwmon/lm63.c
@@ -180,9 +180,10 @@ struct lm63_data {
180 s8 temp8[3]; /* 0: local input 180 s8 temp8[3]; /* 0: local input
181 1: local high limit 181 1: local high limit
182 2: remote critical limit */ 182 2: remote critical limit */
183 s16 temp11[3]; /* 0: remote input 183 s16 temp11[4]; /* 0: remote input
184 1: remote low limit 184 1: remote low limit
185 2: remote high limit */ 185 2: remote high limit
186 3: remote offset */
186 u8 temp2_crit_hyst; 187 u8 temp2_crit_hyst;
187 u8 alarms; 188 u8 alarms;
188}; 189};
@@ -318,11 +319,13 @@ static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr,
318static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr, 319static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr,
319 const char *buf, size_t count) 320 const char *buf, size_t count)
320{ 321{
321 static const u8 reg[4] = { 322 static const u8 reg[6] = {
322 LM63_REG_REMOTE_LOW_MSB, 323 LM63_REG_REMOTE_LOW_MSB,
323 LM63_REG_REMOTE_LOW_LSB, 324 LM63_REG_REMOTE_LOW_LSB,
324 LM63_REG_REMOTE_HIGH_MSB, 325 LM63_REG_REMOTE_HIGH_MSB,
325 LM63_REG_REMOTE_HIGH_LSB, 326 LM63_REG_REMOTE_HIGH_LSB,
327 LM63_REG_REMOTE_OFFSET_MSB,
328 LM63_REG_REMOTE_OFFSET_LSB,
326 }; 329 };
327 330
328 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 331 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
@@ -418,6 +421,8 @@ static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp11,
418 set_temp11, 1); 421 set_temp11, 1);
419static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp11, 422static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp11,
420 set_temp11, 2); 423 set_temp11, 2);
424static SENSOR_DEVICE_ATTR(temp2_offset, S_IWUSR | S_IRUGO, show_temp11,
425 set_temp11, 3);
421/* 426/*
422 * On LM63, temp2_crit can be set only once, which should be job 427 * On LM63, temp2_crit can be set only once, which should be job
423 * of the bootloader. 428 * of the bootloader.
@@ -445,6 +450,7 @@ static struct attribute *lm63_attributes[] = {
445 &sensor_dev_attr_temp2_min.dev_attr.attr, 450 &sensor_dev_attr_temp2_min.dev_attr.attr,
446 &sensor_dev_attr_temp1_max.dev_attr.attr, 451 &sensor_dev_attr_temp1_max.dev_attr.attr,
447 &sensor_dev_attr_temp2_max.dev_attr.attr, 452 &sensor_dev_attr_temp2_max.dev_attr.attr,
453 &sensor_dev_attr_temp2_offset.dev_attr.attr,
448 &sensor_dev_attr_temp2_crit.dev_attr.attr, 454 &sensor_dev_attr_temp2_crit.dev_attr.attr,
449 &dev_attr_temp2_crit_hyst.attr, 455 &dev_attr_temp2_crit_hyst.attr,
450 456
@@ -668,6 +674,10 @@ static struct lm63_data *lm63_update_device(struct device *dev)
668 LM63_REG_REMOTE_HIGH_MSB) << 8) 674 LM63_REG_REMOTE_HIGH_MSB) << 8)
669 | i2c_smbus_read_byte_data(client, 675 | i2c_smbus_read_byte_data(client,
670 LM63_REG_REMOTE_HIGH_LSB); 676 LM63_REG_REMOTE_HIGH_LSB);
677 data->temp11[3] = (i2c_smbus_read_byte_data(client,
678 LM63_REG_REMOTE_OFFSET_MSB) << 8)
679 | i2c_smbus_read_byte_data(client,
680 LM63_REG_REMOTE_OFFSET_LSB);
671 data->temp8[2] = i2c_smbus_read_byte_data(client, 681 data->temp8[2] = i2c_smbus_read_byte_data(client,
672 LM63_REG_REMOTE_TCRIT); 682 LM63_REG_REMOTE_TCRIT);
673 data->temp2_crit_hyst = i2c_smbus_read_byte_data(client, 683 data->temp2_crit_hyst = i2c_smbus_read_byte_data(client,