The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: ChiYuan Huang <cy_huang@richtek.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Alexis Czezar Torreno" <alexisczezar.torreno@analog.com>,
	"Sanman Pradhan" <psanman@juniper.net>,
	"Ashish Yadav" <ashish.yadav@infineon.com>,
	"Matti Vaittinen" <mazziesaccount@gmail.com>,
	"Colin Huang" <u8813345@gmail.com>,
	"Vincent Jardin" <vjardin@free.fr>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Abdurrahman Hussain" <abdurrahman@nexthop.ai>,
	"Ziming Zhu" <ziming.zhu@silergycorp.com>,
	"Carlos Jones Jr" <carlosjr.jones@analog.com>,
	"Wensheng Wang" <wenswang@yeah.net>,
	"Charles Hsu" <hsu.yungteng@gmail.com>,
	"Brian Chiang" <chiang.brian@inventec.com>,
	oliver_tai@richtek.com, lucas_tsai@richtek.com,
	linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] hwmon: (pmbus/rtq2886b) Add driver for Richtek RTQ2886B
Date: Tue, 1 Dec 2026 16:40:22 +0800	[thread overview]
Message-ID: <aw6H9p1KQPOOIwni@git-send.richtek.com> (raw)
In-Reply-To: <e36c1665-b3d9-4381-99ed-d8f0fc1831c5@roeck-us.net>

On Mon, Nov 30, 2026 at 10:45:04PM -0800, Guenter Roeck wrote:
> Hi,
> 
> On 11/30/26 17:11, cy_huang@richtek.com wrote:
> > From: ChiYuan Huang <cy_huang@richtek.com>
> > 
[...]
> > +static int rtq2886b_read_word_data(struct i2c_client *i2c, int page, int phase, int reg)
> > +{
> > +	switch (reg) {
> > +	case PMBUS_MFR_VOUT_MIN:
> > +		return pmbus_read_word_data(i2c, page, phase, RTQ2886B_PMBUS_VOUT_MIN);
> 
> Is this the configured minimum output voltage, or the rated minimum
> output voltage ? Normally 0x2b would be the _configured_ minimum
> output voltage, and reporting it as rated minimum output voltage would
> be wrong.
> 
For RTQ2886B, PMBUS_MFR_VOUT_MIN/MAX are not implemented.

The device provides the minimum and maximum supported output voltage
capability through command 0x2b and PMBUS_VOUT_MAX respectively.
Both values are fixed device capabilities and are not board-specific
configurable limits.

The driver maps those values to PMBUS_MFR_VOUT_MIN/MAX so that the
rated voltage range can be exposed through the standard hwmon
attributes.

I'll add comments in the code to clarify this behavior.
> > +	case PMBUS_MFR_VOUT_MAX:
> > +		return pmbus_read_word_data(i2c, page, phase, PMBUS_VOUT_MAX);
> 
> PMBUS_MFR_VOUT_MAX is supposed to report the _rated_ maximum output
> voltage for a chip. PMBUS_VOUT_MAX is a configurable value that limits
> the output voltage that can be set on a given board. Both may be the
> same for a chip, but usually that is not the case. The datasheet
> is not public, so I can not know what is correct here. If the chip
> reports the _rated_ maximum output voltage (read-only) with
> PMBUS_VOUT_MAX, the code is ok, but this would require a comment.
> 
Like as the last comment.
> > +	default:
> > +		return -ENODATA;
> > +	}
> > +}
> > +
[...]
> > +static int rtq2886b_probe(struct i2c_client *i2c)
> > +{
> > +	int ret;
> > +
> > +	/* The device requires SMBus PEC for PMBus transactions. */
> > +	i2c->flags |= I2C_CLIENT_PEC;
> > +
> 
> If this is mandatory, something like
> 
> 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_PEC))
> 		return -ENODEV;
> 
> is needed above. If it is not mandatory, the PMBus core sets the flag
> automatically if supported by the I2C/SMBus controller, and the code above
> is not needed.
> 
> It seems likely that it is not mandatory, because pmbus_init_common()
> clears the flag before reading PMBUS_CAPABILITY, and does not re-enable
> it if reading PMBUS_CAPABILITY (without it) fails. Of course, it might
> be that it is only mandatory for I2C writes, but if so that should be
> explained with a comment.
> 
> Sorry, but since the datasheet is not public (actually, the chip
> does not even exist in public), you'll have to explain such details
> in the driver.
> 
The RTQ2886B powers up with PEC enabled by default.

As a result, writes to PMBUS_ON_OFF_CONFIG are rejected if PEC is not
enabled on the host side. Since the driver needs to switch the device
from hardware-controlled mode to PMBus-controlled operation during
probe, I2C_CLIENT_PEC is enabled before issuing that write.

I'll update the code comment to clarify this requirement.
> Thanks,
> Guenter
> 

      reply	other threads:[~2026-12-01  8:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  1:11 [PATCH v2 0/2] hwmon: pmbus: Add support for Richtek RTQ2886B cy_huang
2026-12-01  1:11 ` [PATCH v2 1/2] dt-bindings: hwmon: pmbus/rtq2886b: Add Richtek RTQ2886B support cy_huang
2026-12-01  1:11 ` [PATCH v2 2/2] hwmon: (pmbus/rtq2886b) Add driver for Richtek RTQ2886B cy_huang
2026-12-01  6:45   ` Guenter Roeck
2026-12-01  8:40     ` ChiYuan Huang [this message]

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=aw6H9p1KQPOOIwni@git-send.richtek.com \
    --to=cy_huang@richtek.com \
    --cc=abdurrahman@nexthop.ai \
    --cc=alexisczezar.torreno@analog.com \
    --cc=ashish.yadav@infineon.com \
    --cc=carlosjr.jones@analog.com \
    --cc=chiang.brian@inventec.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=hsu.yungteng@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lucas_tsai@richtek.com \
    --cc=mazziesaccount@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=oliver_tai@richtek.com \
    --cc=psanman@juniper.net \
    --cc=rdunlap@infradead.org \
    --cc=robh@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=u8813345@gmail.com \
    --cc=vjardin@free.fr \
    --cc=wenswang@yeah.net \
    --cc=ziming.zhu@silergycorp.com \
    /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