aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/it87.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/it87.c')
-rw-r--r--drivers/hwmon/it87.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 6c41e25e670b..a61f5d00f10a 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -522,8 +522,15 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
522 struct i2c_client *client = to_i2c_client(dev); 522 struct i2c_client *client = to_i2c_client(dev);
523 struct it87_data *data = i2c_get_clientdata(client); 523 struct it87_data *data = i2c_get_clientdata(client);
524 int val = simple_strtol(buf, NULL, 10); 524 int val = simple_strtol(buf, NULL, 10);
525 u8 reg = it87_read_value(client, IT87_REG_FAN_DIV);
525 526
526 down(&data->update_lock); 527 down(&data->update_lock);
528 switch (nr) {
529 case 0: data->fan_div[nr] = reg & 0x07; break;
530 case 1: data->fan_div[nr] = (reg >> 3) & 0x07; break;
531 case 2: data->fan_div[nr] = (reg & 0x40) ? 3 : 1; break;
532 }
533
527 data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); 534 data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
528 it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]); 535 it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]);
529 up(&data->update_lock); 536 up(&data->update_lock);