diff mbox series

[v3,1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC

Message ID 20220511070443.30231-2-biju.das.jz@bp.renesas.com (mailing list archive)
State Superseded
Headers show
Series Add RZ/G2UL ADC support | expand

Commit Message

Biju Das May 11, 2022, 7:04 a.m. UTC
Document Renesas RZ/G2UL ADC bindings. RZ/G2UL ADC is almost identical
to RZ/G2L, but it has 2 analog input channels compared to 8 channels
on the RZ/G2L.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v2->v3:
 * Added generic description for reg.
 * Improved schema validation by restricting both channel and reg to [0-1].
v1->v2:
 * Started using generic compatible for RZ/G2UL and added SoC specific validation
   for channels.
---
 .../bindings/iio/adc/renesas,rzg2l-adc.yaml   | 36 ++++++++++++++++---
 1 file changed, 32 insertions(+), 4 deletions(-)

Comments

Geert Uytterhoeven May 11, 2022, 7:13 a.m. UTC | #1
Hi Biju,

On Wed, May 11, 2022 at 9:04 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Document Renesas RZ/G2UL ADC bindings. RZ/G2UL ADC is almost identical
> to RZ/G2L, but it has 2 analog input channels compared to 8 channels
> on the RZ/G2L.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v2->v3:
>  * Added generic description for reg.
>  * Improved schema validation by restricting both channel and reg to [0-1].

Thanks for the update!

> --- a/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
> @@ -19,6 +19,7 @@ properties:
>    compatible:
>      items:
>        - enum:
> +          - renesas,r9a07g043-adc   # RZ/G2UL
>            - renesas,r9a07g044-adc   # RZ/G2L
>            - renesas,r9a07g054-adc   # RZ/V2L
>        - const: renesas,rzg2l-adc
> @@ -76,16 +77,43 @@ patternProperties:
>      properties:
>        reg:
>          description: |
> -          The channel number. It can have up to 8 channels numbered from 0 to 7.
> -        items:
> -          - minimum: 0
> -            maximum: 7
> +          The channel number.
>
>      required:
>        - reg
>
>      additionalProperties: false
>
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: renesas,r9a07g043-adc
> +    then:
> +      patternProperties:
> +        "^channel@[2-7]$": false
> +        "^channel@[0-1]$":
> +          type: object
> +          properties:
> +            reg:
> +              description: |
> +                It can have up to 2 channels numbered from 0 to 1.

IMHO the description doesn't add any value, as it's equivalent to
the logic below.

> +              items:

I don't think the "items" is needed or wanted, as there can be
only one?

> +                - minimum: 0
> +                  maximum: 1

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Biju Das May 11, 2022, 7:39 a.m. UTC | #2
Hi Geert,

Thanks for the feedback.

> Subject: Re: [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL
> ADC
> 
> Hi Biju,
> 
> On Wed, May 11, 2022 at 9:04 AM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > Document Renesas RZ/G2UL ADC bindings. RZ/G2UL ADC is almost identical
> > to RZ/G2L, but it has 2 analog input channels compared to 8 channels
> > on the RZ/G2L.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > v2->v3:
> >  * Added generic description for reg.
> >  * Improved schema validation by restricting both channel and reg to [0-
> 1].
> 
> Thanks for the update!
> 
> > --- a/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
> > +++ b/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
> > @@ -19,6 +19,7 @@ properties:
> >    compatible:
> >      items:
> >        - enum:
> > +          - renesas,r9a07g043-adc   # RZ/G2UL
> >            - renesas,r9a07g044-adc   # RZ/G2L
> >            - renesas,r9a07g054-adc   # RZ/V2L
> >        - const: renesas,rzg2l-adc
> > @@ -76,16 +77,43 @@ patternProperties:
> >      properties:
> >        reg:
> >          description: |
> > -          The channel number. It can have up to 8 channels numbered from
> 0 to 7.
> > -        items:
> > -          - minimum: 0
> > -            maximum: 7
> > +          The channel number.
> >
> >      required:
> >        - reg
> >
> >      additionalProperties: false
> >
> > +allOf:
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: renesas,r9a07g043-adc
> > +    then:
> > +      patternProperties:
> > +        "^channel@[2-7]$": false
> > +        "^channel@[0-1]$":
> > +          type: object
> > +          properties:
> > +            reg:
> > +              description: |
> > +                It can have up to 2 channels numbered from 0 to 1.
> 
> IMHO the description doesn't add any value, as it's equivalent to the logic
> below.

It is suggested by Jonathan on my previous version. If there is no objection,
I can drop this.

> 
> > +              items:
> 
> I don't think the "items" is needed or wanted, as there can be only one?

It will be 2 right? eg:- reg = <0> and reg = <1>;

Without this reg index validation fails.

Cheers,
Biju

> 
> > +                - minimum: 0
> > +                  maximum: 1
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-
> m68k.org
> 
> In personal conversations with technical people, I call myself a hacker.
> But when I'm talking to journalists I just say "programmer" or something
> like that.
>                                 -- Linus Torvalds
Geert Uytterhoeven May 11, 2022, 7:52 a.m. UTC | #3
Hi Biju,

On Wed, May 11, 2022 at 9:39 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > Subject: Re: [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL
> > ADC
> > On Wed, May 11, 2022 at 9:04 AM Biju Das <biju.das.jz@bp.renesas.com>
> > wrote:
> > > Document Renesas RZ/G2UL ADC bindings. RZ/G2UL ADC is almost identical
> > > to RZ/G2L, but it has 2 analog input channels compared to 8 channels
> > > on the RZ/G2L.
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

> > > --- a/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
> > > +++ b/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
> > > @@ -19,6 +19,7 @@ properties:
> > >    compatible:
> > >      items:
> > >        - enum:
> > > +          - renesas,r9a07g043-adc   # RZ/G2UL
> > >            - renesas,r9a07g044-adc   # RZ/G2L
> > >            - renesas,r9a07g054-adc   # RZ/V2L
> > >        - const: renesas,rzg2l-adc
> > > @@ -76,16 +77,43 @@ patternProperties:
> > >      properties:
> > >        reg:
> > >          description: |
> > > -          The channel number. It can have up to 8 channels numbered from
> > 0 to 7.
> > > -        items:
> > > -          - minimum: 0
> > > -            maximum: 7
> > > +          The channel number.
> > >
> > >      required:
> > >        - reg
> > >
> > >      additionalProperties: false
> > >
> > > +allOf:
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          contains:
> > > +            const: renesas,r9a07g043-adc
> > > +    then:
> > > +      patternProperties:
> > > +        "^channel@[2-7]$": false
> > > +        "^channel@[0-1]$":
> > > +          type: object
> > > +          properties:
> > > +            reg:
> > > +              description: |
> > > +                It can have up to 2 channels numbered from 0 to 1.
> >
> > IMHO the description doesn't add any value, as it's equivalent to the logic
> > below.
>
> It is suggested by Jonathan on my previous version. If there is no objection,
> I can drop this.

OK.

> > > +              items:
> >
> > I don't think the "items" is needed or wanted, as there can be only one?
>
> It will be 2 right? eg:- reg = <0> and reg = <1>;
>
> Without this reg index validation fails.

I mean just drop the "items", but keep the rest:

    properties:
      reg:
        minimum: 0
        maximum: 1

(taken from Documentation/devicetree/bindings/ata/pata-common.yaml ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Biju Das May 11, 2022, 8:14 a.m. UTC | #4
Hi Geert,

Thanks for the feedback.

> Subject: Re: [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL
> ADC
> 
> Hi Biju,
> 
> On Wed, May 11, 2022 at 9:39 AM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > > Subject: Re: [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas
> > > RZ/G2UL ADC On Wed, May 11, 2022 at 9:04 AM Biju Das
> > > <biju.das.jz@bp.renesas.com>
> > > wrote:
> > > > Document Renesas RZ/G2UL ADC bindings. RZ/G2UL ADC is almost
> > > > identical to RZ/G2L, but it has 2 analog input channels compared
> > > > to 8 channels on the RZ/G2L.
> > > >
> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> 
> > > > ---
> > > > a/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
> > > > +++ b/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.
> > > > +++ yaml
> > > > @@ -19,6 +19,7 @@ properties:
> > > >    compatible:
> > > >      items:
> > > >        - enum:
> > > > +          - renesas,r9a07g043-adc   # RZ/G2UL
> > > >            - renesas,r9a07g044-adc   # RZ/G2L
> > > >            - renesas,r9a07g054-adc   # RZ/V2L
> > > >        - const: renesas,rzg2l-adc
> > > > @@ -76,16 +77,43 @@ patternProperties:
> > > >      properties:
> > > >        reg:
> > > >          description: |
> > > > -          The channel number. It can have up to 8 channels numbered
> from
> > > 0 to 7.
> > > > -        items:
> > > > -          - minimum: 0
> > > > -            maximum: 7
> > > > +          The channel number.
> > > >
> > > >      required:
> > > >        - reg
> > > >
> > > >      additionalProperties: false
> > > >
> > > > +allOf:
> > > > +  - if:
> > > > +      properties:
> > > > +        compatible:
> > > > +          contains:
> > > > +            const: renesas,r9a07g043-adc
> > > > +    then:
> > > > +      patternProperties:
> > > > +        "^channel@[2-7]$": false
> > > > +        "^channel@[0-1]$":
> > > > +          type: object
> > > > +          properties:
> > > > +            reg:
> > > > +              description: |
> > > > +                It can have up to 2 channels numbered from 0 to 1.
> > >
> > > IMHO the description doesn't add any value, as it's equivalent to
> > > the logic below.
> >
> > It is suggested by Jonathan on my previous version. If there is no
> > objection, I can drop this.
> 
> OK.
> 
> > > > +              items:
> > >
> > > I don't think the "items" is needed or wanted, as there can be only
> one?
> >
> > It will be 2 right? eg:- reg = <0> and reg = <1>;
> >
> > Without this reg index validation fails.
> 
> I mean just drop the "items", but keep the rest:
> 
>     properties:
>       reg:
>         minimum: 0
>         maximum: 1
> 
> (taken from Documentation/devicetree/bindings/ata/pata-common.yaml ;-)

Got it. Will send next version with these changes.

Cheers,
Biju
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml b/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
index d66c24cae1e1..6d1ff5d300e1 100644
--- a/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml
@@ -19,6 +19,7 @@  properties:
   compatible:
     items:
       - enum:
+          - renesas,r9a07g043-adc   # RZ/G2UL
           - renesas,r9a07g044-adc   # RZ/G2L
           - renesas,r9a07g054-adc   # RZ/V2L
       - const: renesas,rzg2l-adc
@@ -76,16 +77,43 @@  patternProperties:
     properties:
       reg:
         description: |
-          The channel number. It can have up to 8 channels numbered from 0 to 7.
-        items:
-          - minimum: 0
-            maximum: 7
+          The channel number.
 
     required:
       - reg
 
     additionalProperties: false
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: renesas,r9a07g043-adc
+    then:
+      patternProperties:
+        "^channel@[2-7]$": false
+        "^channel@[0-1]$":
+          type: object
+          properties:
+            reg:
+              description: |
+                It can have up to 2 channels numbered from 0 to 1.
+              items:
+                - minimum: 0
+                  maximum: 1
+    else:
+      patternProperties:
+        "^channel@[0-7]$":
+          type: object
+          properties:
+            reg:
+              description: |
+                It can have up to 8 channels numbered from 0 to 7.
+              items:
+                - minimum: 0
+                  maximum: 7
+
 additionalProperties: false
 
 examples: