[PATCH v3 1/2] hwmon: (core) Add support for power fault attribute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Power sensor driver might want to signal that the power
value is not usable. Add a new power fault attribute to
report such failures.

Signed-off-by: Armin Wolf <W_Armin@xxxxxx>
---
Changes since v2:
- added patch
---
 Documentation/ABI/testing/sysfs-class-hwmon | 9 +++++++++
 drivers/hwmon/hwmon.c                       | 1 +
 include/linux/hwmon.h                       | 2 ++
 3 files changed, 12 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-class-hwmon b/Documentation/ABI/testing/sysfs-class-hwmon
index cfd0d0bab483..ed01d43d2491 100644
--- a/Documentation/ABI/testing/sysfs-class-hwmon
+++ b/Documentation/ABI/testing/sysfs-class-hwmon
@@ -882,6 +882,15 @@ Description:

 		RW

+What:		/sys/class/hwmon/hwmonX/powerY_fault
+Description:
+		Reports a power sensor failure.
+
+		- 1: Failed
+		- 0: Ok
+
+		RO
+
 What:		/sys/class/hwmon/hwmonX/powerY_rated_min
 Description:
 		Minimum rated power.
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 3b259c425ab7..6150d64f5c4c 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -560,6 +560,7 @@ static const char * const hwmon_power_attr_templates[] = {
 	[hwmon_power_crit] = "power%d_crit",
 	[hwmon_power_label] = "power%d_label",
 	[hwmon_power_alarm] = "power%d_alarm",
+	[hwmon_power_fault] = "power%d_fault",
 	[hwmon_power_cap_alarm] = "power%d_cap_alarm",
 	[hwmon_power_min_alarm] = "power%d_min_alarm",
 	[hwmon_power_max_alarm] = "power%d_max_alarm",
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index edf96f249eb5..00122e565dbf 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -237,6 +237,7 @@ enum hwmon_power_attributes {
 	hwmon_power_max_alarm,
 	hwmon_power_lcrit_alarm,
 	hwmon_power_crit_alarm,
+	hwmon_power_fault,
 	hwmon_power_rated_min,
 	hwmon_power_rated_max,
 };
@@ -270,6 +271,7 @@ enum hwmon_power_attributes {
 #define HWMON_P_MAX_ALARM		BIT(hwmon_power_max_alarm)
 #define HWMON_P_LCRIT_ALARM		BIT(hwmon_power_lcrit_alarm)
 #define HWMON_P_CRIT_ALARM		BIT(hwmon_power_crit_alarm)
+#define HWMON_P_FAULT			BIT(hwmon_power_fault)
 #define HWMON_P_RATED_MIN		BIT(hwmon_power_rated_min)
 #define HWMON_P_RATED_MAX		BIT(hwmon_power_rated_max)

--
2.39.2





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux