[v2,1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523
Commit Message
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 | 32 +++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
Comments
On Wed, May 13, 2026 at 06:59:42AM +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>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Schema Conditional Logic Error: `if` block will silently fail to match A523 compatible string
--
commit f1e37c6efc76bc9bd352a9e8462984a80a03b87c
Author: Michal Piekos <michal.piekos@mmpsystems.pl>
dt-bindings: iio: adc: Add GPADC for Allwinner A523
This commit adds support for the GPADC on the Allwinner A523. It updates
the schema to allow two clocks for this new compatible string while
restricting previous generations to one clock.
> 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 da605a051b949..6467800d30e27 100644
> --- a/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
[ ... ]
> @@ -40,6 +46,30 @@ properties:
> resets:
> maxItems: 1
>
> +allOf:
> + - if:
> + properties:
> + compatible:
> + enum:
> + - allwinner,sun55i-a523-gpadc
Will this condition successfully match the A523 compatible string?
In dt-schema, the compatible property is parsed and evaluated as an array of
strings. By using enum directly without a contains: keyword, this condition
expects the property to be exactly a string.
Under JSON schema rules, this condition will evaluate to false because an
array cannot equal a string.
> + then:
[ ... ]
> + else:
> + properties:
> + clocks:
> + maxItems: 1
> + clock-names: false
Does this result in valid A523 device tree nodes being incorrectly rejected?
Since the if block silently fails to match, the schema will fall through to
this else block, enforcing maxItems: 1 for clocks and rejecting clock-names.
This would erroneously reject A523 configurations that correctly provide the
two required clocks.
Could the condition be updated to use contains: enum: or contains: const: to
properly match the compatible array elements?
@@ -14,6 +14,7 @@ properties:
oneOf:
- enum:
- allwinner,sun20i-d1-gpadc
+ - allwinner,sun55i-a523-gpadc
- items:
- enum:
- allwinner,sun50i-h616-gpadc
@@ -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,30 @@ properties:
resets:
maxItems: 1
+allOf:
+ - if:
+ properties:
+ compatible:
+ enum:
+ - allwinner,sun55i-a523-gpadc
+ then:
+ properties:
+ clocks:
+ items:
+ - description: Bus clock
+ - description: Module clock
+ clock-names:
+ items:
+ - const: bus
+ - const: mod
+ required:
+ - clock-names
+ else:
+ properties:
+ clocks:
+ maxItems: 1
+ clock-names: false
+
patternProperties:
"^channel@[0-9a-f]+$":
$ref: adc.yaml