Skip to content

Commit 35c1bfb

Browse files
nunojsagroeck
authored andcommitted
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>
1 parent d07c41e commit 35c1bfb

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Documentation/ABI/testing/sysfs-class-hwmon

+9
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@ Description:
149149

150150
RW
151151

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+
152161
What: /sys/class/hwmon/hwmonX/cpuY_vid
153162
Description:
154163
CPU core reference voltage.

drivers/hwmon/hwmon.c

+1
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ static const char * const hwmon_in_attr_templates[] = {
510510
[hwmon_in_rated_min] = "in%d_rated_min",
511511
[hwmon_in_rated_max] = "in%d_rated_max",
512512
[hwmon_in_beep] = "in%d_beep",
513+
[hwmon_in_fault] = "in%d_fault",
513514
};
514515

515516
static const char * const hwmon_curr_attr_templates[] = {

include/linux/hwmon.h

+2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ enum hwmon_in_attributes {
141141
hwmon_in_rated_min,
142142
hwmon_in_rated_max,
143143
hwmon_in_beep,
144+
hwmon_in_fault,
144145
};
145146

146147
#define HWMON_I_ENABLE BIT(hwmon_in_enable)
@@ -162,6 +163,7 @@ enum hwmon_in_attributes {
162163
#define HWMON_I_RATED_MIN BIT(hwmon_in_rated_min)
163164
#define HWMON_I_RATED_MAX BIT(hwmon_in_rated_max)
164165
#define HWMON_I_BEEP BIT(hwmon_in_beep)
166+
#define HWMON_I_FAULT BIT(hwmon_in_fault)
165167

166168
enum hwmon_curr_attributes {
167169
hwmon_curr_enable,

0 commit comments

Comments
 (0)