Re: [PATCH] hwmon: (pmbus/core) Add a vout_command debugfs entry

From: Guenter Roeck

Date: Sun Nov 08 2026 - 13:08:28 EST


On 11/8/26 09:32, Vincent Jardin via B4 Relay wrote:
From: Vincent Jardin <vjardin@xxxxxxx>

The vout hwmon attributes and the regulator get_voltage() callback
both report READ_VOUT.

On a regulator whose configuration applies a load line (droop),
READ_VOUT sits below the setpoint under load by design, so user space
cannot see what the regulator was actually set to.

max20730 already exposes a driver-specific vout_command entry. Add
vout<page>_command to the PMBus core debugfs, for every page with VOUT
and a readable VOUT_COMMAND, in millivolts like the in*_input attributes.

Signed-off-by: Vincent Jardin <vjardin@xxxxxxx>
---
drivers/hwmon/pmbus/pmbus_core.c | 42 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 37b650b85d1c..1ad5523a9624 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -3833,6 +3833,33 @@ static int pmbus_debugfs_get_status(void *data, u64 *val)
DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_status, pmbus_debugfs_get_status,
NULL, "0x%04llx\n");
+static int pmbus_debugfs_get_vout_command(void *data, u64 *val)
+{
+ struct pmbus_debugfs_entry *entry = data;
+ struct i2c_client *client = entry->client;
+ struct pmbus_data *pdata = i2c_get_clientdata(client);
+ struct pmbus_sensor s = {
+ .page = entry->page,
+ .reg = entry->reg,
+ .class = PSC_VOLTAGE_OUT,
+ .convert = true,
+ };
+ int rc;
+
+ guard(pmbus_lock)(client);
+
+ rc = _pmbus_read_word_data(client, entry->page, 0xff, entry->reg);
+ if (rc < 0)
+ return rc;
+
+ s.data = rc;
+ *val = pmbus_reg2data(pdata, &s);
+

Why not use the already existing pmbus_vout_command_mv() ?

Thanks,
Guenter