Linux Audio

Check our new training course

Linux kernel drivers training

May 6-19, 2025
Register
Loading...
  1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
  2%YAML 1.2
  3---
  4$id: http://devicetree.org/schemas/pwm/pwm-amlogic.yaml#
  5$schema: http://devicetree.org/meta-schemas/core.yaml#
  6
  7title: Amlogic PWM
  8
  9maintainers:
 10  - Heiner Kallweit <hkallweit1@gmail.com>
 11
 12properties:
 13  compatible:
 14    oneOf:
 15      - enum:
 16          - amlogic,meson8b-pwm
 17          - amlogic,meson-gxbb-pwm
 18          - amlogic,meson-gxbb-ao-pwm
 19          - amlogic,meson-axg-ee-pwm
 20          - amlogic,meson-axg-ao-pwm
 21          - amlogic,meson-g12a-ee-pwm
 22          - amlogic,meson-g12a-ao-pwm-ab
 23          - amlogic,meson-g12a-ao-pwm-cd
 24        deprecated: true
 25      - items:
 26          - const: amlogic,meson-gx-pwm
 27          - const: amlogic,meson-gxbb-pwm
 28        deprecated: true
 29      - items:
 30          - const: amlogic,meson-gx-ao-pwm
 31          - const: amlogic,meson-gxbb-ao-pwm
 32        deprecated: true
 33      - items:
 34          - const: amlogic,meson8-pwm
 35          - const: amlogic,meson8b-pwm
 36        deprecated: true
 37      - enum:
 38          - amlogic,meson8-pwm-v2
 39          - amlogic,meson-s4-pwm
 40      - items:
 41          - enum:
 42              - amlogic,c3-pwm
 43              - amlogic,meson-a1-pwm
 44          - const: amlogic,meson-s4-pwm
 45      - items:
 46          - enum:
 47              - amlogic,meson8b-pwm-v2
 48              - amlogic,meson-gxbb-pwm-v2
 49              - amlogic,meson-axg-pwm-v2
 50              - amlogic,meson-g12-pwm-v2
 51          - const: amlogic,meson8-pwm-v2
 52
 53  reg:
 54    maxItems: 1
 55
 56  clocks:
 57    minItems: 1
 58    maxItems: 4
 59
 60  clock-names:
 61    minItems: 1
 62    maxItems: 2
 63
 64  power-domains:
 65    maxItems: 1
 66
 67  "#pwm-cells":
 68    const: 3
 69
 70required:
 71  - compatible
 72  - reg
 73
 74allOf:
 75  - $ref: pwm.yaml#
 76
 77  - if:
 78      properties:
 79        compatible:
 80          contains:
 81            enum:
 82              - amlogic,meson8-pwm
 83              - amlogic,meson8b-pwm
 84              - amlogic,meson-gxbb-pwm
 85              - amlogic,meson-gxbb-ao-pwm
 86              - amlogic,meson-axg-ee-pwm
 87              - amlogic,meson-axg-ao-pwm
 88              - amlogic,meson-g12a-ee-pwm
 89              - amlogic,meson-g12a-ao-pwm-ab
 90              - amlogic,meson-g12a-ao-pwm-cd
 91    then:
 92      # Obsolete historic bindings tied to the driver implementation
 93      # The clocks provided here are meant to be matched with the input
 94      # known (hard-coded) in the driver and used to select pwm clock
 95      # source. Currently, the linux driver ignores this.
 96      # This is kept to maintain ABI backward compatibility.
 97      properties:
 98        clocks:
 99          maxItems: 2
100        clock-names:
101          oneOf:
102            - items:
103                - enum: [clkin0, clkin1]
104            - items:
105                - const: clkin0
106                - const: clkin1
107
108  # Newer binding where clock describe the actual clock inputs of the pwm
109  # block. These are necessary but some inputs may be grounded.
110  - if:
111      properties:
112        compatible:
113          contains:
114            enum:
115              - amlogic,meson8-pwm-v2
116    then:
117      properties:
118        clocks:
119          minItems: 1
120          items:
121            - description: input clock 0 of the pwm block
122            - description: input clock 1 of the pwm block
123            - description: input clock 2 of the pwm block
124            - description: input clock 3 of the pwm block
125        clock-names: false
126      required:
127        - clocks
128
129  # Newer IP block take a single input per channel, instead of 4 inputs
130  # for both channels
131  - if:
132      properties:
133        compatible:
134          contains:
135            enum:
136              - amlogic,meson-s4-pwm
137    then:
138      properties:
139        clocks:
140          items:
141            - description: input clock of PWM channel A
142            - description: input clock of PWM channel B
143        clock-names: false
144      required:
145        - clocks
146
147  - if:
148      properties:
149        compatible:
150          contains:
151            enum:
152              - amlogic,meson-a1-pwm
153    then:
154      required:
155        - power-domains
156
157additionalProperties: false
158
159examples:
160  - |
161    pwm@8550 {
162      compatible = "amlogic,meson-gxbb-pwm";
163      reg = <0x08550 0x10>;
164      clocks = <&xtal>, <&xtal>;
165      clock-names = "clkin0", "clkin1";
166      #pwm-cells = <3>;
167    };
168  - |
169    pwm@2000 {
170      compatible = "amlogic,meson8-pwm-v2";
171      reg = <0x1000 0x10>;
172      clocks = <&xtal>, <0>, <&fdiv4>, <&fdiv5>;
173      #pwm-cells = <3>;
174    };
175  - |
176    pwm@1000 {
177      compatible = "amlogic,meson-s4-pwm";
178      reg = <0x1000 0x10>;
179      clocks = <&pwm_src_a>, <&pwm_src_b>;
180      #pwm-cells = <3>;
181    };