Update pwm cached control registers before writing pwm enable

If pwmX_enable is written prior to displaying any attributes,
t87_update_pwm_ctrl() is never called, and the cached pwm registers
are never read before written. This results in bad values written
into various registers, and can result in operational failures.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Guenter Roeck
2017-09-03 13:58:47 -07:00
parent b9deb7cb41
commit 21b0f8cf1e

1
it87.c
View File

@@ -1623,6 +1623,7 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr,
}
mutex_lock(&data->update_lock);
it87_update_pwm_ctrl(data, nr);
if (val == 0) {
if (nr < 3 && has_fanctl_onoff(data)) {