Commit 4ed4e043 authored by Jean Delvare's avatar Jean Delvare Committed by Sasha Levin

hwmon: (w83l768ng) Fix fan speed control range

The W83L786NG stores the fan speed on 4 bits while the sysfs interface
uses a 0-255 range. Thus the driver should scale the user input down
to map it to the device range, and scale up the value read from the
device before presenting it to the user. The reserved register nibble
should be left unchanged.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Cc: stable@vger.kernel.org
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>

(cherry picked from commit 33a7ab91)
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 336d6cf2
......@@ -486,6 +486,8 @@ store_pwm(struct device *dev, struct device_attribute *attr,
val = DIV_ROUND_CLOSEST(val, 0x11);
val = DIV_ROUND_CLOSEST(val, 0x11);
mutex_lock(&data->update_lock);
data->pwm[nr] = val * 0x11;
val |= w83l786ng_read_value(client, W83L786NG_REG_PWM[nr]) & 0xf0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment