Re: [PATCH v2 2/2] hwmon: (pmbus/rtq2886b) Add driver for Richtek RTQ2886B

From: ChiYuan Huang

Date: Tue Dec 01 2026 - 03:41:36 EST


On Mon, Nov 30, 2026 at 10:45:04PM -0800, Guenter Roeck wrote:
> Hi,
>
> On 11/30/26 17:11, cy_huang@xxxxxxxxxxx wrote:
> > From: ChiYuan Huang <cy_huang@xxxxxxxxxxx>
> >
[...]
> > +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
>