[v11,1/5] dt-bindings: pwm: allwinner: add h616 pwm compatible

Message ID 20261103-h616-pwm-v8-v11-1-07abb59575c3@gmail.com (mailing list archive)
State New
Headers
Series Introduce Allwinner H616 PWM controller |

Commit Message

James Hilliard Nov. 3, 2026, 8:40 a.m. UTC
From: Richard Genoud <richard.genoud@bootlin.com>

The Allwinner H616 PWM block differs from the A10 and H6 blocks, but it
uses the same input clocks as H6, so extend the existing Allwinner PWM
binding.

The block has six channels that can generate PWM waveforms. Each channel
also has a bypass that turns its output into a clock suitable for consumers
such as the integrated X-Powers AC200 or AC300 Ethernet PHY.

Require #clock-cells for H616 because the bypass clocks are part of its
provider interface, while continuing to disallow the property for the older
variants.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 .../bindings/pwm/allwinner,sun4i-a10-pwm.yaml      | 33 +++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)
  

Comments

sashiko-bot@kernel.org Nov. 3, 2026, 8:47 a.m. UTC | #1
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dt-bindings: pwm: allwinner: split sun50i-h616-pwm into separate schema
--

commit 84bc5e75b753199a825a57cc155aa02311bdc3e8
Author: Richard Genoud <richard.genoud@bootlin.com>

dt-bindings: pwm: allwinner: add h616 pwm compatible

This commit adds the allwinner,sun50i-h616-pwm compatible string to the
existing sun4i-a10-pwm binding schema, requiring two input clocks and
#clock-cells = <1> for the H616 PWM channel bypass clock outputs while
disallowing #clock-cells on the older variants.

> diff --git a/Documentation/devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml b/Documentation/devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml
> index 1197858e431f2..3b1819c8630cc 100644
> --- a/Documentation/devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml
> +++ b/Documentation/devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml
> @@ -14,6 +14,13 @@ properties:
>    "#pwm-cells":
>      const: 3
>  
> +  "#clock-cells":
> +    const: 1
> +    description:
> +      The cell selects the PWM channel whose hardware bypass path is exported
> +      as a clock. Its rate follows the selected shared pair source and divider;
> +      the PWM period, duty-cycle and polarity logic is bypassed.
> +
>    compatible:
>      oneOf:
>        - const: allwinner,sun4i-a10-pwm
> @@ -36,6 +43,7 @@ properties:
>            - const: allwinner,sun50i-h5-pwm
>            - const: allwinner,sun5i-a13-pwm
>        - const: allwinner,sun50i-h6-pwm
> +      - const: allwinner,sun50i-h616-pwm
>  
>    reg:
>      maxItems: 1
> @@ -62,7 +70,9 @@ allOf:
>        properties:
>          compatible:
>            contains:
> -            const: allwinner,sun50i-h6-pwm
> +            enum:
> +              - allwinner,sun50i-h6-pwm
> +              - allwinner,sun50i-h616-pwm
>  
>      then:
>        properties:
> @@ -83,6 +93,27 @@ allOf:
>          clocks:
>            maxItems: 1
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: allwinner,sun50i-h616-pwm
> +
> +    then:
> +      properties:
> +        clocks:
> +          minItems: 2
> +
> +        clock-names:
> +          minItems: 2
> +
> +      required:
> +        - "#clock-cells"
> +
> +    else:
> +      properties:
> +        "#clock-cells": false

[Severity: Low]
This isn't a bug, but since the H616 PWM is a distinct hardware block that
also acts as a clock provider, extending allwinner,sun4i-a10-pwm.yaml
requires defining #clock-cells at the top level only to disallow it for all
ten older compatibles in an else branch.

It also splits the clocks and clock-names constraints for
allwinner,sun50i-h616-pwm across two separate if-then blocks in allOf (setting
maxItems: 2 and items in the first block shared with allwinner,sun50i-h6-pwm,
and minItems: 2 in the second block).

Would it be cleaner to split allwinner,sun50i-h616-pwm into its own binding
schema document rather than adding another conditional block here?
  

Patch

diff --git a/Documentation/devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml b/Documentation/devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml
index 1197858e431f..3b1819c8630c 100644
--- a/Documentation/devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml
+++ b/Documentation/devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml
@@ -14,6 +14,13 @@  properties:
   "#pwm-cells":
     const: 3
 
+  "#clock-cells":
+    const: 1
+    description:
+      The cell selects the PWM channel whose hardware bypass path is exported
+      as a clock. Its rate follows the selected shared pair source and divider;
+      the PWM period, duty-cycle and polarity logic is bypassed.
+
   compatible:
     oneOf:
       - const: allwinner,sun4i-a10-pwm
@@ -36,6 +43,7 @@  properties:
           - const: allwinner,sun50i-h5-pwm
           - const: allwinner,sun5i-a13-pwm
       - const: allwinner,sun50i-h6-pwm
+      - const: allwinner,sun50i-h616-pwm
 
   reg:
     maxItems: 1
@@ -62,7 +70,9 @@  allOf:
       properties:
         compatible:
           contains:
-            const: allwinner,sun50i-h6-pwm
+            enum:
+              - allwinner,sun50i-h6-pwm
+              - allwinner,sun50i-h616-pwm
 
     then:
       properties:
@@ -83,6 +93,27 @@  allOf:
         clocks:
           maxItems: 1
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: allwinner,sun50i-h616-pwm
+
+    then:
+      properties:
+        clocks:
+          minItems: 2
+
+        clock-names:
+          minItems: 2
+
+      required:
+        - "#clock-cells"
+
+    else:
+      properties:
+        "#clock-cells": false
+
 required:
   - compatible
   - reg