Re: [PATCH] dt-bindings: iio: afe: voltage-divider: Add io-channel-cells

From: Conor Dooley
Date: Fri Jan 26 2024 - 17:14:58 EST


On Fri, Jan 26, 2024 at 11:10:36PM +0530, Naresh Solanki wrote:
> Hi Conor,
>
>
> On Fri, 26 Jan 2024 at 22:22, Conor Dooley <conor@xxxxxxxxxx> wrote:
> >
> > On Fri, Jan 26, 2024 at 09:55:20PM +0530, Naresh Solanki wrote:
> > > On Fri, 26 Jan 2024 at 21:47, Conor Dooley <conor@xxxxxxxxxx> wrote:
> > > > On Fri, Jan 26, 2024 at 05:25:08PM +0530, Naresh Solanki wrote:
> > > > > Signed-off-by: Naresh Solanki <naresh.solanki@xxxxxxxxxxxxx>
> > > > > ---
> > > > > Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml | 3 +++
> > > > > 1 file changed, 3 insertions(+)
> > > > >
> > > > > diff --git a/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml b/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
> > > > > index dddf97b50549..b4b5489ad98e 100644
> > > > > --- a/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
> > > > > +++ b/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
> > > > > @@ -39,6 +39,9 @@ properties:
> > > > > description: |
> > > > > Channel node of a voltage io-channel.
> > > > >
> > > > > + '#io-channel-cells':
> > > > > + const: 1
> > > >
> > > > The example in this binding looks like the voltage-divider is intended
> > > > to be an "IIO consumer" but "#io-channels-cells" is an "IIO provider"
> > > > property.
> > > >
> > > > Are you sure this is correct?
> > > I'm not aware that #io-channels-cells is only for IIO provider.
> >
> > #foo-cells properties are always for resource providers
> >
> > > But I do get some kernel message as mention in commit messages
> > > if this is specified in DT.
> >
> > Can you please share the DT in question? Or at least, the section that
> > describes the IIO provider and consumer?
> Below is link to complete DT:
> https://github.com/torvalds/linux/commit/522bf7f2d6b085f69d4538535bfc1eb965632f54

If you're gonna link something that is in a vendor tree, you should link
the actual vendor tree and not something that "does not belong to any
branch on this repository, and may belong to a fork outside of the
repository"!

I did look at what you have there and I think your dts is wrong.

The iio-hwmon binding says:
| description: >
| Bindings for hardware monitoring devices connected to ADC controllers
| supporting the Industrial I/O bindings.
|
| io-channels:
| minItems: 1
| maxItems: 51 # Should be enough
| description: >
| List of phandles to ADC channels to read the monitoring values

And then you have:
| iio-hwmon {
| compatible = "iio-hwmon";
| // Voltage sensors top to down
| io-channels = <&p12v_vd 0>, <&p5v_aux_vd 0>, <&p5v_bmc_aux_vd 0>, <&p3v3_aux_vd 0>,
| <&p3v3_bmc_aux_vd 0>, <&p1v8_bmc_aux_vd 0>, <&adc1 4>, <&adc0 2>, <&adc1 0>,
| <&p2V5_aux_vd 0>, <&p3v3_rtc_vd 0>;
| };
|
| p12v_vd: voltage_divider1 {
| compatible = "voltage-divider";
| io-channels = <&adc1 3>;
| #io-channel-cells = <1>;
|
| /* Scale the system voltage by 1127/127 to fit the ADC range.
| * Use small nominator to prevent integer overflow.
| */
| output-ohms = <15>;
| full-ohms = <133>;
| };

A voltage divider is _not_ an ADC channel, so I don't know why you are
treating it as one in the iio-hwmon entry. Can you explain this please?

Thanks,
Conor.

Attachment: signature.asc
Description: PGP signature