Re: [PATCH] dt-bindings: iio: afe: voltage-divider: Add io-channel-cells
From: Naresh Solanki
Date: Fri Jan 26 2024 - 12:41:12 EST
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
>
> It should look like the example:
I reference the below example previously but didn't help.
If io-channel-cell isn't provided then there is print in kernel dmesg as:
OF: /iio-hwmon: could not get #io-channel-cells for /voltage_divider1
Thanks,
Naresh
>
> spi {
> #address-cells = <1>;
> #size-cells = <0>;
> adc@0 {
> compatible = "maxim,max1027";
> reg = <0>;
> #io-channel-cells = <1>;
> interrupt-parent = <&gpio5>;
> interrupts = <15 IRQ_TYPE_EDGE_RISING>;
> spi-max-frequency = <1000000>;
> };
> };
>
> sysv {
> compatible = "voltage-divider";
> io-channels = <&maxadc 1>;
>
> /* Scale the system voltage by 22/222 to fit the ADC range. */
> output-ohms = <22>;
> full-ohms = <222>; /* 200 + 22 */
> };
>
> Thanks,
> Conor.