[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231120081542.3174-3-xingtong_wu@163.com>
Date: Mon, 20 Nov 2023 16:15:42 +0800
From: Xing Tong Wu <xingtong_wu@....com>
To: Guenter Roeck <linux@...ck-us.net>,
Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: xingtong.wu@...mens.com, tobias.schaffner@...mens.com,
gerd.haeussler.ext@...mens.com
Subject: [PATCH v2 2/2] hwmon: (nct6775) Fix fan speed set failure in automatic mode
From: Xing Tong Wu <xingtong.wu@...mens.com>
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: Xing Tong Wu <xingtong.wu@...mens.com>
---
drivers/hwmon/nct6775-core.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c
index c24b2c312911..38c2e5b7cfe9 100644
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -2556,6 +2556,13 @@ store_pwm(struct device *dev, struct device_attribute *attr, const char *buf,
int err;
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);
if (err < 0)
return err;
--
2.25.1
Powered by blists - more mailing lists