diff options
Diffstat (limited to 'drivers/hwmon/w83l786ng.c')
-rw-r--r-- | drivers/hwmon/w83l786ng.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c index 03c65e69ebd..b9c0a7f7750 100644 --- a/drivers/hwmon/w83l786ng.c +++ b/drivers/hwmon/w83l786ng.c @@ -447,8 +447,11 @@ store_pwm(struct device *dev, struct device_attribute *attr, struct w83l786ng_data *data = i2c_get_clientdata(client); u32 val = SENSORS_LIMIT(simple_strtoul(buf, NULL, 10), 0, 255); + val = DIV_ROUND_CLOSEST(val, 0x11); + mutex_lock(&data->update_lock); - data->pwm[nr] = val; + data->pwm[nr] = val * 0x11; + val |= w83l786ng_read_value(client, W83L786NG_REG_PWM[nr]) & 0xf0; w83l786ng_write_value(client, W83L786NG_REG_PWM[nr], val); mutex_unlock(&data->update_lock); return count; @@ -741,8 +744,9 @@ static struct w83l786ng_data *w83l786ng_update_device(struct device *dev) ? 0 : 1; data->pwm_enable[i] = ((pwmcfg >> W83L786NG_PWM_ENABLE_SHIFT[i]) & 3) + 1; - data->pwm[i] = w83l786ng_read_value(client, - W83L786NG_REG_PWM[i]); + data->pwm[i] = + (w83l786ng_read_value(client, W83L786NG_REG_PWM[i]) + & 0x0f) * 0x11; } |