diff options
Diffstat (limited to 'drivers/hwmon/lm90.c')
-rw-r--r-- | drivers/hwmon/lm90.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 3edeebc0b835..6242e72a82c1 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
@@ -461,6 +461,8 @@ static ssize_t show_temphyst(struct device *dev, struct device_attribute *devatt | |||
461 | 461 | ||
462 | if (data->kind == adt7461) | 462 | if (data->kind == adt7461) |
463 | temp = temp_from_u8_adt7461(data, data->temp8[attr->index]); | 463 | temp = temp_from_u8_adt7461(data, data->temp8[attr->index]); |
464 | else if (data->kind == max6646) | ||
465 | temp = temp_from_u8(data->temp8[attr->index]); | ||
464 | else | 466 | else |
465 | temp = temp_from_s8(data->temp8[attr->index]); | 467 | temp = temp_from_s8(data->temp8[attr->index]); |
466 | 468 | ||
@@ -473,12 +475,19 @@ static ssize_t set_temphyst(struct device *dev, struct device_attribute *dummy, | |||
473 | struct i2c_client *client = to_i2c_client(dev); | 475 | struct i2c_client *client = to_i2c_client(dev); |
474 | struct lm90_data *data = i2c_get_clientdata(client); | 476 | struct lm90_data *data = i2c_get_clientdata(client); |
475 | long val = simple_strtol(buf, NULL, 10); | 477 | long val = simple_strtol(buf, NULL, 10); |
476 | long hyst; | 478 | int temp; |
477 | 479 | ||
478 | mutex_lock(&data->update_lock); | 480 | mutex_lock(&data->update_lock); |
479 | hyst = temp_from_s8(data->temp8[2]) - val; | 481 | if (data->kind == adt7461) |
482 | temp = temp_from_u8_adt7461(data, data->temp8[2]); | ||
483 | else if (data->kind == max6646) | ||
484 | temp = temp_from_u8(data->temp8[2]); | ||
485 | else | ||
486 | temp = temp_from_s8(data->temp8[2]); | ||
487 | |||
488 | data->temp_hyst = hyst_to_reg(temp - val); | ||
480 | i2c_smbus_write_byte_data(client, LM90_REG_W_TCRIT_HYST, | 489 | i2c_smbus_write_byte_data(client, LM90_REG_W_TCRIT_HYST, |
481 | hyst_to_reg(hyst)); | 490 | data->temp_hyst); |
482 | mutex_unlock(&data->update_lock); | 491 | mutex_unlock(&data->update_lock); |
483 | return count; | 492 | return count; |
484 | } | 493 | } |