Skip to content

Commit 3006204

Browse files
ninadpalsulegroeck
authored andcommitted
hwmon: (pmbus/core) Add PMBUS_REVISION in debugfs
Add debugfs file for the PMBUS_REVISION command. This command provides information about PMBus protocol revision number. Signed-off-by: Ninad Palsule <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 0f049da commit 3006204

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
@@ -3534,11 +3534,11 @@ static int pmbus_init_debugfs(struct i2c_client *client,
35343534

35353535
/*
35363536
* Allocate the max possible entries we need.
3537-
* 6 entries device-specific
3537+
* 7 entries device-specific
35383538
* 10 entries page-specific
35393539
*/
35403540
entries = devm_kcalloc(data->dev,
3541-
6 + data->info->pages * 10, sizeof(*entries),
3541+
7 + data->info->pages * 10, sizeof(*entries),
35423542
GFP_KERNEL);
35433543
if (!entries)
35443544
return -ENOMEM;
@@ -3551,6 +3551,15 @@ static int pmbus_init_debugfs(struct i2c_client *client,
35513551
* assume that values of the following registers are the same for all
35523552
* pages and report values only for page 0.
35533553
*/
3554+
if (pmbus_check_byte_register(client, 0, PMBUS_REVISION)) {
3555+
entries[idx].client = client;
3556+
entries[idx].page = 0;
3557+
entries[idx].reg = PMBUS_REVISION;
3558+
debugfs_create_file("revision", 0444, data->debugfs,
3559+
&entries[idx++],
3560+
&pmbus_debugfs_ops);
3561+
}
3562+
35543563
if (pmbus_check_block_register(client, 0, PMBUS_MFR_ID)) {
35553564
entries[idx].client = client;
35563565
entries[idx].page = 0;

0 commit comments

Comments
 (0)