* [PATCH 0/3] Add GPADC support for A523
@ 2026-05-10 12:57 Michal Piekos
2026-05-10 12:57 ` [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523 Michal Piekos
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Michal Piekos @ 2026-05-10 12:57 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Maksim Kiselev
Cc: linux-iio, devicetree, linux-arm-kernel, linux-sunxi,
linux-kernel, Michal Piekos
Add support for Allwinner A523 GPADC in sun20i gpadc driver and describe
corresponding node in dts for A523 SoC.
A523 uses same model as existing driver except it has two clocks.
Added support to enable more than one clock in the driver, extended the
binding with new compatible and wired up dts node for A523 which uses D1
as fallback compatible.
Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
---
Michal Piekos (3):
dt-bindings: iio: adc: Add GPADC for Allwinner A523
iio: adc: sun20i-gpadc: add A523 gpadc support
arm64: dts: allwinner: a523: add gpadc node
.../iio/adc/allwinner,sun20i-d1-gpadc.yaml | 37 +++++++++++++++++++++-
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi | 12 +++++++
drivers/iio/adc/sun20i-gpadc-iio.c | 8 ++---
3 files changed, 52 insertions(+), 5 deletions(-)
---
base-commit: 8ab992f815d6736b5c7a6f5fd7bfe7bc106bb3dc
change-id: 20260507-sunxi-a523-gpadc-1879aa5df754
Best regards,
--
Michal Piekos <michal.piekos@mmpsystems.pl>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523
2026-05-10 12:57 [PATCH 0/3] Add GPADC support for A523 Michal Piekos
@ 2026-05-10 12:57 ` Michal Piekos
2026-05-10 14:29 ` Rob Herring (Arm)
` (2 more replies)
2026-05-10 12:57 ` [PATCH 2/3] iio: adc: sun20i-gpadc: add A523 gpadc support Michal Piekos
2026-05-10 12:57 ` [PATCH 3/3] arm64: dts: allwinner: a523: add gpadc node Michal Piekos
2 siblings, 3 replies; 12+ messages in thread
From: Michal Piekos @ 2026-05-10 12:57 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Maksim Kiselev
Cc: linux-iio, devicetree, linux-arm-kernel, linux-sunxi,
linux-kernel, Michal Piekos
Add support for the GPADC for the Allwinner A523. It differs from the
D1/T113s/R329/T507 by having two clocks.
Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
---
.../iio/adc/allwinner,sun20i-d1-gpadc.yaml | 37 +++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml b/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
index da605a051b94..89da96cd705f 100644
--- a/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
@@ -17,6 +17,7 @@ properties:
- items:
- enum:
- allwinner,sun50i-h616-gpadc
+ - allwinner,sun55i-a523-gpadc
- const: allwinner,sun20i-d1-gpadc
"#io-channel-cells":
@@ -29,7 +30,12 @@ properties:
const: 0
clocks:
- maxItems: 1
+ minItems: 1
+ maxItems: 2
+
+ clock-names:
+ minItems: 1
+ maxItems: 2
interrupts:
maxItems: 1
@@ -40,6 +46,35 @@ properties:
resets:
maxItems: 1
+allOf:
+ - if:
+ properties:
+ compatible:
+ items:
+ - const: allwinner,sun55i-a523-gpadc
+ - const: allwinner,sun20i-d1-gpadc
+ then:
+ properties:
+ clocks:
+ minItems: 2
+ maxItems: 2
+ items:
+ - description: Bus clock
+ - description: Module clock
+ clock-names:
+ minItems: 2
+ maxItems: 2
+ items:
+ - const: bus
+ - const: mod
+ required:
+ - clock-names
+ else:
+ properties:
+ clocks:
+ maxItems: 1
+ clock-names: false
+
patternProperties:
"^channel@[0-9a-f]+$":
$ref: adc.yaml
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/3] iio: adc: sun20i-gpadc: add A523 gpadc support
2026-05-10 12:57 [PATCH 0/3] Add GPADC support for A523 Michal Piekos
2026-05-10 12:57 ` [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523 Michal Piekos
@ 2026-05-10 12:57 ` Michal Piekos
2026-05-12 11:51 ` Jonathan Cameron
2026-05-10 12:57 ` [PATCH 3/3] arm64: dts: allwinner: a523: add gpadc node Michal Piekos
2 siblings, 1 reply; 12+ messages in thread
From: Michal Piekos @ 2026-05-10 12:57 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Maksim Kiselev
Cc: linux-iio, devicetree, linux-arm-kernel, linux-sunxi,
linux-kernel, Michal Piekos
A523 differs from existing sun20i-gpadc-iio by having two clocks; bus
clock and module clock.
Change driver to enable all clocks.
Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
---
drivers/iio/adc/sun20i-gpadc-iio.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/adc/sun20i-gpadc-iio.c b/drivers/iio/adc/sun20i-gpadc-iio.c
index 861c14da75ad..dd4c7e6e3d76 100644
--- a/drivers/iio/adc/sun20i-gpadc-iio.c
+++ b/drivers/iio/adc/sun20i-gpadc-iio.c
@@ -180,7 +180,7 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
struct iio_dev *indio_dev;
struct sun20i_gpadc_iio *info;
struct reset_control *rst;
- struct clk *clk;
+ struct clk_bulk_data *clks;
int irq;
int ret;
@@ -205,9 +205,9 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
if (IS_ERR(info->regs))
return PTR_ERR(info->regs);
- clk = devm_clk_get_enabled(dev, NULL);
- if (IS_ERR(clk))
- return dev_err_probe(dev, PTR_ERR(clk), "failed to enable bus clock\n");
+ ret = devm_clk_bulk_get_all_enabled(dev, &clks);
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "failed to enable clocks\n");
rst = devm_reset_control_get_exclusive(dev, NULL);
if (IS_ERR(rst))
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/3] arm64: dts: allwinner: a523: add gpadc node
2026-05-10 12:57 [PATCH 0/3] Add GPADC support for A523 Michal Piekos
2026-05-10 12:57 ` [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523 Michal Piekos
2026-05-10 12:57 ` [PATCH 2/3] iio: adc: sun20i-gpadc: add A523 gpadc support Michal Piekos
@ 2026-05-10 12:57 ` Michal Piekos
2026-05-10 14:39 ` Jernej Škrabec
2026-05-10 18:34 ` Chen-Yu Tsai
2 siblings, 2 replies; 12+ messages in thread
From: Michal Piekos @ 2026-05-10 12:57 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Maksim Kiselev
Cc: linux-iio, devicetree, linux-arm-kernel, linux-sunxi,
linux-kernel, Michal Piekos
Describe high speed timer block on Allwinner D1S-T113.
Tested on Radxa Cubie A5E:
- 2 connected channels are showing voltages in agreement with
schematics.
BOOT-SEL-ADC ~500mV
BOM-ADC ~1800mV
- 3rd channel exposed on 40pin header is showing correct voltages when
connected to known voltage source.
Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
---
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
index 5afa8d92acbf..f6c5cae5b23a 100644
--- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
@@ -340,6 +340,18 @@ ledc: led-controller@2008000 {
status = "disabled";
};
+ gpadc: adc@2009000 {
+ compatible = "allwinner,sun55i-a523-gpadc",
+ "allwinner,sun20i-d1-gpadc";
+ reg = <0x2009000 0x400>;
+ clocks = <&ccu CLK_BUS_GPADC0>, <&ccu CLK_GPADC0>;
+ clock-names = "bus", "mod";
+ resets = <&ccu RST_BUS_GPADC0>;
+ interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
+ status = "disabled";
+ #io-channel-cells = <1>;
+ };
+
wdt: watchdog@2050000 {
compatible = "allwinner,sun55i-a523-wdt";
reg = <0x2050000 0x20>;
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523
2026-05-10 12:57 ` [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523 Michal Piekos
@ 2026-05-10 14:29 ` Rob Herring (Arm)
2026-05-10 14:40 ` Jernej Škrabec
2026-05-11 16:02 ` Andre Przywara
2 siblings, 0 replies; 12+ messages in thread
From: Rob Herring (Arm) @ 2026-05-10 14:29 UTC (permalink / raw)
To: Michal Piekos
Cc: linux-arm-kernel, Samuel Holland, Chen-Yu Tsai, linux-kernel,
Conor Dooley, Jonathan Cameron, Maksim Kiselev, Andy Shevchenko,
David Lechner, Jernej Skrabec, Krzysztof Kozlowski, linux-iio,
linux-sunxi, Nuno Sá, devicetree
On Sun, 10 May 2026 14:57:22 +0200, Michal Piekos wrote:
> Add support for the GPADC for the Allwinner A523. It differs from the
> D1/T113s/R329/T507 by having two clocks.
>
> Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> ---
> .../iio/adc/allwinner,sun20i-d1-gpadc.yaml | 37 +++++++++++++++++++++-
> 1 file changed, 36 insertions(+), 1 deletion(-)
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml: allOf:0:then:properties:clocks: {'minItems': 2, 'maxItems': 2, 'items': [{'description': 'Bus clock'}, {'description': 'Module clock'}]} should not be valid under {'required': ['maxItems']}
hint: "maxItems" is not needed with an "items" list
from schema $id: http://devicetree.org/meta-schemas/items.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml: allOf:0:then:properties:clocks: 'oneOf' conditional failed, one must be fixed:
False schema does not allow 2
[{'description': 'Bus clock'}, {'description': 'Module clock'}] is too long
[{'description': 'Bus clock'}, {'description': 'Module clock'}] is too short
1 was expected
hint: "minItems" is only needed if less than the "items" list length
from schema $id: http://devicetree.org/meta-schemas/items.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml: allOf:0:then:properties:clock-names: {'minItems': 2, 'maxItems': 2, 'items': [{'const': 'bus'}, {'const': 'mod'}]} should not be valid under {'required': ['maxItems']}
hint: "maxItems" is not needed with an "items" list
from schema $id: http://devicetree.org/meta-schemas/items.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml: allOf:0:then:properties:clock-names: 'oneOf' conditional failed, one must be fixed:
False schema does not allow 2
[{'const': 'bus'}, {'const': 'mod'}] is too long
[{'const': 'bus'}, {'const': 'mod'}] is too short
1 was expected
hint: "minItems" is only needed if less than the "items" list length
from schema $id: http://devicetree.org/meta-schemas/items.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.kernel.org/project/devicetree/patch/20260510-sunxi-a523-gpadc-v1-1-4f6b0f4000fb@mmpsystems.pl
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] arm64: dts: allwinner: a523: add gpadc node
2026-05-10 12:57 ` [PATCH 3/3] arm64: dts: allwinner: a523: add gpadc node Michal Piekos
@ 2026-05-10 14:39 ` Jernej Škrabec
2026-05-10 18:34 ` Chen-Yu Tsai
1 sibling, 0 replies; 12+ messages in thread
From: Jernej Škrabec @ 2026-05-10 14:39 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
Samuel Holland, Maksim Kiselev, Michal Piekos
Cc: linux-iio, devicetree, linux-arm-kernel, linux-sunxi,
linux-kernel, Michal Piekos
Dne nedelja, 10. maj 2026 ob 14:57:24 Srednjeevropski poletni čas je Michal Piekos napisal(a):
> Describe high speed timer block on Allwinner D1S-T113.
Above line doesn't make much sense.
Best regards,
Jernej
>
> Tested on Radxa Cubie A5E:
> - 2 connected channels are showing voltages in agreement with
> schematics.
> BOOT-SEL-ADC ~500mV
> BOM-ADC ~1800mV
> - 3rd channel exposed on 40pin header is showing correct voltages when
> connected to known voltage source.
>
> Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> ---
> arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> index 5afa8d92acbf..f6c5cae5b23a 100644
> --- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> @@ -340,6 +340,18 @@ ledc: led-controller@2008000 {
> status = "disabled";
> };
>
> + gpadc: adc@2009000 {
> + compatible = "allwinner,sun55i-a523-gpadc",
> + "allwinner,sun20i-d1-gpadc";
> + reg = <0x2009000 0x400>;
> + clocks = <&ccu CLK_BUS_GPADC0>, <&ccu CLK_GPADC0>;
> + clock-names = "bus", "mod";
> + resets = <&ccu RST_BUS_GPADC0>;
> + interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
> + status = "disabled";
> + #io-channel-cells = <1>;
> + };
> +
> wdt: watchdog@2050000 {
> compatible = "allwinner,sun55i-a523-wdt";
> reg = <0x2050000 0x20>;
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523
2026-05-10 12:57 ` [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523 Michal Piekos
2026-05-10 14:29 ` Rob Herring (Arm)
@ 2026-05-10 14:40 ` Jernej Škrabec
2026-05-11 16:02 ` Andre Przywara
2 siblings, 0 replies; 12+ messages in thread
From: Jernej Škrabec @ 2026-05-10 14:40 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
Samuel Holland, Maksim Kiselev, Michal Piekos
Cc: linux-iio, devicetree, linux-arm-kernel, linux-sunxi,
linux-kernel, Michal Piekos
Dne nedelja, 10. maj 2026 ob 14:57:22 Srednjeevropski poletni čas je Michal Piekos napisal(a):
> Add support for the GPADC for the Allwinner A523. It differs from the
> D1/T113s/R329/T507 by having two clocks.
>
> Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> ---
> .../iio/adc/allwinner,sun20i-d1-gpadc.yaml | 37 +++++++++++++++++++++-
> 1 file changed, 36 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml b/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
> index da605a051b94..89da96cd705f 100644
> --- a/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
> @@ -17,6 +17,7 @@ properties:
> - items:
> - enum:
> - allwinner,sun50i-h616-gpadc
> + - allwinner,sun55i-a523-gpadc
It shouldn't be combined if it has different number of clocks.
Best regards,
Jernej
> - const: allwinner,sun20i-d1-gpadc
>
> "#io-channel-cells":
> @@ -29,7 +30,12 @@ properties:
> const: 0
>
> clocks:
> - maxItems: 1
> + minItems: 1
> + maxItems: 2
> +
> + clock-names:
> + minItems: 1
> + maxItems: 2
>
> interrupts:
> maxItems: 1
> @@ -40,6 +46,35 @@ properties:
> resets:
> maxItems: 1
>
> +allOf:
> + - if:
> + properties:
> + compatible:
> + items:
> + - const: allwinner,sun55i-a523-gpadc
> + - const: allwinner,sun20i-d1-gpadc
> + then:
> + properties:
> + clocks:
> + minItems: 2
> + maxItems: 2
> + items:
> + - description: Bus clock
> + - description: Module clock
> + clock-names:
> + minItems: 2
> + maxItems: 2
> + items:
> + - const: bus
> + - const: mod
> + required:
> + - clock-names
> + else:
> + properties:
> + clocks:
> + maxItems: 1
> + clock-names: false
> +
> patternProperties:
> "^channel@[0-9a-f]+$":
> $ref: adc.yaml
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] arm64: dts: allwinner: a523: add gpadc node
2026-05-10 12:57 ` [PATCH 3/3] arm64: dts: allwinner: a523: add gpadc node Michal Piekos
2026-05-10 14:39 ` Jernej Škrabec
@ 2026-05-10 18:34 ` Chen-Yu Tsai
1 sibling, 0 replies; 12+ messages in thread
From: Chen-Yu Tsai @ 2026-05-10 18:34 UTC (permalink / raw)
To: Michal Piekos
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jernej Skrabec,
Samuel Holland, Maksim Kiselev, linux-iio, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel
On Sun, May 10, 2026 at 9:02 PM Michal Piekos
<michal.piekos@mmpsystems.pl> wrote:
>
> Describe high speed timer block on Allwinner D1S-T113.
>
> Tested on Radxa Cubie A5E:
> - 2 connected channels are showing voltages in agreement with
> schematics.
> BOOT-SEL-ADC ~500mV
> BOM-ADC ~1800mV
> - 3rd channel exposed on 40pin header is showing correct voltages when
> connected to known voltage source.
>
> Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> ---
> arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> index 5afa8d92acbf..f6c5cae5b23a 100644
> --- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi
> @@ -340,6 +340,18 @@ ledc: led-controller@2008000 {
> status = "disabled";
> };
>
> + gpadc: adc@2009000 {
> + compatible = "allwinner,sun55i-a523-gpadc",
> + "allwinner,sun20i-d1-gpadc";
> + reg = <0x2009000 0x400>;
> + clocks = <&ccu CLK_BUS_GPADC0>, <&ccu CLK_GPADC0>;
> + clock-names = "bus", "mod";
> + resets = <&ccu RST_BUS_GPADC0>;
> + interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
> + status = "disabled";
> + #io-channel-cells = <1>;
status should always be the last property.
> + };
> +
> wdt: watchdog@2050000 {
> compatible = "allwinner,sun55i-a523-wdt";
> reg = <0x2050000 0x20>;
>
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523
2026-05-10 12:57 ` [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523 Michal Piekos
2026-05-10 14:29 ` Rob Herring (Arm)
2026-05-10 14:40 ` Jernej Škrabec
@ 2026-05-11 16:02 ` Andre Przywara
2026-05-12 3:56 ` Michal Piekos
2 siblings, 1 reply; 12+ messages in thread
From: Andre Przywara @ 2026-05-11 16:02 UTC (permalink / raw)
To: Michal Piekos, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Maksim Kiselev
Cc: linux-iio, devicetree, linux-arm-kernel, linux-sunxi,
linux-kernel
Hi Michal,
thanks for adding this!
On 5/10/26 14:57, Michal Piekos wrote:
> Add support for the GPADC for the Allwinner A523. It differs from the
> D1/T113s/R329/T507 by having two clocks.
>
> Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> ---
> .../iio/adc/allwinner,sun20i-d1-gpadc.yaml | 37 +++++++++++++++++++++-
> 1 file changed, 36 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml b/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
> index da605a051b94..89da96cd705f 100644
> --- a/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
> @@ -17,6 +17,7 @@ properties:
> - items:
> - enum:
> - allwinner,sun50i-h616-gpadc
> + - allwinner,sun55i-a523-gpadc
> - const: allwinner,sun20i-d1-gpadc
As Jernej already mentioned, the A523 GPADC is not fully compatible,
since it adds another clock. The question to ask is: Can a driver only
knowing about the fallback device handle this new device? For which the
answer here is: No, it misses a clock.
So add just a single entry for the A523 (plus adding it to the driver).
So looking at this I wonder if we should add some property to describe
the number of supported channels, since they are slightly different
between the SoCs:
- The D1 manual mentions 2 channels.
- The T113s manual (same die as the D1?) describes 1 channel only.
- The T507 manual (same die as the H616) reports 4 channels.
- The A733 has 6 channels.
- The A133 has 1 channel, but it's channel 1, not 0.
So all of this is somewhat covered as channels are described as child
nodes, and have a reg property. Ideally non-existing channels just
wouldn't be listed, but I don't know if we want to rely on that.
So I am wondering if we should introduce a limit, or rather a mask (to
cover the A133 oddity)?
Either a DT property (channel-mask, as a single sell representing the
bit mask), or derived in the driver from the compatible string.
The former would avoid introducing different compatible strings just
because of that, though I think this type of property is somewhat
discouraged?
Any thoughts?
>
> "#io-channel-cells":
> @@ -29,7 +30,12 @@ properties:
> const: 0
>
> clocks:
> - maxItems: 1
> + minItems: 1
> + maxItems: 2
> +
> + clock-names:
> + minItems: 1
> + maxItems: 2
>
> interrupts:
> maxItems: 1
> @@ -40,6 +46,35 @@ properties:
> resets:
> maxItems: 1
>
> +allOf:
> + - if:
> + properties:
> + compatible:
> + items:
> + - const: allwinner,sun55i-a523-gpadc
> + - const: allwinner,sun20i-d1-gpadc
> + then:
> + properties:
> + clocks:
> + minItems: 2
> + maxItems: 2
> + items:
> + - description: Bus clock
> + - description: Module clock
I am not a YAML expert, but I think you can drop the min and max
properties, if you just enumerate the cases. Same for the names.
Cheers,
Andre
> + clock-names:
> + minItems: 2
> + maxItems: 2
> + items:
> + - const: bus
> + - const: mod
> + required:
> + - clock-names
> + else:
> + properties:
> + clocks:
> + maxItems: 1
> + clock-names: false
> +
> patternProperties:
> "^channel@[0-9a-f]+$":
> $ref: adc.yaml
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523
2026-05-11 16:02 ` Andre Przywara
@ 2026-05-12 3:56 ` Michal Piekos
0 siblings, 0 replies; 12+ messages in thread
From: Michal Piekos @ 2026-05-12 3:56 UTC (permalink / raw)
To: Andre Przywara
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Maksim Kiselev, linux-iio,
devicetree, linux-arm-kernel, linux-sunxi, linux-kernel
On Mon, May 11, 2026 at 06:02:16PM +0200, Andre Przywara wrote:
> Hi Michal,
>
> thanks for adding this!
>
> On 5/10/26 14:57, Michal Piekos wrote:
> > Add support for the GPADC for the Allwinner A523. It differs from the
> > D1/T113s/R329/T507 by having two clocks.
> >
> > Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> > ---
> > .../iio/adc/allwinner,sun20i-d1-gpadc.yaml | 37 +++++++++++++++++++++-
> > 1 file changed, 36 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml b/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
> > index da605a051b94..89da96cd705f 100644
> > --- a/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
> > +++ b/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
> > @@ -17,6 +17,7 @@ properties:
> > - items:
> > - enum:
> > - allwinner,sun50i-h616-gpadc
> > + - allwinner,sun55i-a523-gpadc
> > - const: allwinner,sun20i-d1-gpadc
>
> As Jernej already mentioned, the A523 GPADC is not fully compatible, since
> it adds another clock. The question to ask is: Can a driver only knowing
> about the fallback device handle this new device? For which the answer here
> is: No, it misses a clock.
> So add just a single entry for the A523 (plus adding it to the driver).
>
> So looking at this I wonder if we should add some property to describe the
> number of supported channels, since they are slightly different between the
> SoCs:
> - The D1 manual mentions 2 channels.
> - The T113s manual (same die as the D1?) describes 1 channel only.
> - The T507 manual (same die as the H616) reports 4 channels.
> - The A733 has 6 channels.
> - The A133 has 1 channel, but it's channel 1, not 0.
>
> So all of this is somewhat covered as channels are described as child nodes,
> and have a reg property. Ideally non-existing channels just wouldn't be
> listed, but I don't know if we want to rely on that.
>
> So I am wondering if we should introduce a limit, or rather a mask (to cover
> the A133 oddity)?
> Either a DT property (channel-mask, as a single sell representing the bit
> mask), or derived in the driver from the compatible string.
> The former would avoid introducing different compatible strings just because
> of that, though I think this type of property is somewhat discouraged?
>
> Any thoughts?
Thanks. I have missed that sparse channels are also possible. I think in
current implementation it will cause issue with lookup through
<&gpadc 1> as sun20i_gpadc_alloc_channels would effectively create
channels[0].channel = 1 in such scenario. I will try to verify if my
logic is correct and provide separate fix if needed.
Regarding DT property masking channels there is already precedence:
atmel,adc-channels-used is a bitmask of muxed and enabled channels.
Not sure if preferable though...
Michal
>
> > "#io-channel-cells":
> > @@ -29,7 +30,12 @@ properties:
> > const: 0
> > clocks:
> > - maxItems: 1
> > + minItems: 1
> > + maxItems: 2
> > +
> > + clock-names:
> > + minItems: 1
> > + maxItems: 2
> > interrupts:
> > maxItems: 1
> > @@ -40,6 +46,35 @@ properties:
> > resets:
> > maxItems: 1
> > +allOf:
> > + - if:
> > + properties:
> > + compatible:
> > + items:
> > + - const: allwinner,sun55i-a523-gpadc
> > + - const: allwinner,sun20i-d1-gpadc
> > + then:
> > + properties:
> > + clocks:
> > + minItems: 2
> > + maxItems: 2
> > + items:
> > + - description: Bus clock
> > + - description: Module clock
>
> I am not a YAML expert, but I think you can drop the min and max properties,
> if you just enumerate the cases. Same for the names.
>
> Cheers,
> Andre
I will correct that in v2.
Michal.
>
> > + clock-names:
> > + minItems: 2
> > + maxItems: 2
> > + items:
> > + - const: bus
> > + - const: mod
> > + required:
> > + - clock-names
> > + else:
> > + properties:
> > + clocks:
> > + maxItems: 1
> > + clock-names: false
> > +
> > patternProperties:
> > "^channel@[0-9a-f]+$":
> > $ref: adc.yaml
> >
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] iio: adc: sun20i-gpadc: add A523 gpadc support
2026-05-10 12:57 ` [PATCH 2/3] iio: adc: sun20i-gpadc: add A523 gpadc support Michal Piekos
@ 2026-05-12 11:51 ` Jonathan Cameron
2026-05-12 13:48 ` Andre Przywara
0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Cameron @ 2026-05-12 11:51 UTC (permalink / raw)
To: Michal Piekos
Cc: David Lechner, Nuno Sá, Andy Shevchenko, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Maksim Kiselev, linux-iio, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel
On Sun, 10 May 2026 14:57:23 +0200
Michal Piekos <michal.piekos@mmpsystems.pl> wrote:
> A523 differs from existing sun20i-gpadc-iio by having two clocks; bus
> clock and module clock.
>
> Change driver to enable all clocks.
>
> Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
I'm expecting this to change given comment on not being quite compatible so
I'll wait for v2 before reviewing.
Thanks,
Jonathan
> ---
> drivers/iio/adc/sun20i-gpadc-iio.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/adc/sun20i-gpadc-iio.c b/drivers/iio/adc/sun20i-gpadc-iio.c
> index 861c14da75ad..dd4c7e6e3d76 100644
> --- a/drivers/iio/adc/sun20i-gpadc-iio.c
> +++ b/drivers/iio/adc/sun20i-gpadc-iio.c
> @@ -180,7 +180,7 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
> struct iio_dev *indio_dev;
> struct sun20i_gpadc_iio *info;
> struct reset_control *rst;
> - struct clk *clk;
> + struct clk_bulk_data *clks;
> int irq;
> int ret;
>
> @@ -205,9 +205,9 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
> if (IS_ERR(info->regs))
> return PTR_ERR(info->regs);
>
> - clk = devm_clk_get_enabled(dev, NULL);
> - if (IS_ERR(clk))
> - return dev_err_probe(dev, PTR_ERR(clk), "failed to enable bus clock\n");
> + ret = devm_clk_bulk_get_all_enabled(dev, &clks);
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "failed to enable clocks\n");
>
> rst = devm_reset_control_get_exclusive(dev, NULL);
> if (IS_ERR(rst))
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] iio: adc: sun20i-gpadc: add A523 gpadc support
2026-05-12 11:51 ` Jonathan Cameron
@ 2026-05-12 13:48 ` Andre Przywara
0 siblings, 0 replies; 12+ messages in thread
From: Andre Przywara @ 2026-05-12 13:48 UTC (permalink / raw)
To: Jonathan Cameron, Michal Piekos
Cc: David Lechner, Nuno Sá, Andy Shevchenko, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Maksim Kiselev, linux-iio, devicetree,
linux-arm-kernel, linux-sunxi, linux-kernel
Hi,
On 5/12/26 13:51, Jonathan Cameron wrote:
> On Sun, 10 May 2026 14:57:23 +0200
> Michal Piekos <michal.piekos@mmpsystems.pl> wrote:
>
>> A523 differs from existing sun20i-gpadc-iio by having two clocks; bus
>> clock and module clock.
>>
>> Change driver to enable all clocks.
>>
>> Signed-off-by: Michal Piekos <michal.piekos@mmpsystems.pl>
> I'm expecting this to change given comment on not being quite compatible so
> I'll wait for v2 before reviewing.
Yes, we need a v2, but just for adding the new compatible string.
Otherwise I think this patch is a neat solution, because we don't need
to further differentiate between the different SoC's number of required
clocks.
Cheers,
Andre
>
> Thanks,
>
> Jonathan
>
>> ---
>> drivers/iio/adc/sun20i-gpadc-iio.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/iio/adc/sun20i-gpadc-iio.c b/drivers/iio/adc/sun20i-gpadc-iio.c
>> index 861c14da75ad..dd4c7e6e3d76 100644
>> --- a/drivers/iio/adc/sun20i-gpadc-iio.c
>> +++ b/drivers/iio/adc/sun20i-gpadc-iio.c
>> @@ -180,7 +180,7 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
>> struct iio_dev *indio_dev;
>> struct sun20i_gpadc_iio *info;
>> struct reset_control *rst;
>> - struct clk *clk;
>> + struct clk_bulk_data *clks;
>> int irq;
>> int ret;
>>
>> @@ -205,9 +205,9 @@ static int sun20i_gpadc_probe(struct platform_device *pdev)
>> if (IS_ERR(info->regs))
>> return PTR_ERR(info->regs);
>>
>> - clk = devm_clk_get_enabled(dev, NULL);
>> - if (IS_ERR(clk))
>> - return dev_err_probe(dev, PTR_ERR(clk), "failed to enable bus clock\n");
>> + ret = devm_clk_bulk_get_all_enabled(dev, &clks);
>> + if (ret < 0)
>> + return dev_err_probe(dev, ret, "failed to enable clocks\n");
>>
>> rst = devm_reset_control_get_exclusive(dev, NULL);
>> if (IS_ERR(rst))
>>
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-05-12 13:48 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-10 12:57 [PATCH 0/3] Add GPADC support for A523 Michal Piekos
2026-05-10 12:57 ` [PATCH 1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523 Michal Piekos
2026-05-10 14:29 ` Rob Herring (Arm)
2026-05-10 14:40 ` Jernej Škrabec
2026-05-11 16:02 ` Andre Przywara
2026-05-12 3:56 ` Michal Piekos
2026-05-10 12:57 ` [PATCH 2/3] iio: adc: sun20i-gpadc: add A523 gpadc support Michal Piekos
2026-05-12 11:51 ` Jonathan Cameron
2026-05-12 13:48 ` Andre Przywara
2026-05-10 12:57 ` [PATCH 3/3] arm64: dts: allwinner: a523: add gpadc node Michal Piekos
2026-05-10 14:39 ` Jernej Škrabec
2026-05-10 18:34 ` Chen-Yu Tsai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox