All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Add RZ/G2UL ADC support
@ 2022-05-11  7:04 Biju Das
  2022-05-11  7:04 ` [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC Biju Das
  2022-05-11  7:04 ` [PATCH v3 2/2] iio: adc: rzg2l_adc: Remove unnecessary channel check from rzg2l_adc_read_label() Biju Das
  0 siblings, 2 replies; 7+ messages in thread
From: Biju Das @ 2022-05-11  7:04 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski
  Cc: Biju Das, Lad Prabhakar, Lars-Peter Clausen, linux-iio,
	linux-renesas-soc, devicetree, Geert Uytterhoeven,
	Chris Paterson, Biju Das

This patch series document ADC found on RZ/G2UL SoC and also removes
unnecessary channel check from rzg2l_adc_read_label().

v2->v3:
 * Added generic description for reg.
 * Improved schema validation by restricting both channel and reg to [0-1].
 * Added Rb tag from Geert.

v1->v2:
 * Started using generic compatible for RZ/G2UL and added SoC specific validation
   for number of supported channels.

Biju Das (2):
  dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC
  iio: adc: rzg2l_adc: Remove unnecessary channel check from
    rzg2l_adc_read_label()

 .../bindings/iio/adc/renesas,rzg2l-adc.yaml   | 36 ++++++++++++++++---
 drivers/iio/adc/rzg2l_adc.c                   |  3 --
 2 files changed, 32 insertions(+), 7 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC
  2022-05-11  7:04 [PATCH v3 0/2] Add RZ/G2UL ADC support Biju Das
@ 2022-05-11  7:04 ` Biju Das
  2022-05-11  7:13   ` Geert Uytterhoeven
  2022-05-11  7:04 ` [PATCH v3 2/2] iio: adc: rzg2l_adc: Remove unnecessary channel check from rzg2l_adc_read_label() Biju Das
  1 sibling, 1 reply; 7+ messages in thread
From: Biju Das @ 2022-05-11  7:04 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski
  Cc: Biju Das, Lad Prabhakar, Lars-Peter Clausen, linux-iio,
	linux-renesas-soc, devicetree, Geert Uytterhoeven,
	Chris Paterson, Biju Das

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(-)

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:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 2/2] iio: adc: rzg2l_adc: Remove unnecessary channel check from rzg2l_adc_read_label()
  2022-05-11  7:04 [PATCH v3 0/2] Add RZ/G2UL ADC support Biju Das
  2022-05-11  7:04 ` [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC Biju Das
@ 2022-05-11  7:04 ` Biju Das
  1 sibling, 0 replies; 7+ messages in thread
From: Biju Das @ 2022-05-11  7:04 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Biju Das, Lad Prabhakar, Lars-Peter Clausen, linux-iio,
	linux-renesas-soc, Geert Uytterhoeven, Chris Paterson, Biju Das

Remove unnecessary channel check from rzg2l_adc_read_label(), as the
channel error handling is already done in probe(). Therefore no need to
validate at runtime.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2->v3:
 * Added Rb tag from Geert.
v2:
 * New patch
---
 drivers/iio/adc/rzg2l_adc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c
index 7585144b9715..bee5f9861acb 100644
--- a/drivers/iio/adc/rzg2l_adc.c
+++ b/drivers/iio/adc/rzg2l_adc.c
@@ -260,9 +260,6 @@ static int rzg2l_adc_read_label(struct iio_dev *iio_dev,
 				const struct iio_chan_spec *chan,
 				char *label)
 {
-	if (chan->channel >= RZG2L_ADC_MAX_CHANNELS)
-		return -EINVAL;
-
 	return sysfs_emit(label, "%s\n", rzg2l_adc_channel_name[chan->channel]);
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC
  2022-05-11  7:04 ` [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC Biju Das
@ 2022-05-11  7:13   ` Geert Uytterhoeven
  2022-05-11  7:39     ` Biju Das
  0 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2022-05-11  7:13 UTC (permalink / raw)
  To: Biju Das
  Cc: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski,
	Lad Prabhakar, Lars-Peter Clausen, linux-iio, Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Geert Uytterhoeven, Chris Paterson, Biju Das

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC
  2022-05-11  7:13   ` Geert Uytterhoeven
@ 2022-05-11  7:39     ` Biju Das
  2022-05-11  7:52       ` Geert Uytterhoeven
  0 siblings, 1 reply; 7+ messages in thread
From: Biju Das @ 2022-05-11  7:39 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski,
	Prabhakar Mahadev Lad, Lars-Peter Clausen, linux-iio,
	Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Geert Uytterhoeven, Chris Paterson, Biju Das

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC
  2022-05-11  7:39     ` Biju Das
@ 2022-05-11  7:52       ` Geert Uytterhoeven
  2022-05-11  8:14         ` Biju Das
  0 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2022-05-11  7:52 UTC (permalink / raw)
  To: Biju Das
  Cc: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski,
	Prabhakar Mahadev Lad, Lars-Peter Clausen, linux-iio,
	Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Geert Uytterhoeven, Chris Paterson, Biju Das

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC
  2022-05-11  7:52       ` Geert Uytterhoeven
@ 2022-05-11  8:14         ` Biju Das
  0 siblings, 0 replies; 7+ messages in thread
From: Biju Das @ 2022-05-11  8:14 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Jonathan Cameron, Rob Herring, Krzysztof Kozlowski,
	Prabhakar Mahadev Lad, Lars-Peter Clausen, linux-iio,
	Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Geert Uytterhoeven, Chris Paterson, Biju Das

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-11  8:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11  7:04 [PATCH v3 0/2] Add RZ/G2UL ADC support Biju Das
2022-05-11  7:04 ` [PATCH v3 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC Biju Das
2022-05-11  7:13   ` Geert Uytterhoeven
2022-05-11  7:39     ` Biju Das
2022-05-11  7:52       ` Geert Uytterhoeven
2022-05-11  8:14         ` Biju Das
2022-05-11  7:04 ` [PATCH v3 2/2] iio: adc: rzg2l_adc: Remove unnecessary channel check from rzg2l_adc_read_label() Biju Das

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.