Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: linux-hwmon@vger.kernel.org
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 8/8] hwmon: (pmbus/core) Report content of CAPABILITY register in debugfs
Date: Sun,  9 Feb 2025 20:00:24 -0800	[thread overview]
Message-ID: <20250210040024.2296208-2-linux@roeck-us.net> (raw)
In-Reply-To: <20250210040024.2296208-1-linux@roeck-us.net>

Report the value of the CAPABILITY register in debugfs if supported.
Only check if the register is supported if PMBUS_NO_CAPABILITY
is not set.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/hwmon/pmbus/pmbus_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index f4d4a91ff4aa..b2e3cd1ec941 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -3585,6 +3585,15 @@ static void pmbus_init_debugfs(struct i2c_client *client,
 	 * assume that values of the following registers are the same for all
 	 * pages and report values only for page 0.
 	 */
+	if (!(data->flags & PMBUS_NO_CAPABILITY) &&
+	    pmbus_check_byte_register(client, 0, PMBUS_CAPABILITY)) {
+		entries[idx].client = client;
+		entries[idx].page = 0;
+		entries[idx].reg = PMBUS_CAPABILITY;
+		debugfs_create_file("capability", 0444, debugfs,
+				    &entries[idx++],
+				    &pmbus_debugfs_ops);
+	}
 	if (pmbus_check_byte_register(client, 0, PMBUS_REVISION)) {
 		entries[idx].client = client;
 		entries[idx].page = 0;
-- 
2.45.2


  reply	other threads:[~2025-02-10  4:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10  4:00 [PATCH 7/8] hwmon: (pmbus/core) Optimize debugfs status attribute initialization Guenter Roeck
2025-02-10  4:00 ` Guenter Roeck [this message]
2025-02-10  5:34   ` [PATCH 8/8] hwmon: (pmbus/core) Report content of CAPABILITY register in debugfs Tzung-Bi Shih
2025-02-10 16:02     ` Guenter Roeck
2025-02-10  5:33 ` [PATCH 7/8] hwmon: (pmbus/core) Optimize debugfs status attribute initialization Tzung-Bi Shih

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=20250210040024.2296208-2-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.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