mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: vjardin@free.fr
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: (pmbus/core) Add a vout_command debugfs entry
Date: Sun, 8 Nov 2026 10:08:16 -0800	[thread overview]
Message-ID: <7ad9c540-ef80-4dc5-9a36-ddc9de07f957@roeck-us.net> (raw)
In-Reply-To: <20261108-for-upstream-pmbus-vout-command-debugfs-v1-v1-1-c7a063efb91c@free.fr>

On 11/8/26 09:32, Vincent Jardin via B4 Relay wrote:
> From: Vincent Jardin <vjardin@free.fr>
> 
> 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@free.fr>
> ---
>   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


  reply	other threads:[~2026-11-08 18:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08 17:32 Vincent Jardin via B4 Relay
2026-11-08 18:08 ` Guenter Roeck [this message]
2026-11-09  9:28   ` Vincent Jardin

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=7ad9c540-ef80-4dc5-9a36-ddc9de07f957@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vjardin@free.fr \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®