diff options
author | Guenter Roeck <linux@roeck-us.net> | 2025-02-01 06:42:29 -0800 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2025-03-02 08:49:10 -0800 |
commit | c90a00368d90b4ac46712b870debfff6ae50bb87 (patch) | |
tree | dc69fe1d61a4484359aab6c0e35b78cba9f901a8 | |
parent | 64fbb4c42ab910af6c06c37106f9e06ccde91e34 (diff) |
hwmon: (pmbus/core) Report content of CAPABILITY register in debugfs
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.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/pmbus/pmbus_core.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index f8965829fe17..cfeba2e4c5c3 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -3568,12 +3568,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) @@ -3587,6 +3587,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; |