xref: /linux/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml (revision 55d0969c451159cff86949b38c39171cab962069)
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,meson-a1-pwm
43          - const: amlogic,meson-s4-pwm
44      - items:
45          - enum:
46              - amlogic,meson8b-pwm-v2
47              - amlogic,meson-gxbb-pwm-v2
48              - amlogic,meson-axg-pwm-v2
49              - amlogic,meson-g12-pwm-v2
50          - const: amlogic,meson8-pwm-v2
51
52  reg:
53    maxItems: 1
54
55  clocks:
56    minItems: 1
57    maxItems: 4
58
59  clock-names:
60    minItems: 1
61    maxItems: 2
62
63  power-domains:
64    maxItems: 1
65
66  "#pwm-cells":
67    const: 3
68
69required:
70  - compatible
71  - reg
72
73allOf:
74  - $ref: pwm.yaml#
75
76  - if:
77      properties:
78        compatible:
79          contains:
80            enum:
81              - amlogic,meson8-pwm
82              - amlogic,meson8b-pwm
83              - amlogic,meson-gxbb-pwm
84              - amlogic,meson-gxbb-ao-pwm
85              - amlogic,meson-axg-ee-pwm
86              - amlogic,meson-axg-ao-pwm
87              - amlogic,meson-g12a-ee-pwm
88              - amlogic,meson-g12a-ao-pwm-ab
89              - amlogic,meson-g12a-ao-pwm-cd
90    then:
91      # Obsolete historic bindings tied to the driver implementation
92      # The clocks provided here are meant to be matched with the input
93      # known (hard-coded) in the driver and used to select pwm clock
94      # source. Currently, the linux driver ignores this.
95      # This is kept to maintain ABI backward compatibility.
96      properties:
97        clocks:
98          maxItems: 2
99        clock-names:
100          oneOf:
101            - items:
102                - enum: [clkin0, clkin1]
103            - items:
104                - const: clkin0
105                - const: clkin1
106
107  # Newer binding where clock describe the actual clock inputs of the pwm
108  # block. These are necessary but some inputs may be grounded.
109  - if:
110      properties:
111        compatible:
112          contains:
113            enum:
114              - amlogic,meson8-pwm-v2
115    then:
116      properties:
117        clocks:
118          minItems: 1
119          items:
120            - description: input clock 0 of the pwm block
121            - description: input clock 1 of the pwm block
122            - description: input clock 2 of the pwm block
123            - description: input clock 3 of the pwm block
124        clock-names: false
125      required:
126        - clocks
127
128  # Newer IP block take a single input per channel, instead of 4 inputs
129  # for both channels
130  - if:
131      properties:
132        compatible:
133          contains:
134            enum:
135              - amlogic,meson-s4-pwm
136    then:
137      properties:
138        clocks:
139          items:
140            - description: input clock of PWM channel A
141            - description: input clock of PWM channel B
142        clock-names: false
143      required:
144        - clocks
145
146  - if:
147      properties:
148        compatible:
149          contains:
150            enum:
151              - amlogic,meson-a1-pwm
152    then:
153      required:
154        - power-domains
155
156additionalProperties: false
157
158examples:
159  - |
160    pwm@8550 {
161      compatible = "amlogic,meson-gxbb-pwm";
162      reg = <0x08550 0x10>;
163      clocks = <&xtal>, <&xtal>;
164      clock-names = "clkin0", "clkin1";
165      #pwm-cells = <3>;
166    };
167  - |
168    pwm@2000 {
169      compatible = "amlogic,meson8-pwm-v2";
170      reg = <0x1000 0x10>;
171      clocks = <&xtal>, <0>, <&fdiv4>, <&fdiv5>;
172      #pwm-cells = <3>;
173    };
174  - |
175    pwm@1000 {
176      compatible = "amlogic,meson-s4-pwm";
177      reg = <0x1000 0x10>;
178      clocks = <&pwm_src_a>, <&pwm_src_b>;
179      #pwm-cells = <3>;
180    };
181