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 v2 8/8] hwmon: (pmbus/core) Report content of CAPABILITY register in debugfs
Date: Tue, 11 Feb 2025 07:52:40 -0800 [thread overview]
Message-ID: <20250211155240.2077464-9-linux@roeck-us.net> (raw)
In-Reply-To: <20250211155240.2077464-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>
---
v2: Fix number of debugfs files
drivers/hwmon/pmbus/pmbus_core.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index f0f8b7ed5416..8625de9caff7 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -3569,12 +3569,12 @@ static void pmbus_init_debugfs(struct i2c_client *client,
/*
* Allocate the max possible entries we need.
* device specific:
- * ARRAY_SIZE(pmbus_debugfs_block_data) + 1
+ * ARRAY_SIZE(pmbus_debugfs_block_data) + 2
* page specific:
* ARRAY_SIZE(pmbus_debugfs_status_data) + 1
*/
entries = devm_kcalloc(data->dev,
- ARRAY_SIZE(pmbus_debugfs_block_data) + 1 +
+ ARRAY_SIZE(pmbus_debugfs_block_data) + 2 +
data->info->pages * (ARRAY_SIZE(pmbus_debugfs_status_data) + 1),
sizeof(*entries), GFP_KERNEL);
if (!entries)
@@ -3588,6 +3588,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
next prev parent reply other threads:[~2025-02-11 15:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 15:52 [PATCH v2 0/8] hwmon: (pmbus/core) Various fixes and improvements Guenter Roeck
2025-02-11 15:52 ` [PATCH v2 1/8] hwmon: (pmbus/core) Fix various coding style issues Guenter Roeck
2025-02-11 15:52 ` [PATCH v2 2/8] hwmon: (pmbus/core) Use local debugfs variable in debugfs initialization Guenter Roeck
2025-02-11 15:52 ` [PATCH v2 3/8] hwmon: (pmbus/core) Use the new i2c_client debugfs directory Guenter Roeck
2025-02-11 15:52 ` [PATCH v2 4/8] hwmon: (pmbus/core) Make debugfs code unconditional Guenter Roeck
2025-02-11 15:52 ` [PATCH v2 5/8] hwmon: (pmbus/core) Declare regulator notification function as void Guenter Roeck
2025-02-11 15:52 ` [PATCH v2 6/8] hwmon: (pmbus/core) Optimize debugfs block data attribute initialization Guenter Roeck
2025-02-12 3:53 ` Tzung-Bi Shih
2025-02-11 15:52 ` [PATCH v2 7/8] hwmon: (pmbus/core) Optimize debugfs status " Guenter Roeck
2025-02-12 3:54 ` Tzung-Bi Shih
2025-02-11 15:52 ` Guenter Roeck [this message]
2025-02-12 3:55 ` [PATCH v2 8/8] hwmon: (pmbus/core) Report content of CAPABILITY register in debugfs Tzung-Bi Shih
2025-02-12 3:59 ` Guenter Roeck
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=20250211155240.2077464-9-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.