Skip to contentSkip to conversation

Add support for the Renesas RZ/N1 ADC

PATCH In review Herve Codina (Schneider Electric) 4 participants 8 messages Nov 3, 2025 – Nov 10, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover Add support for the Renesas RZ/N1 ADC

Hi,

The Renesas RZ/N1 ADC controller is the ADC controller available in the Renesas RZ/N1 SoCs family.

It can use up to two internal ADC cores (ADC1 and ADC2) those internal cores are handled through ADC controller virtual channels.

Best regards,
Herve Codina

Changes v2 -> v3:

v2: https://lore.kernel.org/lkml/[email protected]/

Patch 1:
- Add 'Reviewed-by: Rob Herring'.

Patch 2:
- Add missing header files.
- Use fixed-width values for register definitions.
- Split comments and remove a redundant 'else'.
- Return the error in the 'switch case' default statement.
- Leave a trailing comma in struct iio_info.
- Move *_vref_mv to *_vref_mV.
- Split the DEFINE_RUNTIME_DEV_PM_OPS().
- Update error code handling in rzn1_adc_core_get_regulators().
- Pass rzn1_adc in platform_set_drvdata(), update suspend/resume function accordingly.
- Add 'Reviewed-by: Nuno Sá'

Patches 3 and 4:
No change.

Changes v1 -> v2:

v1: https://lore.kernel.org/lkml/[email protected]/

Rebase on top of v6.18-rc3 to have commit db82b8dbf5f0 ("PM: runtime:
Fix conditional guard definitions")

Patch 1:
- Remove unneeded 'dependencies' part.
- Rename "adc-clk" clock to "adc".
- Move 'additionalProperties: false' just before the example.
- Use const instead of enum for the "renesas,r9a06g032-adc" compatible string.
- Fix the ACD typo.

Patch 2:
- Fix the ACD typo.
- Rename "adc-clk" clock to "adc".
- Update included headers and sort them.
- Align register definitions at the same column.
- Inline the FIELD_GET() instead of having macros.
- Introduce RZN1_ADC_NO_CHANNEL
- Get Vref voltage value at probe().
- Remove the bitmap in rzn1_adc_set_iio_dev_channels().
- Use dev_err_probe() in rzn1_adc_set_iio_dev_channels().
- Use auto-cleanup variant for PM runtime "resume and get".
- Use scoped_guard() for mutex.
- Use devm_mutex_init().
- Use the fixed "rzn1-adc" string for indio_dev->name.
- Use DEFINE_RUNTIME_DEV_PM_OPS().
- Fix rzn1_adc_of_match table and remove of_match_ptr().
- Add a comment related to decoupling between IIO chans and ADC1 or ADC2 core chans
- Update and add several comments related to ADC core usage and the relationship with ADC core regulator presence.
- Remove clocks and regulators handling from PM runtime suspend()/remove().
- Simplify the driver removing the no more relevant struct rzn1_adc_core.

Patch 3:
- Rename "adc-clk" clock to "adc".
- Add 'Reviewed-by: Wolfram Sang'

Patch 4
- Removed the linux-iio list

Herve Codina (Schneider Electric) (4):
dt-bindings: iio: adc: Add the Renesas RZ/N1 ADC
iio: adc: Add support for the Renesas RZ/N1 ADC
ARM: dts: renesas: r9a06g032: Add the ADC device
MAINTAINERS: Add the Renesas RZ/N1 ADC driver entry

 .../bindings/iio/adc/renesas,rzn1-adc.yaml    | 111 ++++
 MAINTAINERS                                   |   7 +
 arch/arm/boot/dts/renesas/r9a06g032.dtsi      |  10 +
 drivers/iio/adc/Kconfig                       |  10 +
 drivers/iio/adc/Makefile                      |   1 +
 drivers/iio/adc/rzn1-adc.c                    | 490 ++++++++++++++++++
 6 files changed, 629 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/renesas,rzn1-adc.yaml
 create mode 100644 drivers/iio/adc/rzn1-adc.c
Signature · 1 line
2.51.0
#1 lore raw

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

The Renesas RZ/N1 ADC controller is the ADC controller available in the Renesas RZ/N1 SoCs family.

---
 .../bindings/iio/adc/renesas,rzn1-adc.yaml    | 111 ++++++++++++++++++
 1 file changed, 111 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/renesas,rzn1-adc.yaml
Documentation/devicetree/bindings/iio/adc/renesas,rzn1-adc.yaml new file +111 -0
new file mode 100644
index 000000000000..1a40352165fb
@@ -0,0 +1,111 @@
+# 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 <[email protected]>
+
+description:
+  The Renesas RZ/N1 ADC controller available in the Renesas RZ/N1 SoCs family
+  can use up to two internal ADC cores (ADC1 and ADC2) those internal cores are
+  handled through ADC controller virtual channels.
+
+properties:
+  compatible:
+    items:
+      - const: 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
+
+  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
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - power-domains
+  - '#io-channel-cells'
+
+# At least one of avvd/vref supplies
+anyOf:
+  - required:
+      - adc1-vref-supply
+      - adc1-avdd-supply
+  - required:
+      - adc2-vref-supply
+      - adc2-avdd-supply
+
+additionalProperties: false
+
+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";
+      power-domains = <&sysctrl>;
+      adc1-avdd-supply = <&adc1_avdd>;
+      adc1-vref-supply = <&adc1_vref>;
+      #io-channel-cells = <1>;
+    };
+...
Signature · 1 line
2.51.0
#2 lore raw

PATCH v3 2/4 iio: adc: Add support for the Renesas RZ/N1 ADC

In reply to Herve Codina (Schneider Electric)

The Renesas RZ/N1 ADC controller is the ADC controller available in the Renesas RZ/N1 SoCs family. It can use up to two internal ADC cores (ADC1 and ADC2) those internal cores are not directly accessed but are handled through ADC controller virtual channels.

---
 drivers/iio/adc/Kconfig    |  10 +
 drivers/iio/adc/Makefile   |   1 +
 drivers/iio/adc/rzn1-adc.c | 490 +++++++++++++++++++++++++++++++++++++
 3 files changed, 501 insertions(+)
 create mode 100644 drivers/iio/adc/rzn1-adc.c
drivers/iio/adc/Kconfig +10 -0
index 58a14e6833f6..113f6a5c9745 100644
@@ -1403,6 +1403,16 @@ config RZG2L_ADC
 	  To compile this driver as a module, choose M here: the
 	  module will be called rzg2l_adc.
 
+config RZN1_ADC
+	tristate "Renesas RZ/N1 ADC driver"
+	depends on ARCH_RZN1 || COMPILE_TEST
+	help
+	  Say yes here to build support for the ADC found in Renesas
+	  RZ/N1 family.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called rzn1-adc.
+
 config SC27XX_ADC
 	tristate "Spreadtrum SC27xx series PMICs ADC"
 	depends on MFD_SC27XX_PMIC || COMPILE_TEST
drivers/iio/adc/Makefile +1 -0
index d008f78dc010..ba7a8a63d070 100644
@@ -123,6 +123,7 @@ obj-$(CONFIG_ROHM_BD79112) += rohm-bd79112.o
 obj-$(CONFIG_ROHM_BD79124) += rohm-bd79124.o
 obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o
 obj-$(CONFIG_RZG2L_ADC) += rzg2l_adc.o
+obj-$(CONFIG_RZN1_ADC) += rzn1-adc.o
 obj-$(CONFIG_SC27XX_ADC) += sc27xx_adc.o
 obj-$(CONFIG_SD_ADC_MODULATOR) += sd_adc_modulator.o
 obj-$(CONFIG_SOPHGO_CV1800B_ADC) += sophgo-cv1800b-adc.o
drivers/iio/adc/rzn1-adc.c new file +490 -0

490 lines not on this page · raw message

Signature · 1 line
2.51.0
Reviewed-by on v3 2/4
#3 lore raw

Re: [PATCH v3 2/4] iio: adc: Add support for the Renesas RZ/N1 ADC

Quoted 4 lines · Herve Codina (Schneider Electric)

The Renesas RZ/N1 ADC controller is the ADC controller available in the Renesas RZ/N1 SoCs family. It can use up to two internal ADC cores (ADC1 and ADC2) those internal cores are not directly accessed but are handled through ADC controller virtual channels.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

PATCH v3 3/4 ARM: dts: renesas: r9a06g032: Add the ADC device

In reply to Herve Codina (Schneider Electric)

The ADC available in the r9a06g032 SoC can use up to two internal ADC cores (ADC1 and ADC2) those internal cores are handled through ADC controller virtual channels.

Describe this device.

---
 arch/arm/boot/dts/renesas/r9a06g032.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/renesas/r9a06g032.dtsi +10 -0
index 13a60656b044..2c1577923223 100644
@@ -290,6 +290,16 @@ i2c2: i2c@40064000 {
 			status = "disabled";
 		};
 
+		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";
+			power-domains = <&sysctrl>;
+			#io-channel-cells = <1>;
+			status = "disabled";
+		};
+
 		pinctrl: pinctrl@40067000 {
 			compatible = "renesas,r9a06g032-pinctrl", "renesas,rzn1-pinctrl";
 			reg = <0x40067000 0x1000>, <0x51000000 0x480>;
Signature · 1 line
2.51.0
Reviewed-by on v3 3/4
#5 lore raw

Re: [PATCH v3 3/4] ARM: dts: renesas: r9a06g032: Add the ADC device

Quoted 8 lines · Herve Codina (Schneider Electric)

The ADC available in the r9a06g032 SoC can use up to two internal ADC cores (ADC1 and ADC2) those internal cores are handled through ADC controller virtual channels.

Describe this device.

i.e. will queue in renesas-devel for v6.19.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
#6 lore raw

PATCH v3 4/4 MAINTAINERS: Add the Renesas RZ/N1 ADC driver entry

In reply to Herve Codina (Schneider Electric)

After contributing the driver, add myself as the maintainer for the Renesas RZ/N1 ADC driver.

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 3da2c26a796b..a67babe1a5b4 100644
@@ -21900,6 +21900,13 @@ F:	include/dt-bindings/net/pcs-rzn1-miic.h
 F:	include/linux/pcs-rzn1-miic.h
 F:	net/dsa/tag_rzn1_a5psw.c
 
+RENESAS RZ/N1 ADC DRIVER
+M:	Herve Codina <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	Documentation/devicetree/bindings/iio/adc/renesas,rzn1-adc.yaml
+F:	drivers/iio/adc/rzn1-adc.c
+
 RENESAS RZ/N1 DWMAC GLUE LAYER
 M:	Romain Gantois <[email protected]>
 S:	Maintained
Signature · 1 line
2.51.0
maintainer
#7 lore raw
In reply to Herve Codina (Schneider Electric)
Quoted 5 lines · On Mon, 3 Nov 2025 15:18:30 +0100 "Herve Codina (Schneider Electric)"…

Hi,

The Renesas RZ/N1 ADC controller is the ADC controller available in the Renesas RZ/N1 SoCs family.

Quoted 8 lines

It can use up to two internal ADC cores (ADC1 and ADC2) those internal cores are handled through ADC controller virtual channels.

Best regards,
Herve Codina

Changes v2 -> v3:

Applied 1-2,4 to the togreg branch of iio.git.
A little bit of merge noise due to another Renesas ADC driver being added recently, but only in Makefile / Kconfig so hopefully I didn't mess up merging them.

Quoted 84 lines

v2: https://lore.kernel.org/lkml/[email protected]/

Patch 1:
- Add 'Reviewed-by: Rob Herring'.

Patch 2:
- Add missing header files.
- Use fixed-width values for register definitions.
- Split comments and remove a redundant 'else'.
- Return the error in the 'switch case' default statement.
- Leave a trailing comma in struct iio_info.
- Move *_vref_mv to *_vref_mV.
- Split the DEFINE_RUNTIME_DEV_PM_OPS().
- Update error code handling in rzn1_adc_core_get_regulators().
- Pass rzn1_adc in platform_set_drvdata(), update suspend/resume function accordingly.
- Add 'Reviewed-by: Nuno Sá'

Patches 3 and 4:
No change.

Changes v1 -> v2:

v1: https://lore.kernel.org/lkml/[email protected]/

Rebase on top of v6.18-rc3 to have commit db82b8dbf5f0 ("PM: runtime:
Fix conditional guard definitions")

Patch 1:
- Remove unneeded 'dependencies' part.
- Rename "adc-clk" clock to "adc".
- Move 'additionalProperties: false' just before the example.
- Use const instead of enum for the "renesas,r9a06g032-adc" compatible string.
- Fix the ACD typo.

Patch 2:
- Fix the ACD typo.
- Rename "adc-clk" clock to "adc".
- Update included headers and sort them.
- Align register definitions at the same column.
- Inline the FIELD_GET() instead of having macros.
- Introduce RZN1_ADC_NO_CHANNEL
- Get Vref voltage value at probe().
- Remove the bitmap in rzn1_adc_set_iio_dev_channels().
- Use dev_err_probe() in rzn1_adc_set_iio_dev_channels().
- Use auto-cleanup variant for PM runtime "resume and get".
- Use scoped_guard() for mutex.
- Use devm_mutex_init().
- Use the fixed "rzn1-adc" string for indio_dev->name.
- Use DEFINE_RUNTIME_DEV_PM_OPS().
- Fix rzn1_adc_of_match table and remove of_match_ptr().
- Add a comment related to decoupling between IIO chans and ADC1 or ADC2 core chans
- Update and add several comments related to ADC core usage and the relationship with ADC core regulator presence.
- Remove clocks and regulators handling from PM runtime suspend()/remove().
- Simplify the driver removing the no more relevant struct rzn1_adc_core.

Patch 3:
- Rename "adc-clk" clock to "adc".
- Add 'Reviewed-by: Wolfram Sang'

Patch 4
- Removed the linux-iio list

Herve Codina (Schneider Electric) (4):
dt-bindings: iio: adc: Add the Renesas RZ/N1 ADC
iio: adc: Add support for the Renesas RZ/N1 ADC
ARM: dts: renesas: r9a06g032: Add the ADC device
MAINTAINERS: Add the Renesas RZ/N1 ADC driver entry

 .../bindings/iio/adc/renesas,rzn1-adc.yaml    | 111 ++++
 MAINTAINERS                                   |   7 +
 arch/arm/boot/dts/renesas/r9a06g032.dtsi      |  10 +
 drivers/iio/adc/Kconfig                       |  10 +
 drivers/iio/adc/Makefile                      |   1 +
 drivers/iio/adc/rzn1-adc.c                    | 490 ++++++++++++++++++
 6 files changed, 629 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/renesas,rzn1-adc.yaml
 create mode 100644 drivers/iio/adc/rzn1-adc.c