2024-01-30 12:06:15

by Naresh Solanki

[permalink] [raw]
Subject: [PATCH v3] dt-bindings: iio: afe: voltage-divider: Add io-channel-cells

voltage-divider is always an iio consumer at the same time it is
optionally an iio provider.
Hence add #io-channel-cells
Also update example.

Signed-off-by: Naresh Solanki <[email protected]>
---
.../bindings/iio/afe/voltage-divider.yaml | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml b/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
index dddf97b50549..98fec8548cc3 100644
--- a/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
+++ b/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
@@ -39,6 +39,13 @@ properties:
description: |
Channel node of a voltage io-channel.

+ '#io-channel-cells':
+ description:
+ In addition to consuming the measurement services of a voltage output
+ channel the voltage divider can act as a provider of measurement
+ services to other devices.
+ const: 1
+
output-ohms:
description:
Resistance Rout over which the output voltage is measured. See full-ohms.
@@ -75,12 +82,17 @@ examples:
spi-max-frequency = <1000000>;
};
};
- sysv {
+ p12v_vd: sysv {
compatible = "voltage-divider";
io-channels = <&maxadc 1>;
+ #io-channel-cells = <1>;

/* Scale the system voltage by 22/222 to fit the ADC range. */
output-ohms = <22>;
full-ohms = <222>; /* 200 + 22 */
};
+ iio-hwmon {
+ compatible = "iio-hwmon";
+ io-channels = <&p12v_vd 0>;
+ };
...

base-commit: 861c0981648f5b64c86fd028ee622096eb7af05a
--
2.42.0



2024-01-30 17:23:26

by Conor Dooley

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

Hey,

On Tue, Jan 30, 2024 at 05:26:50PM +0530, Naresh Solanki wrote:
> voltage-divider is always an iio consumer at the same time it is
> optionally an iio provider.
> Hence add #io-channel-cells
> Also update example.
>
> Signed-off-by: Naresh Solanki <[email protected]>
> ---
> .../bindings/iio/afe/voltage-divider.yaml | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml b/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
> index dddf97b50549..98fec8548cc3 100644
> --- a/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
> +++ b/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
> @@ -39,6 +39,13 @@ properties:
> description: |
> Channel node of a voltage io-channel.
>
> + '#io-channel-cells':
> + description:
> + In addition to consuming the measurement services of a voltage output
> + channel the voltage divider can act as a provider of measurement
> + services to other devices.

Did you miss:
https://lore.kernel.org/all/20240127165542.6eeb23e9@jic23-huawei/
Where I said that I would like to have an example of where this would be
used in the description? Peter gave a good example that you can draw on.

> + const: 1
> +
> output-ohms:
> description:
> Resistance Rout over which the output voltage is measured. See full-ohms.
> @@ -75,12 +82,17 @@ examples:
> spi-max-frequency = <1000000>;
> };
> };
> - sysv {
> + p12v_vd: sysv {
> compatible = "voltage-divider";
> io-channels = <&maxadc 1>;
> + #io-channel-cells = <1>;
>
> /* Scale the system voltage by 22/222 to fit the ADC range. */
> output-ohms = <22>;
> full-ohms = <222>; /* 200 + 22 */
> };

Blank line here please.

Thanks,
Conor.

> + iio-hwmon {
> + compatible = "iio-hwmon";
> + io-channels = <&p12v_vd 0>;
> + };
> ...
>
> base-commit: 861c0981648f5b64c86fd028ee622096eb7af05a
> --
> 2.42.0
>


Attachments:
(No filename) (2.12 kB)
signature.asc (235.00 B)
Download all attachments

2024-01-31 08:30:14

by Krzysztof Kozlowski

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

On 30/01/2024 12:56, Naresh Solanki wrote:
> voltage-divider is always an iio consumer at the same time it is
> optionally an iio provider.
> Hence add #io-channel-cells
> Also update example.
>

Fix
wrapping
and
proper
sentences. Each sentence finishes with full stop.

..
> output-ohms:
> description:
> Resistance Rout over which the output voltage is measured. See full-ohms.
> @@ -75,12 +82,17 @@ examples:
> spi-max-frequency = <1000000>;
> };
> };
> - sysv {
> + p12v_vd: sysv {

No, drop label.

> compatible = "voltage-divider";
> io-channels = <&maxadc 1>;
> + #io-channel-cells = <1>;
>
> /* Scale the system voltage by 22/222 to fit the ADC range. */
> output-ohms = <22>;
> full-ohms = <222>; /* 200 + 22 */
> };
> + iio-hwmon {
> + compatible = "iio-hwmon";
> + io-channels = <&p12v_vd 0>;

The same question as for v2. Drop unrelated example.

Also, remember about rule of posting only one version per day, so people
actually have some chance to look at your patch.

Best regards,
Krzysztof


2024-01-31 16:57:30

by Conor Dooley

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

On Wed, Jan 31, 2024 at 04:35:16PM +0000, Jonathan Cameron wrote:
> On Wed, 31 Jan 2024 09:29:59 +0100
> Krzysztof Kozlowski <[email protected]> wrote:
>
> > On 30/01/2024 12:56, Naresh Solanki wrote:
> > > voltage-divider is always an iio consumer at the same time it is
> > > optionally an iio provider.
> > > Hence add #io-channel-cells
> > > Also update example.
> > >
> >
> > Fix
> > wrapping
> > and
> > proper
> > sentences. Each sentence finishes with full stop.
> >
> > ...
> > > output-ohms:
> > > description:
> > > Resistance Rout over which the output voltage is measured. See full-ohms.
> > > @@ -75,12 +82,17 @@ examples:
> > > spi-max-frequency = <1000000>;
> > > };
> > > };
> > > - sysv {
> > > + p12v_vd: sysv {
> >
> > No, drop label.
> >
> > > compatible = "voltage-divider";
> > > io-channels = <&maxadc 1>;
> > > + #io-channel-cells = <1>;
> > >
> > > /* Scale the system voltage by 22/222 to fit the ADC range. */
> > > output-ohms = <22>;
> > > full-ohms = <222>; /* 200 + 22 */
> > > };
> > > + iio-hwmon {
> > > + compatible = "iio-hwmon";
> > > + io-channels = <&p12v_vd 0>;
> >
> > The same question as for v2. Drop unrelated example.
>
> Conor requested an example of the device acting as a consumer and a provider.
> Might have meant in the patch description?
>
> Conor?

I wanted it in the property description to help with understanding when
to use it. I don't think the extra example nodes actually help you
understand what it is doing, only how to write one yourself once you
know you need it.

Thanks,
Conor.


Attachments:
(No filename) (1.71 kB)
signature.asc (235.00 B)
Download all attachments

2024-02-02 10:43:24

by Naresh Solanki

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

Hi,


On Wed, 31 Jan 2024 at 22:24, Conor Dooley <[email protected]> wrote:
>
> On Wed, Jan 31, 2024 at 04:35:16PM +0000, Jonathan Cameron wrote:
> > On Wed, 31 Jan 2024 09:29:59 +0100
> > Krzysztof Kozlowski <[email protected]> wrote:
> >
> > > On 30/01/2024 12:56, Naresh Solanki wrote:
> > > > voltage-divider is always an iio consumer at the same time it is
> > > > optionally an iio provider.
> > > > Hence add #io-channel-cells
> > > > Also update example.
> > > >
> > >
> > > Fix
> > > wrapping
> > > and
> > > proper
> > > sentences. Each sentence finishes with full stop.
Sure
> > >
> > > ...
> > > > output-ohms:
> > > > description:
> > > > Resistance Rout over which the output voltage is measured. See full-ohms.
> > > > @@ -75,12 +82,17 @@ examples:
> > > > spi-max-frequency = <1000000>;
> > > > };
> > > > };
> > > > - sysv {
> > > > + p12v_vd: sysv {
> > >
> > > No, drop label.
Sure
> > >
> > > > compatible = "voltage-divider";
> > > > io-channels = <&maxadc 1>;
> > > > + #io-channel-cells = <1>;
> > > >
> > > > /* Scale the system voltage by 22/222 to fit the ADC range. */
> > > > output-ohms = <22>;
> > > > full-ohms = <222>; /* 200 + 22 */
> > > > };
> > > > + iio-hwmon {
> > > > + compatible = "iio-hwmon";
> > > > + io-channels = <&p12v_vd 0>;
> > >
> > > The same question as for v2. Drop unrelated example.
Sure
> >
> > Conor requested an example of the device acting as a consumer and a provider.
> > Might have meant in the patch description?
> >
> > Conor?
>
> I wanted it in the property description to help with understanding when
> to use it. I don't think the extra example nodes actually help you
> understand what it is doing, only how to write one yourself once you
> know you need it.
I'm not sure if I get it right but what I understood is that a
voltage-divider can
also be a provider to other devices & hence the property.
Also do you want me to put a complete example of it in description ?

Regards,
Naresh
>
> Thanks,
> Conor.


Attachments:
signature.asc (235.00 B)

2024-02-02 11:49:46

by Peter Rosin

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

Hi!

2024-02-02 at 11:43, Naresh Solanki wrote:
> Hi,
>
>
> On Wed, 31 Jan 2024 at 22:24, Conor Dooley <[email protected]> wrote:
>>
>> On Wed, Jan 31, 2024 at 04:35:16PM +0000, Jonathan Cameron wrote:
>>> On Wed, 31 Jan 2024 09:29:59 +0100
>>> Krzysztof Kozlowski <[email protected]> wrote:
>>>
>>>> On 30/01/2024 12:56, Naresh Solanki wrote:
>>> Conor requested an example of the device acting as a consumer and a provider.
>>> Might have meant in the patch description?
>>>
>>> Conor?
>>
>> I wanted it in the property description to help with understanding when
>> to use it. I don't think the extra example nodes actually help you
>> understand what it is doing, only how to write one yourself once you
>> know you need it.
> I'm not sure if I get it right but what I understood is that a
> voltage-divider can
> also be a provider to other devices & hence the property.
> Also do you want me to put a complete example of it in description ?

My understanding is the requested example in the description should not
be exactly /how/ to hook up the voltage-divider as a provider, but
instead have some words about why it is interesting to do so at all. And
those words would also make it clear that is even possible. The latter
is something which, to be honest, is perhaps not all that obvious. It
has always been totally obvious to me of course, sorry for not being
clearer when I wrote the binding...

Cheers,
Peter

2024-02-02 13:09:17

by Conor Dooley

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

On Fri, Feb 02, 2024 at 12:49:26PM +0100, Peter Rosin wrote:
> 2024-02-02 at 11:43, Naresh Solanki wrote:
> > On Wed, 31 Jan 2024 at 22:24, Conor Dooley <[email protected]> wrote:
> >> On Wed, Jan 31, 2024 at 04:35:16PM +0000, Jonathan Cameron wrote:
> >>> On Wed, 31 Jan 2024 09:29:59 +0100
> >>> Krzysztof Kozlowski <[email protected]> wrote:
> >>>> On 30/01/2024 12:56, Naresh Solanki wrote:
> >>> Conor requested an example of the device acting as a consumer and a provider.
> >>> Might have meant in the patch description?
> >>>
> >>> Conor?
> >>
> >> I wanted it in the property description to help with understanding when
> >> to use it. I don't think the extra example nodes actually help you
> >> understand what it is doing, only how to write one yourself once you
> >> know you need it.
> >
> > I'm not sure if I get it right but what I understood is that a
> > voltage-divider can
> > also be a provider to other devices & hence the property.
> > Also do you want me to put a complete example of it in description ?
>
> My understanding is the requested example in the description should not
> be exactly /how/ to hook up the voltage-divider as a provider, but
> instead have some words about why it is interesting to do so at all. And
> those words would also make it clear that is even possible. The latter
> is something which, to be honest, is perhaps not all that obvious. It
> has always been totally obvious to me of course, sorry for not being
> clearer when I wrote the binding...

Yeah, you're right about what I was looking for Peter.

In my original request, which I think I already linked to in this
thread, I said that I would like an example like the one that Peter had
used to explain to me the scenario in which someone would want to use
this feature:
https://lore.kernel.org/all/[email protected]/

Cheers,
Conor.


Attachments:
(No filename) (1.88 kB)
signature.asc (235.00 B)
Download all attachments

2024-02-05 13:54:49

by Naresh Solanki

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

Hi Conor, Peter,

On Fri, 2 Feb 2024 at 18:39, Conor Dooley <[email protected]> wrote:
>
> On Fri, Feb 02, 2024 at 12:49:26PM +0100, Peter Rosin wrote:
> > 2024-02-02 at 11:43, Naresh Solanki wrote:
> > > On Wed, 31 Jan 2024 at 22:24, Conor Dooley <[email protected]> wrote:
> > >> On Wed, Jan 31, 2024 at 04:35:16PM +0000, Jonathan Cameron wrote:
> > >>> On Wed, 31 Jan 2024 09:29:59 +0100
> > >>> Krzysztof Kozlowski <[email protected]> wrote:
> > >>>> On 30/01/2024 12:56, Naresh Solanki wrote:
> > >>> Conor requested an example of the device acting as a consumer and a provider.
> > >>> Might have meant in the patch description?
> > >>>
> > >>> Conor?
> > >>
> > >> I wanted it in the property description to help with understanding when
> > >> to use it. I don't think the extra example nodes actually help you
> > >> understand what it is doing, only how to write one yourself once you
> > >> know you need it.
> > >
> > > I'm not sure if I get it right but what I understood is that a
> > > voltage-divider can
> > > also be a provider to other devices & hence the property.
> > > Also do you want me to put a complete example of it in description ?
> >
> > My understanding is the requested example in the description should not
> > be exactly /how/ to hook up the voltage-divider as a provider, but
> > instead have some words about why it is interesting to do so at all. And
> > those words would also make it clear that is even possible. The latter
> > is something which, to be honest, is perhaps not all that obvious. It
> > has always been totally obvious to me of course, sorry for not being
> > clearer when I wrote the binding...
>
> Yeah, you're right about what I was looking for Peter.
>
> In my original request, which I think I already linked to in this
> thread, I said that I would like an example like the one that Peter had
> used to explain to me the scenario in which someone would want to use
> this feature:
> https://lore.kernel.org/all/[email protected]/
ok. Based on my understanding, I'll update the property description
with an example.

description:
In addition to consuming the measurement services of a voltage output
channel the voltage divider can act as a provider of measurement
services to other devices. This is particularly useful in scenarios wherein,
ADC has analog frontend such as voltage divider then consuming its raw
value isn't interesting. It is desired to get real voltage before
voltage divider.

Regards,
Naresh

>
> Cheers,
> Conor.

2024-02-05 17:19:12

by Conor Dooley

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

On Mon, Feb 05, 2024 at 07:24:07PM +0530, Naresh Solanki wrote:
> Hi Conor, Peter,
>
> On Fri, 2 Feb 2024 at 18:39, Conor Dooley <[email protected]> wrote:
> >
> > On Fri, Feb 02, 2024 at 12:49:26PM +0100, Peter Rosin wrote:
> > > 2024-02-02 at 11:43, Naresh Solanki wrote:
> > > > On Wed, 31 Jan 2024 at 22:24, Conor Dooley <[email protected]> wrote:
> > > >> On Wed, Jan 31, 2024 at 04:35:16PM +0000, Jonathan Cameron wrote:
> > > >>> On Wed, 31 Jan 2024 09:29:59 +0100
> > > >>> Krzysztof Kozlowski <[email protected]> wrote:
> > > >>>> On 30/01/2024 12:56, Naresh Solanki wrote:
> > > >>> Conor requested an example of the device acting as a consumer and a provider.
> > > >>> Might have meant in the patch description?
> > > >>>
> > > >>> Conor?
> > > >>
> > > >> I wanted it in the property description to help with understanding when
> > > >> to use it. I don't think the extra example nodes actually help you
> > > >> understand what it is doing, only how to write one yourself once you
> > > >> know you need it.
> > > >
> > > > I'm not sure if I get it right but what I understood is that a
> > > > voltage-divider can
> > > > also be a provider to other devices & hence the property.
> > > > Also do you want me to put a complete example of it in description ?
> > >
> > > My understanding is the requested example in the description should not
> > > be exactly /how/ to hook up the voltage-divider as a provider, but
> > > instead have some words about why it is interesting to do so at all. And
> > > those words would also make it clear that is even possible. The latter
> > > is something which, to be honest, is perhaps not all that obvious. It
> > > has always been totally obvious to me of course, sorry for not being
> > > clearer when I wrote the binding...
> >
> > Yeah, you're right about what I was looking for Peter.
> >
> > In my original request, which I think I already linked to in this
> > thread, I said that I would like an example like the one that Peter had
> > used to explain to me the scenario in which someone would want to use
> > this feature:
> > https://lore.kernel.org/all/[email protected]/
> ok. Based on my understanding, I'll update the property description
> with an example.
>
> description:
> In addition to consuming the measurement services of a voltage output
> channel the voltage divider can act as a provider of measurement
> services to other devices.

> This is particularly useful in scenarios wherein,
> ADC has analog frontend such as voltage divider then consuming its raw
> value isn't interesting.

This sentence is structured pretty weirdly, it's missing articles and
prepositions, but you have the right idea here, thanks.


> It is desired to get real voltage before
> voltage divider.



Attachments:
(No filename) (2.80 kB)
signature.asc (235.00 B)
Download all attachments