summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorArmin Wolf <W_Armin@gmx.de>2023-01-05 23:51:07 +0100
committerGuenter Roeck <linux@roeck-us.net>2023-02-03 07:30:10 -0800
commitc184f377a4cc9078d42563ef0fe3de6ea574b0cf (patch)
treedff70d7e4d67f0bfb4f1788f698694adc4de4b53 /drivers/hwmon
parent1c5759d8ce054961b454af69568a41e7e3210ee1 (diff)
downloadlinux-stable-c184f377a4cc9078d42563ef0fe3de6ea574b0cf.tar.gz
linux-stable-c184f377a4cc9078d42563ef0fe3de6ea574b0cf.tar.bz2
linux-stable-c184f377a4cc9078d42563ef0fe3de6ea574b0cf.zip
hwmon: (ftsteutates) Add support for fanX_fault attributes
The driver knows internally when a fan is not connected, but does not export this knowledge to userspace. Use the standard fanX_fault attributes to notify userspace if a fan is not connected. Tested on a Fujitsu DS3401-B1. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20230105225107.58308-4-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/ftsteutates.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/hwmon/ftsteutates.c b/drivers/hwmon/ftsteutates.c
index 0d8ab94250a9..25afd9167a34 100644
--- a/drivers/hwmon/ftsteutates.c
+++ b/drivers/hwmon/ftsteutates.c
@@ -356,6 +356,7 @@ static umode_t fts_is_visible(const void *devdata, enum hwmon_sensor_types type,
case hwmon_fan:
switch (attr) {
case hwmon_fan_input:
+ case hwmon_fan_fault:
return 0444;
case hwmon_fan_alarm:
return 0644;
@@ -412,6 +413,10 @@ static int fts_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
*val = !!(data->fan_alarm & BIT(channel));
return 0;
+ case hwmon_fan_fault:
+ *val = !(data->fan_present & BIT(channel));
+
+ return 0;
default:
break;
}
@@ -536,14 +541,14 @@ static const struct hwmon_channel_info *fts_info[] = {
HWMON_T_INPUT | HWMON_T_ALARM | HWMON_T_FAULT
),
HWMON_CHANNEL_INFO(fan,
- HWMON_F_INPUT | HWMON_F_ALARM,
- HWMON_F_INPUT | HWMON_F_ALARM,
- HWMON_F_INPUT | HWMON_F_ALARM,
- HWMON_F_INPUT | HWMON_F_ALARM,
- HWMON_F_INPUT | HWMON_F_ALARM,
- HWMON_F_INPUT | HWMON_F_ALARM,
- HWMON_F_INPUT | HWMON_F_ALARM,
- HWMON_F_INPUT | HWMON_F_ALARM
+ HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT,
+ HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT,
+ HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT,
+ HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT,
+ HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT,
+ HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT,
+ HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT,
+ HWMON_F_INPUT | HWMON_F_ALARM | HWMON_F_FAULT
),
HWMON_CHANNEL_INFO(pwm,
HWMON_PWM_AUTO_CHANNELS_TEMP,