Linux-Hwmon Archive mirror
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: mlj@danelec.com, rafael.j.wysocki@intel.com, lenb@kernel.org
Cc: jdelvare@suse.com, linux@roeck-us.net, linux@weissschuh.net,
	ilpo.jarvinen@linux.intel.com, linux-acpi@vger.kernel.org,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org
Subject: [PATCH v3 1/2] hwmon: (core) Add support for power fault attribute
Date: Fri, 12 Apr 2024 18:08:56 +0200	[thread overview]
Message-ID: <20240412160857.79858-1-W_Armin@gmx.de> (raw)

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@gmx.de>
---
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


             reply	other threads:[~2024-04-12 16:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 16:08 Armin Wolf [this message]
2024-04-12 16:08 ` [PATCH v3 2/2] ACPI: fan: Add hwmon support Armin Wolf
2024-04-12 16:41   ` Guenter Roeck
2024-04-12 20:27     ` Armin Wolf
2024-04-12 21:01       ` Guenter Roeck
2024-04-12 23:18         ` Armin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240412160857.79858-1-W_Armin@gmx.de \
    --to=w_armin@gmx.de \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jdelvare@suse.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=linux@weissschuh.net \
    --cc=mlj@danelec.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).