linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] Add RZ/G2UL ADC support
@ 2022-05-11  8:23 Biju Das
  2022-05-11  8:23 ` [PATCH v4 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC Biju Das
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Biju Das @ 2022-05-11  8:23 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().

v3->v4:
 * Removed unnecessary SoC specific reg description as it is
   equivalent to the logic used in reg.
 * Removed Items from reg.
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   | 30 ++++++++++++++++---
 drivers/iio/adc/rzg2l_adc.c                   |  3 --
 2 files changed, 26 insertions(+), 7 deletions(-)

-- 
2.25.1


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

* [PATCH v4 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC
  2022-05-11  8:23 [PATCH v4 0/2] Add RZ/G2UL ADC support Biju Das
@ 2022-05-11  8:23 ` Biju Das
  2022-05-11  9:08   ` Geert Uytterhoeven
  2022-05-14 20:35   ` Krzysztof Kozlowski
  2022-05-11  8:23 ` [PATCH v4 2/2] iio: adc: rzg2l_adc: Remove unnecessary channel check from rzg2l_adc_read_label() Biju Das
  2022-05-14 15:06 ` [PATCH v4 0/2] Add RZ/G2UL ADC support Jonathan Cameron
  2 siblings, 2 replies; 7+ messages in thread
From: Biju Das @ 2022-05-11  8:23 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>
---
v3->v4:
 * Removed unnecessary SoC specific reg description as it is
   equivalent to the logic used in reg.
 * Removed Items from reg.
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   | 30 ++++++++++++++++---
 1 file changed, 26 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..ae6226c1044e 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,37 @@ 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:
+              minimum: 0
+              maximum: 1
+    else:
+      patternProperties:
+        "^channel@[0-7]$":
+          type: object
+          properties:
+            reg:
+              minimum: 0
+              maximum: 7
+
 additionalProperties: false
 
 examples:
-- 
2.25.1


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

* [PATCH v4 2/2] iio: adc: rzg2l_adc: Remove unnecessary channel check from rzg2l_adc_read_label()
  2022-05-11  8:23 [PATCH v4 0/2] Add RZ/G2UL ADC support Biju Das
  2022-05-11  8:23 ` [PATCH v4 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC Biju Das
@ 2022-05-11  8:23 ` Biju Das
  2022-05-14 15:06 ` [PATCH v4 0/2] Add RZ/G2UL ADC support Jonathan Cameron
  2 siblings, 0 replies; 7+ messages in thread
From: Biju Das @ 2022-05-11  8:23 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>
---
v3->v4:
 * No Change.
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 v4 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC
  2022-05-11  8:23 ` [PATCH v4 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC Biju Das
@ 2022-05-11  9:08   ` Geert Uytterhoeven
  2022-05-14 20:35   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2022-05-11  9:08 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

On Wed, May 11, 2022 at 10:23 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>
> ---
> v3->v4:
>  * Removed unnecessary SoC specific reg description as it is
>    equivalent to the logic used in reg.
>  * Removed Items from reg.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

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 v4 0/2] Add RZ/G2UL ADC support
  2022-05-11  8:23 [PATCH v4 0/2] Add RZ/G2UL ADC support Biju Das
  2022-05-11  8:23 ` [PATCH v4 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC Biju Das
  2022-05-11  8:23 ` [PATCH v4 2/2] iio: adc: rzg2l_adc: Remove unnecessary channel check from rzg2l_adc_read_label() Biju Das
@ 2022-05-14 15:06 ` Jonathan Cameron
  2 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2022-05-14 15:06 UTC (permalink / raw)
  To: Biju Das
  Cc: Rob Herring, Krzysztof Kozlowski, Lad Prabhakar,
	Lars-Peter Clausen, linux-iio, linux-renesas-soc, devicetree,
	Geert Uytterhoeven, Chris Paterson, Biju Das

On Wed, 11 May 2022 09:23:23 +0100
Biju Das <biju.das.jz@bp.renesas.com> wrote:

> This patch series document ADC found on RZ/G2UL SoC and also removes
> unnecessary channel check from rzg2l_adc_read_label().
> 
> v3->v4:
>  * Removed unnecessary SoC specific reg description as it is
>    equivalent to the logic used in reg.
>  * Removed Items from reg.
> 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   | 30 ++++++++++++++++---
>  drivers/iio/adc/rzg2l_adc.c                   |  3 --
>  2 files changed, 26 insertions(+), 7 deletions(-)
> 

Looks good to me. I'll give some more time for dt-binding review before
applying though.

Thanks,

Jonathan

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

* Re: [PATCH v4 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC
  2022-05-11  8:23 ` [PATCH v4 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC Biju Das
  2022-05-11  9:08   ` Geert Uytterhoeven
@ 2022-05-14 20:35   ` Krzysztof Kozlowski
  2022-05-15  6:05     ` Biju Das
  1 sibling, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-14 20:35 UTC (permalink / raw)
  To: Biju Das, Jonathan Cameron, Rob Herring, Krzysztof Kozlowski
  Cc: Lad Prabhakar, Lars-Peter Clausen, linux-iio, linux-renesas-soc,
	devicetree, Geert Uytterhoeven, Chris Paterson, Biju Das

On 11/05/2022 10:23, Biju Das 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>
> ---
> v3->v4:
>  * Removed unnecessary SoC specific reg description as it is
>    equivalent to the logic used in reg.
>  * Removed Items from reg.
> 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   | 30 ++++++++++++++++---
>  1 file changed, 26 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..ae6226c1044e 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,37 @@ 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

The actual type was defined earlier - in your first "patternProperties"
- so this "type:object" should not be needed.

> +          properties:
> +            reg:
> +              minimum: 0
> +              maximum: 1
> +    else:
> +      patternProperties:
> +        "^channel@[0-7]$":
> +          type: object

Ditto.

With both removed:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

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

* RE: [PATCH v4 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC
  2022-05-14 20:35   ` Krzysztof Kozlowski
@ 2022-05-15  6:05     ` Biju Das
  0 siblings, 0 replies; 7+ messages in thread
From: Biju Das @ 2022-05-15  6:05 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Jonathan Cameron, Rob Herring, Krzysztof Kozlowski
  Cc: Prabhakar Mahadev Lad, Lars-Peter Clausen, linux-iio,
	linux-renesas-soc, devicetree, Geert Uytterhoeven,
	Chris Paterson, Biju Das

Hi Krzysztof Kozlowski,

Thanks for the feedback.

> Subject: Re: [PATCH v4 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL
> ADC
> 
> On 11/05/2022 10:23, Biju Das 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>
> > ---
> > v3->v4:
> >  * Removed unnecessary SoC specific reg description as it is
> >    equivalent to the logic used in reg.
> >  * Removed Items from reg.
> > 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   | 30 ++++++++++++++++---
> >  1 file changed, 26 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..ae6226c1044e 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,37 @@ 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
> 
> The actual type was defined earlier - in your first "patternProperties"
> - so this "type:object" should not be needed.

OK, fixed this one and below one and posted v5.

Thanks 
Biju

> 
> > +          properties:
> > +            reg:
> > +              minimum: 0
> > +              maximum: 1
> > +    else:
> > +      patternProperties:
> > +        "^channel@[0-7]$":
> > +          type: object
> 
> Ditto.
> 
> With both removed:
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> 
> Best regards,
> Krzysztof

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

end of thread, other threads:[~2022-05-15  6:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11  8:23 [PATCH v4 0/2] Add RZ/G2UL ADC support Biju Das
2022-05-11  8:23 ` [PATCH v4 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC Biju Das
2022-05-11  9:08   ` Geert Uytterhoeven
2022-05-14 20:35   ` Krzysztof Kozlowski
2022-05-15  6:05     ` Biju Das
2022-05-11  8:23 ` [PATCH v4 2/2] iio: adc: rzg2l_adc: Remove unnecessary channel check from rzg2l_adc_read_label() Biju Das
2022-05-14 15:06 ` [PATCH v4 0/2] Add RZ/G2UL ADC support Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).