[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210304105830.507176-4-kubernat@cesnet.cz>
Date: Thu, 4 Mar 2021 11:58:27 +0100
From: Václav Kubernát <kubernat@...net.cz>
To: unlisted-recipients:; (no To-header on input)
Cc: Václav Kubernát <kubernat@...net.cz>,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Jonathan Corbet <corbet@....net>, linux-hwmon@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 4/7] hwmon: (max31790) Show 0 RPM/fault when input disabled
When fan speed input is disabled, it makes no sense to show values in
fan*_input and fan*_fault.
Signed-off-by: Václav Kubernát <kubernat@...net.cz>
---
drivers/hwmon/max31790.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/hwmon/max31790.c b/drivers/hwmon/max31790.c
index 74a81e5e3383..fde08c95d942 100644
--- a/drivers/hwmon/max31790.c
+++ b/drivers/hwmon/max31790.c
@@ -219,6 +219,11 @@ static int max31790_read_fan(struct device *dev, u32 attr, int channel,
switch (attr) {
case hwmon_fan_input:
+ if (!(data->fan_config[channel] &
+ MAX31790_FAN_CFG_TACH_INPUT_EN)) {
+ *val = 0;
+ return 0;
+ }
sr = get_tach_period(data->fan_dynamics[channel]);
rpm = RPM_FROM_REG(data->tach[channel],
sr,
@@ -233,6 +238,11 @@ static int max31790_read_fan(struct device *dev, u32 attr, int channel,
*val = rpm;
return 0;
case hwmon_fan_fault:
+ if (!(data->fan_config[channel] &
+ MAX31790_FAN_CFG_TACH_INPUT_EN)) {
+ *val = 0;
+ return 0;
+ }
*val = !!(data->fault_status & (1 << channel));
return 0;
case hwmon_fan_enable:
--
2.30.1
Powered by blists - more mailing lists