[v3,1/3] dt-bindings: iio: adc: Add GPADC for Allwinner A523

Message ID 20260516-sunxi-a523-gpadc-v3-1-a3a04cff2620@mmpsystems.pl (mailing list archive)
State New
Headers
Series Add GPADC support for A523 |

Commit Message

Michal Piekos May 16, 2026, 5:34 a.m. UTC
Add support for the GPADC for the Allwinner A523. It differs from the
D1/T113s/R329/T507 by having two clocks.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
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

sashiko-bot@kernel.org May 16, 2026, 5:50 a.m. UTC | #1
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Brittle schema conditional matching for compatible string
- [Low] Missing device tree example for the newly added A523 variant
--

commit 8ef795d51c1bc739366c917fc7bb2c4c8c5c937c
Author: Michal Piekos <michal.piekos@mmpsystems.pl>

dt-bindings: iio: adc: Add GPADC for Allwinner A523

Add support for the GPADC for the Allwinner A523, which introduces a
second clock compared to previous generations.

> 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

[ ... ]

> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          enum:
> +            - allwinner,sun55i-a523-gpadc

Could this conditional matching be brittle?

Using a strict enum instead of contains: enum will fail if a future
hardware variant uses allwinner,sun55i-a523-gpadc as a fallback string
in an array. Would it be better to use contains: enum here to ensure
standard extensibility?

> +    then:
> +      properties:
> +        clocks:
> +          items:
> +            - description: Bus clock
> +            - description: Module clock
> +        clock-names:
> +          items:
> +            - const: bus
> +            - const: mod
> +      required:
> +        - clock-names

Should an example be added for the allwinner,sun55i-a523-gpadc variant
in the examples section?

Without an example, it appears the new constraints for the two clocks
and the clock-names property will not be tested during dt_binding_check.

[ ... ]
  
Krzysztof Kozlowski May 16, 2026, 7:32 p.m. UTC | #2
On 16/05/2026 07:50, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Low] Brittle schema conditional matching for compatible string
> - [Low] Missing device tree example for the newly added A523 variant
> --
> 
> commit 8ef795d51c1bc739366c917fc7bb2c4c8c5c937c
> Author: Michal Piekos <michal.piekos@mmpsystems.pl>
> 
> dt-bindings: iio: adc: Add GPADC for Allwinner A523
> 
> Add support for the GPADC for the Allwinner A523, which introduces a
> second clock compared to previous generations.
> 
>> 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
> 
> [ ... ]
> 
>> +allOf:
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          enum:
>> +            - allwinner,sun55i-a523-gpadc
> 
> Could this conditional matching be brittle?
> 
> Using a strict enum instead of contains: enum will fail if a future
> hardware variant uses allwinner,sun55i-a523-gpadc as a fallback string
> in an array. Would it be better to use contains: enum here to ensure
> standard extensibility?

Nitpick. Code is correct. Sashiko prompts are asking to skip nitpicks so
why do we deal with this?

Really the quality of Sashiko reviews for DT at least deteriorated or
was always poor but I just did not notice :(

> 
>> +    then:
>> +      properties:
>> +        clocks:
>> +          items:
>> +            - description: Bus clock
>> +            - description: Module clock
>> +        clock-names:
>> +          items:
>> +            - const: bus
>> +            - const: mod
>> +      required:
>> +        - clock-names
> 
> Should an example be added for the allwinner,sun55i-a523-gpadc variant
> in the examples section?
> 
> Without an example, it appears the new constraints for the two clocks
> and the clock-names property will not be tested during dt_binding_check.

Again crappy Sashiko reasoning...

Best regards,
Krzysztof
  

Patch

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..6467800d30e2 100644
--- a/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/allwinner,sun20i-d1-gpadc.yaml
@@ -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