Commit 8b380025 authored by Xing Tong Wu's avatar Xing Tong Wu Committed by Guenter Roeck

hwmon: (nct6775) Fix fan speed set failure in automatic mode

Setting the fan speed is only valid in manual mode; it is not possible
to set the fan's speed in automatic mode.
Return error when attempting to set the fan speed in automatic mode.
Signed-off-by: default avatarXing Tong Wu <xingtong.wu@siemens.com>
Link: https://lore.kernel.org/r/20231121081604.2499-3-xingtong_wu@163.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent ff629afe
...@@ -2553,6 +2553,13 @@ store_pwm(struct device *dev, struct device_attribute *attr, const char *buf, ...@@ -2553,6 +2553,13 @@ store_pwm(struct device *dev, struct device_attribute *attr, const char *buf,
int err; int err;
u16 reg; u16 reg;
/*
* The fan control mode should be set to manual if the user wants to adjust
* the fan speed. Otherwise, it will fail to set.
*/
if (index == 0 && data->pwm_enable[nr] > manual)
return -EBUSY;
err = kstrtoul(buf, 10, &val); err = kstrtoul(buf, 10, &val);
if (err < 0) if (err < 0)
return err; return err;
......
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