Skip to content

Commit c90a003

Browse files
committed
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>
1 parent 64fbb4c commit c90a003

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

drivers/hwmon/pmbus/pmbus_core.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3568,12 +3568,12 @@ static void pmbus_init_debugfs(struct i2c_client *client,
35683568
/*
35693569
* Allocate the max possible entries we need.
35703570
* device specific:
3571-
* ARRAY_SIZE(pmbus_debugfs_block_data) + 1
3571+
* ARRAY_SIZE(pmbus_debugfs_block_data) + 2
35723572
* page specific:
35733573
* ARRAY_SIZE(pmbus_debugfs_status_data) + 1
35743574
*/
35753575
entries = devm_kcalloc(data->dev,
3576-
ARRAY_SIZE(pmbus_debugfs_block_data) + 1 +
3576+
ARRAY_SIZE(pmbus_debugfs_block_data) + 2 +
35773577
data->info->pages * (ARRAY_SIZE(pmbus_debugfs_status_data) + 1),
35783578
sizeof(*entries), GFP_KERNEL);
35793579
if (!entries)
@@ -3587,6 +3587,15 @@ static void pmbus_init_debugfs(struct i2c_client *client,
35873587
* assume that values of the following registers are the same for all
35883588
* pages and report values only for page 0.
35893589
*/
3590+
if (!(data->flags & PMBUS_NO_CAPABILITY) &&
3591+
pmbus_check_byte_register(client, 0, PMBUS_CAPABILITY)) {
3592+
entries[idx].client = client;
3593+
entries[idx].page = 0;
3594+
entries[idx].reg = PMBUS_CAPABILITY;
3595+
debugfs_create_file("capability", 0444, debugfs,
3596+
&entries[idx++],
3597+
&pmbus_debugfs_ops);
3598+
}
35903599
if (pmbus_check_byte_register(client, 0, PMBUS_REVISION)) {
35913600
entries[idx].client = client;
35923601
entries[idx].page = 0;

0 commit comments

Comments
 (0)