Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: add fault attribute for voltage channels

Sometimes a voltage channel might have an hard failure (eg: a shorted
MOSFET). Hence, add a fault attribute to report such failures.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240129-b4-ltc4282-support-v4-2-fe75798164cc@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Nuno Sa and committed by
Guenter Roeck
35c1bfb9 d07c41eb

+12
+9
Documentation/ABI/testing/sysfs-class-hwmon
··· 149 149 150 150 RW 151 151 152 + What: /sys/class/hwmon/hwmonX/inY_fault 153 + Description: 154 + Reports a voltage hard failure (eg: shorted component) 155 + 156 + - 1: Failed 157 + - 0: Ok 158 + 159 + RO 160 + 152 161 What: /sys/class/hwmon/hwmonX/cpuY_vid 153 162 Description: 154 163 CPU core reference voltage.
+1
drivers/hwmon/hwmon.c
··· 510 510 [hwmon_in_rated_min] = "in%d_rated_min", 511 511 [hwmon_in_rated_max] = "in%d_rated_max", 512 512 [hwmon_in_beep] = "in%d_beep", 513 + [hwmon_in_fault] = "in%d_fault", 513 514 }; 514 515 515 516 static const char * const hwmon_curr_attr_templates[] = {
+2
include/linux/hwmon.h
··· 141 141 hwmon_in_rated_min, 142 142 hwmon_in_rated_max, 143 143 hwmon_in_beep, 144 + hwmon_in_fault, 144 145 }; 145 146 146 147 #define HWMON_I_ENABLE BIT(hwmon_in_enable) ··· 163 162 #define HWMON_I_RATED_MIN BIT(hwmon_in_rated_min) 164 163 #define HWMON_I_RATED_MAX BIT(hwmon_in_rated_max) 165 164 #define HWMON_I_BEEP BIT(hwmon_in_beep) 165 + #define HWMON_I_FAULT BIT(hwmon_in_fault) 166 166 167 167 enum hwmon_curr_attributes { 168 168 hwmon_curr_enable,