[PATCH 1/4] dt-bindings: iio: adc: Add the Renesas RZ/N1 ADC

Herve Codina (Schneider Electric) posted 4 patches 2 months ago
There is a newer version of this series
[PATCH 1/4] dt-bindings: iio: adc: Add the Renesas RZ/N1 ADC
Posted by Herve Codina (Schneider Electric) 2 months ago
The Renesas RZ/N1 ADC controller is the ADC controller available in the
Renesas RZ/N1 SoCs family.

Signed-off-by: Herve Codina (Schneider Electric) <herve.codina@bootlin.com>
---
 .../bindings/iio/adc/renesas,rzn1-adc.yaml    | 120 ++++++++++++++++++
 1 file changed, 120 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/renesas,rzn1-adc.yaml

diff --git a/Documentation/devicetree/bindings/iio/adc/renesas,rzn1-adc.yaml b/Documentation/devicetree/bindings/iio/adc/renesas,rzn1-adc.yaml
new file mode 100644
index 000000000000..73a08eef28d9
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/renesas,rzn1-adc.yaml
@@ -0,0 +1,120 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/renesas,rzn1-adc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas RZ/N1 Analog to Digital Converter (ADC)
+
+maintainers:
+  - Herve Codina <herve.codina@bootlin.com>
+
+description:
+  The Renesas RZ/N1 ADC controller available in the Renesas RZ/N1 SoCs family
+  can use up to two internal ACD cores (ADC1 and ADC2) those internal cores are
+  handled through ADC controller virtual channels.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,r9a06g032-adc   # RZ/N1D
+      - const: renesas,rzn1-adc
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: APB internal bus clock
+      - description: ADC clock
+
+  clock-names:
+    items:
+      - const: pclk
+      - const: adc-clk
+
+  power-domains:
+    maxItems: 1
+
+  adc1-avdd-supply:
+    description:
+      ADC1 analog power supply.
+
+  adc1-vref-supply:
+    description:
+      ADC1 reference voltage supply.
+
+  adc2-avdd-supply:
+    description:
+      ADC2 analog power supply.
+
+  adc2-vref-supply:
+    description:
+      ADC2 reference voltage supply.
+
+  '#io-channel-cells':
+    const: 1
+    description: |
+      Channels numbers available:
+        if ADC1 is used (i.e. adc1-{avdd,vref}-supply present):
+          - 0: ADC1 IN0
+          - 1: ADC1 IN1
+          - 2: ADC1 IN2
+          - 3: ADC1 IN3
+          - 4: ADC1 IN4
+          - 5: ADC1 IN6
+          - 6: ADC1 IN7
+          - 7: ADC1 IN8
+        if ADC2 is used (i.e. adc2-{avdd,vref}-supply present):
+          - 8: ADC2 IN0
+          - 9: ADC2 IN1
+          - 10: ADC2 IN2
+          - 11: ADC2 IN3
+          - 12: ADC2 IN4
+          - 13: ADC2 IN6
+          - 14: ADC2 IN7
+          - 15: ADC2 IN8
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - power-domains
+  - '#io-channel-cells'
+
+dependencies:
+  # None or both adc1-avdd-supply / adc1-vref-supply should be present
+  adc1-avdd-supply: [ adc1-vref-supply ]
+  adc1-vref-supply: [ adc1-avdd-supply ]
+  # None or both adc2-avdd-supply / adc2-vref-supply should be present
+  adc2-avdd-supply: [ adc2-vref-supply ]
+  adc2-vref-supply: [ adc2-avdd-supply ]
+
+# At least one of avvd/vref supplies
+anyOf:
+  - required:
+      - adc1-vref-supply
+      - adc1-avdd-supply
+  - required:
+      - adc2-vref-supply
+      - adc2-avdd-supply
+
+examples:
+  - |
+    #include <dt-bindings/clock/r9a06g032-sysctrl.h>
+
+    adc: adc@40065000 {
+      compatible = "renesas,r9a06g032-adc", "renesas,rzn1-adc";
+      reg = <0x40065000 0x200>;
+      clocks = <&sysctrl R9A06G032_HCLK_ADC>, <&sysctrl R9A06G032_CLK_ADC>;
+      clock-names = "pclk", "adc-clk";
+      power-domains = <&sysctrl>;
+      adc1-avdd-supply = <&adc1_avdd>;
+      adc1-vref-supply = <&adc1_vref>;
+      #io-channel-cells = <1>;
+    };
+...
-- 
2.51.0
Re: [PATCH 1/4] dt-bindings: iio: adc: Add the Renesas RZ/N1 ADC
Posted by Wolfram Sang 2 months ago
> +description:
> +  The Renesas RZ/N1 ADC controller available in the Renesas RZ/N1 SoCs family
> +  can use up to two internal ACD cores (ADC1 and ADC2) those internal cores are

ADC cores?

> +  handled through ADC controller virtual channels.
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - renesas,r9a06g032-adc   # RZ/N1D
> +      - const: renesas,rzn1-adc

Do you know of other SoCs with this IP core? If it is only RZ/N for now,
we could go with const for N1D. All other N1 variants cannot run Linux
because of no SDRAM controller.

Re: [PATCH 1/4] dt-bindings: iio: adc: Add the Renesas RZ/N1 ADC
Posted by Herve Codina 2 months ago
On Thu, 16 Oct 2025 19:17:30 +0200
Wolfram Sang <wsa+renesas@sang-engineering.com> wrote:

> > +description:
> > +  The Renesas RZ/N1 ADC controller available in the Renesas RZ/N1 SoCs family
> > +  can use up to two internal ACD cores (ADC1 and ADC2) those internal cores are  
> 
> ADC cores?

Sure, will be fixed.

> 
> > +  handled through ADC controller virtual channels.
> > +
> > +properties:
> > +  compatible:
> > +    items:
> > +      - enum:
> > +          - renesas,r9a06g032-adc   # RZ/N1D
> > +      - const: renesas,rzn1-adc  
> 
> Do you know of other SoCs with this IP core? If it is only RZ/N for now,
> we could go with const for N1D. All other N1 variants cannot run Linux
> because of no SDRAM controller.
> 

I know only about RZ/N1 family.

I will keep only "renesas,r9a06g032-adc" in the next iteration.

Best regards,
Hervé
Re: [PATCH 1/4] dt-bindings: iio: adc: Add the Renesas RZ/N1 ADC
Posted by Herve Codina 1 month, 3 weeks ago
Hi Wolfram, Geert,

On Fri, 17 Oct 2025 09:07:42 +0200
Herve Codina <herve.codina@bootlin.com> wrote:

> > > +
> > > +properties:
> > > +  compatible:
> > > +    items:
> > > +      - enum:
> > > +          - renesas,r9a06g032-adc   # RZ/N1D
> > > +      - const: renesas,rzn1-adc    
> > 
> > Do you know of other SoCs with this IP core? If it is only RZ/N for now,
> > we could go with const for N1D. All other N1 variants cannot run Linux
> > because of no SDRAM controller.
> >   
> 
> I know only about RZ/N1 family.
> 
> I will keep only "renesas,r9a06g032-adc" in the next iteration.
> 

May be I misunderstood.

Most of other bindings related to rzn1d have the both r9a06g032 and
rzn1 compatible string.


Would you expect:

  - a) renesas,r9a06g032-adc and renesas,rzn1-adc

    compatible:
      items:
        - const: renesas,r9a06g032-adc   # RZ/N1D
        - const: renesas,rzn1-adc

or

 - b) renesas,r9a06g032-adc only

    compatible:
      const: renesas,r9a06g032-adc

Can you confirm your expectation?

Best regards,
Hervé
Re: [PATCH 1/4] dt-bindings: iio: adc: Add the Renesas RZ/N1 ADC
Posted by Wolfram Sang 1 month, 3 weeks ago
>     compatible:
>       items:
>         - const: renesas,r9a06g032-adc   # RZ/N1D
>         - const: renesas,rzn1-adc

This. Just switch from a forever-single enum to a const for the first
entry.

Re: [PATCH 1/4] dt-bindings: iio: adc: Add the Renesas RZ/N1 ADC
Posted by Krzysztof Kozlowski 2 months ago
On 15/10/2025 16:28, Herve Codina (Schneider Electric) wrote:
> +  clocks:
> +    items:
> +      - description: APB internal bus clock
> +      - description: ADC clock
> +
> +  clock-names:
> +    items:
> +      - const: pclk
> +      - const: adc-clk

Just 'adc'

clk is redundant

> +
> +  power-domains:
> +    maxItems: 1
> +
> +  adc1-avdd-supply:
> +    description:
> +      ADC1 analog power supply.
> +
> +  adc1-vref-supply:
> +    description:
> +      ADC1 reference voltage supply.
> +
> +  adc2-avdd-supply:
> +    description:
> +      ADC2 analog power supply.
> +
> +  adc2-vref-supply:
> +    description:
> +      ADC2 reference voltage supply.
> +
> +  '#io-channel-cells':
> +    const: 1
> +    description: |
> +      Channels numbers available:
> +        if ADC1 is used (i.e. adc1-{avdd,vref}-supply present):
> +          - 0: ADC1 IN0
> +          - 1: ADC1 IN1
> +          - 2: ADC1 IN2
> +          - 3: ADC1 IN3
> +          - 4: ADC1 IN4
> +          - 5: ADC1 IN6
> +          - 6: ADC1 IN7
> +          - 7: ADC1 IN8
> +        if ADC2 is used (i.e. adc2-{avdd,vref}-supply present):
> +          - 8: ADC2 IN0
> +          - 9: ADC2 IN1
> +          - 10: ADC2 IN2
> +          - 11: ADC2 IN3
> +          - 12: ADC2 IN4
> +          - 13: ADC2 IN6
> +          - 14: ADC2 IN7
> +          - 15: ADC2 IN8
> +
> +additionalProperties: false

This goes just before example
> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - clock-names
> +  - power-domains
> +  - '#io-channel-cells'
> +
> +dependencies:
> +  # None or both adc1-avdd-supply / adc1-vref-supply should be present
> +  adc1-avdd-supply: [ adc1-vref-supply ]
> +  adc1-vref-supply: [ adc1-avdd-supply ]
> +  # None or both adc2-avdd-supply / adc2-vref-supply should be present
> +  adc2-avdd-supply: [ adc2-vref-supply ]
> +  adc2-vref-supply: [ adc2-avdd-supply ]

Above seems unnecessary. The anyOf below should already enforce that, no?

> +
> +# At least one of avvd/vref supplies
> +anyOf:
> +  - required:
> +      - adc1-vref-supply
> +      - adc1-avdd-supply
> +  - required:
> +      - adc2-vref-supply
> +      - adc2-avdd-supply
> +



Best regards,
Krzysztof
Re: [PATCH 1/4] dt-bindings: iio: adc: Add the Renesas RZ/N1 ADC
Posted by Herve Codina 2 months ago
Hi Krzysztof,

On Thu, 16 Oct 2025 17:49:33 +0200
Krzysztof Kozlowski <krzk@kernel.org> wrote:

> On 15/10/2025 16:28, Herve Codina (Schneider Electric) wrote:
> > +  clocks:
> > +    items:
> > +      - description: APB internal bus clock
> > +      - description: ADC clock
> > +
> > +  clock-names:
> > +    items:
> > +      - const: pclk
> > +      - const: adc-clk  
> 
> Just 'adc'
> 
> clk is redundant

Ok, will be update.

...

> > +
> > +additionalProperties: false  
> 
> This goes just before example

Ok, will be update

> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - clocks
> > +  - clock-names
> > +  - power-domains
> > +  - '#io-channel-cells'
> > +
> > +dependencies:
> > +  # None or both adc1-avdd-supply / adc1-vref-supply should be present
> > +  adc1-avdd-supply: [ adc1-vref-supply ]
> > +  adc1-vref-supply: [ adc1-avdd-supply ]
> > +  # None or both adc2-avdd-supply / adc2-vref-supply should be present
> > +  adc2-avdd-supply: [ adc2-vref-supply ]
> > +  adc2-vref-supply: [ adc2-avdd-supply ]  
> 
> Above seems unnecessary. The anyOf below should already enforce that, no?

Yes, I will remove the above dependencies and keep only the anyOf.

> 
> > +
> > +# At least one of avvd/vref supplies
> > +anyOf:
> > +  - required:
> > +      - adc1-vref-supply
> > +      - adc1-avdd-supply
> > +  - required:
> > +      - adc2-vref-supply
> > +      - adc2-avdd-supply
> > +  
> 

Best regards,
Hervé