mbox series

[v5,0/2] dt-bindings: hwmon: pmbus: add bindings for isl68137

Message ID cover.1729874904.git.grantpeltier93@gmail.com (mailing list archive)
Headers show
Series dt-bindings: hwmon: pmbus: add bindings for isl68137 | expand

Message

Grant Peltier Oct. 25, 2024, 5:16 p.m. UTC
Renesas digital multiphase voltage regulators are capable of regulating
output voltages that exceed the range that their Vsense pins can detect.
In such applications, users may place a voltage divider between Vout and
the Vsense pin for a given rail. However, the driver currently has no
way of knowing if a voltage divider is being used which results in
erroneous telemetry being reported over hwmon.

This patch set defines a devicetree bindings schema for Renesas digital
multiphase voltage regulators that are supported by the isl68137 driver
to allow users to add voltage divider definitions for any rail powered
by the device. This patch set also includes the required changes to the
isl68137 driver to enable scaling Vout/Pout telemetry for rails with a
defined voltage divider.

v5:
- Fix clang compilation errors related to C23 syntax

v4:
- Revert devicetree property name to "vout-voltage-divider" and refactor
  property description and driver implementation to match existing
  vout-voltage-divider implementation in max20730 as no suitable generic
  voltage divider schema exists.
- Minor fixes based on Guenter's review of v2.
- Initialize voltage dividers for all channels to defaults that simplify
  logic in PMBus word read/write functions.

v3:
- Report and return errors reading the vout-voltage-divider property from
  the devicetree when the property is defined
- Change u64 division/rounding operations to use explicit math64 macros

v2:
- Fix devicetree bindings schema errors
- Add "renesas," vendor prefix to "vout-voltage-divider" property
- Rebase patch series on v6.12-rc1

Grant Peltier (2):
  hwmon: (pmbus/isl68137) add support for voltage divider on Vout
  dt-bindings: hwmon: isl68137: add bindings to support voltage dividers

 .../hwmon/pmbus/renesas,isl68137.yaml         | 147 ++++++++++++
 drivers/hwmon/pmbus/isl68137.c                | 209 +++++++++++++++++-
 2 files changed, 351 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hwmon/pmbus/renesas,isl68137.yaml

Comments

Geert Uytterhoeven Oct. 28, 2024, 10:18 a.m. UTC | #1
Hi Grant,

On Fri, Oct 25, 2024 at 7:16 PM Grant Peltier <grantpeltier93@gmail.com> wrote:
> Renesas digital multiphase voltage regulators are capable of regulating
> output voltages that exceed the range that their Vsense pins can detect.
> In such applications, users may place a voltage divider between Vout and
> the Vsense pin for a given rail. However, the driver currently has no
> way of knowing if a voltage divider is being used which results in
> erroneous telemetry being reported over hwmon.
>
> This patch set defines a devicetree bindings schema for Renesas digital
> multiphase voltage regulators that are supported by the isl68137 driver
> to allow users to add voltage divider definitions for any rail powered
> by the device. This patch set also includes the required changes to the
> isl68137 driver to enable scaling Vout/Pout telemetry for rails with a
> defined voltage divider.
>
> v5:
> - Fix clang compilation errors related to C23 syntax

Thanks for the update!

> v4:
> - Revert devicetree property name to "vout-voltage-divider" and refactor
>   property description and driver implementation to match existing
>   vout-voltage-divider implementation in max20730 as no suitable generic
>   voltage divider schema exists.

Can you please elaborate (or point to the email that did so, in case
I missed it)?

In reply to v2, Günter wrote:

   "I would prefer, in the order of preference,

    1) an applicable generic property definition
    2) a definition that is already used elsewhere
    3) a new chips specific definition"

https://lore.kernel.org/all/3f460b62-4cd1-49dd-a98b-1fbcfdbd3af0@roeck-us.net

Thanks!

Gr{oetje,eeting}s,

                        Geert
Grant Peltier Oct. 29, 2024, 4:32 p.m. UTC | #2
On Mon, Oct 28, 2024 at 11:18:39AM +0100, Geert Uytterhoeven wrote:
> > v4:
> > - Revert devicetree property name to "vout-voltage-divider" and refactor
> >   property description and driver implementation to match existing
> >   vout-voltage-divider implementation in max20730 as no suitable generic
> >   voltage divider schema exists.
> 
> Can you please elaborate (or point to the email that did so, in case
> I missed it)?
> 
> In reply to v2, Günter wrote:
> 
>    "I would prefer, in the order of preference,
> 
>     1) an applicable generic property definition
>     2) a definition that is already used elsewhere
>     3) a new chips specific definition"
> 
> https://lore.kernel.org/all/3f460b62-4cd1-49dd-a98b-1fbcfdbd3af0@roeck-us.net
> 
> Thanks!
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
>

Hi Geert,

After looking through existing bindings definitions, the only generic
voltage divider property that I found was one that is intended to scale
voltages for IIO io-channels. However, the use case here is to scale
particular hwmon PMBus telemetry, which most closely matches the existing
implementation of the vout-voltage-divider property in the max20730
driver so I opted to copy that implementation based on Guenter's
preferences. Is there something that I missed or more information that
you are looking for?

Thanks,
Grant
Guenter Roeck Oct. 29, 2024, 6 p.m. UTC | #3
On 10/29/24 09:32, Grant Peltier wrote:
> On Mon, Oct 28, 2024 at 11:18:39AM +0100, Geert Uytterhoeven wrote:
>>> v4:
>>> - Revert devicetree property name to "vout-voltage-divider" and refactor
>>>    property description and driver implementation to match existing
>>>    vout-voltage-divider implementation in max20730 as no suitable generic
>>>    voltage divider schema exists.
>>
>> Can you please elaborate (or point to the email that did so, in case
>> I missed it)?
>>
>> In reply to v2, Günter wrote:
>>
>>     "I would prefer, in the order of preference,
>>
>>      1) an applicable generic property definition
>>      2) a definition that is already used elsewhere
>>      3) a new chips specific definition"
>>
>> https://lore.kernel.org/all/3f460b62-4cd1-49dd-a98b-1fbcfdbd3af0@roeck-us.net
>>
>> Thanks!
>>
>> Gr{oetje,eeting}s,
>>
>>                          Geert
>>
> 
> Hi Geert,
> 
> After looking through existing bindings definitions, the only generic
> voltage divider property that I found was one that is intended to scale
> voltages for IIO io-channels. However, the use case here is to scale
> particular hwmon PMBus telemetry, which most closely matches the existing
> implementation of the vout-voltage-divider property in the max20730
> driver so I opted to copy that implementation based on Guenter's
> preferences. Is there something that I missed or more information that
> you are looking for?
> 

I had a look myself. I agree with Grant, the existing bindings are really
not a good match. They are directly tied to iio, the implementation in
drivers/iio/afe/iio-rescale.c is completely iio specific, and I see
no means to use it for anything but iio. The problem is that it is
a "compatible" property, not parameter property (or set of properties)
as I would have expected [sorry if I use the wrong terminology].

We could possibly use the actual properties, "output-ohms" and "full-ohms",
but I am not really sure if that makes too much sense.

Note that there are a variety of voltage divider properties.

gw,voltage-divider-ohms
lltc,fb-voltage-divider
mps,fb-voltage-divider
vout-voltage-divider

All those specify a pair of resistors. I think that model is much better
suited to the problem at hand than a "compatible".

I agree though that this should be explained in the patch description.

Guenter