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