1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mfd/x-powers,axp152.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: X-Powers AXP PMIC
8
9maintainers:
10  - Chen-Yu Tsai <wens@csie.org>
11
12allOf:
13  - if:
14      properties:
15        compatible:
16          contains:
17            enum:
18              - x-powers,axp152
19              - x-powers,axp202
20              - x-powers,axp209
21
22    then:
23      properties:
24        regulators:
25          properties:
26            x-powers,dcdc-freq:
27              minimum: 750
28              maximum: 1875
29              default: 1500
30
31    else:
32      properties:
33        regulators:
34          properties:
35            x-powers,dcdc-freq:
36              minimum: 1800
37              maximum: 4050
38              default: 3000
39
40  - if:
41      properties:
42        compatible:
43          contains:
44            enum:
45              - x-powers,axp152
46              - x-powers,axp202
47              - x-powers,axp209
48
49    then:
50      properties:
51        x-powers,drive-vbus-en: false
52
53  - if:
54      not:
55        properties:
56          compatible:
57            contains:
58              const: x-powers,axp806
59
60    then:
61      properties:
62        x-powers,self-working-mode: false
63        x-powers,master-mode: false
64
65  - if:
66      not:
67        properties:
68          compatible:
69            contains:
70              const: x-powers,axp305
71
72    then:
73      required:
74        - interrupts
75
76properties:
77  compatible:
78    oneOf:
79      - enum:
80          - x-powers,axp152
81          - x-powers,axp202
82          - x-powers,axp209
83          - x-powers,axp221
84          - x-powers,axp223
85          - x-powers,axp803
86          - x-powers,axp806
87          - x-powers,axp809
88          - x-powers,axp813
89      - items:
90          - const: x-powers,axp228
91          - const: x-powers,axp221
92      - items:
93          - const: x-powers,axp805
94          - const: x-powers,axp806
95      - items:
96          - const: x-powers,axp305
97          - const: x-powers,axp805
98          - const: x-powers,axp806
99      - items:
100          - const: x-powers,axp818
101          - const: x-powers,axp813
102
103  reg:
104    maxItems: 1
105
106  interrupts:
107    maxItems: 1
108
109  interrupt-controller: true
110
111  "#interrupt-cells":
112    const: 1
113
114  x-powers,drive-vbus-en:
115    type: boolean
116    description: >
117      Set this when the N_VBUSEN pin is used as an output pin to control an
118      external regulator to drive the OTG VBus, rather then as an input pin
119      which signals whether the board is driving OTG VBus or not.
120
121  x-powers,self-working-mode:
122    type: boolean
123    description: >
124      Set this when the PMIC is wired for self-working mode through the MODESET
125      pin.
126
127  x-powers,master-mode:
128    type: boolean
129    description: >
130      Set this when the PMIC is wired for master mode through the MODESET pin.
131
132  vin1-supply:
133    description: >
134      DCDC1 power supply node, if present.
135
136  vin2-supply:
137    description: >
138      DCDC2 power supply node, if present.
139
140  vin3-supply:
141    description: >
142      DCDC3 power supply node, if present.
143
144  vin4-supply:
145    description: >
146      DCDC4 power supply node, if present.
147
148  vin5-supply:
149    description: >
150      DCDC5 power supply node, if present.
151
152  vin6-supply:
153    description: >
154      DCDC6 power supply node, if present.
155
156  vin7-supply:
157    description: >
158      DCDC7 power supply node, if present.
159
160  vina-supply:
161    description: >
162      DCDCA power supply node, if present.
163
164  vinb-supply:
165    description: >
166      DCDCB power supply node, if present.
167
168  vinc-supply:
169    description: >
170      DCDCC power supply node, if present.
171
172  vind-supply:
173    description: >
174      DCDCD power supply node, if present.
175
176  vine-supply:
177    description: >
178      DCDCE power supply node, if present.
179
180  acin-supply:
181    description: >
182      LDO1 power supply node, if present.
183
184  ldo24in-supply:
185    description: >
186      LDO2 and LDO4 power supply node, if present.
187
188  ldo3in-supply:
189    description: >
190      LDO3 power supply node, if present.
191
192  ldo5in-supply:
193    description: >
194      LDO5 power supply node, if present.
195
196  aldoin-supply:
197    description: >
198      ALDO* power supply node, if present.
199
200  bldoin-supply:
201    description: >
202      BLDO* power supply node, if present.
203
204  cldoin-supply:
205    description: >
206      CLDO* power supply node, if present.
207
208  dldoin-supply:
209    description: >
210      DLDO* power supply node, if present.
211
212  eldoin-supply:
213    description: >
214      ELDO* power supply node, if present.
215
216  fldoin-supply:
217    description: >
218      FLDO* power supply node, if present.
219
220  ips-supply:
221    description: >
222      LDO_IO0, LDO_IO1 and RTC_LDO power supply node, if present.
223
224  drivevbus-supply:
225    description: >
226      DRIVEVBUS power supply node, if present.
227
228  swin-supply:
229    description: >
230      SW power supply node, if present.
231
232  adc:
233    $ref: /schemas/iio/adc/x-powers,axp209-adc.yaml#
234
235  gpio:
236    $ref: /schemas/gpio/x-powers,axp209-gpio.yaml#
237
238  ac-power:
239    $ref: /schemas/power/supply/x-powers,axp20x-ac-power-supply.yaml#
240
241  battery-power:
242    $ref: /schemas/power/supply/x-powers,axp20x-battery-power-supply.yaml#
243
244  usb-power:
245    $ref: /schemas/power/supply/x-powers,axp20x-usb-power-supply.yaml#
246
247  regulators:
248    type: object
249
250    properties:
251      x-powers,dcdc-freq:
252        $ref: /schemas/types.yaml#/definitions/uint32
253        description: >
254          Defines the work frequency of DC-DC in kHz.
255
256    patternProperties:
257      "^(([a-f])?ldo[0-9]|dcdc[0-7a-e]|ldo(_|-)io(0|1)|(dc1)?sw|rtc(_|-)ldo|drivevbus|dc5ldo)$":
258        $ref: /schemas/regulator/regulator.yaml#
259        type: object
260        unevaluatedProperties: false
261
262        properties:
263          regulator-ramp-delay:
264            description: >
265              Only 800 and 1600 are valid for the DCDC2 and LDO3 regulators on
266              the AXP209.
267
268          regulator-soft-start:
269            description: >
270              Only valid for the LDO3 regulator.
271
272          x-powers,dcdc-workmode:
273            $ref: /schemas/types.yaml#/definitions/uint32
274            enum: [0, 1]
275            description: >
276              Only valid for DCDC regulators. Setup 1 for PWM mode, 0
277              for AUTO (PWM/PFM) mode. The DCDC regulators work in a
278              mixed PWM/PFM mode, using PFM under light loads and
279              switching to PWM for heavier loads. Forcing PWM mode
280              trades efficiency under light loads for lower output
281              noise. This probably makes sense for HiFi audio related
282              applications that aren't battery constrained.
283
284    additionalProperties: false
285
286required:
287  - compatible
288  - reg
289  - "#interrupt-cells"
290  - interrupt-controller
291
292additionalProperties: false
293
294examples:
295  - |
296      i2c0 {
297          #address-cells = <1>;
298          #size-cells = <0>;
299
300          pmic@30 {
301              compatible = "x-powers,axp152";
302              reg = <0x30>;
303              interrupts = <0>;
304              interrupt-controller;
305              #interrupt-cells = <1>;
306          };
307      };
308
309  - |
310      #include <dt-bindings/interrupt-controller/irq.h>
311
312      i2c0 {
313          #address-cells = <1>;
314          #size-cells = <0>;
315
316          pmic@34 {
317              compatible = "x-powers,axp209";
318              reg = <0x34>;
319              interrupt-parent = <&nmi_intc>;
320              interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
321              interrupt-controller;
322              #interrupt-cells = <1>;
323
324              ac_power_supply: ac-power {
325                  compatible = "x-powers,axp202-ac-power-supply";
326              };
327
328              axp_adc: adc {
329                  compatible = "x-powers,axp209-adc";
330                  #io-channel-cells = <1>;
331              };
332
333              axp_gpio: gpio {
334                  compatible = "x-powers,axp209-gpio";
335                  gpio-controller;
336                  #gpio-cells = <2>;
337
338                  gpio0-adc-pin {
339                      pins = "GPIO0";
340                      function = "adc";
341                  };
342              };
343
344              battery_power_supply: battery-power {
345                  compatible = "x-powers,axp209-battery-power-supply";
346              };
347
348              regulators {
349                  /* Default work frequency for buck regulators */
350                  x-powers,dcdc-freq = <1500>;
351
352                  reg_dcdc2: dcdc2 {
353                      regulator-always-on;
354                      regulator-min-microvolt = <1000000>;
355                      regulator-max-microvolt = <1450000>;
356                      regulator-name = "vdd-cpu";
357                  };
358
359                  reg_dcdc3: dcdc3 {
360                      regulator-always-on;
361                      regulator-min-microvolt = <1000000>;
362                      regulator-max-microvolt = <1400000>;
363                      regulator-name = "vdd-int-dll";
364                  };
365
366                  reg_ldo1: ldo1 {
367                      /* LDO1 is a fixed output regulator */
368                      regulator-always-on;
369                      regulator-min-microvolt = <1300000>;
370                      regulator-max-microvolt = <1300000>;
371                      regulator-name = "vdd-rtc";
372                  };
373
374                  reg_ldo2: ldo2 {
375                      regulator-always-on;
376                      regulator-min-microvolt = <3000000>;
377                      regulator-max-microvolt = <3000000>;
378                      regulator-name = "avcc";
379                  };
380
381                  reg_ldo3: ldo3 {
382                      regulator-name = "ldo3";
383                  };
384
385                  reg_ldo4: ldo4 {
386                      regulator-name = "ldo4";
387                  };
388
389                  reg_ldo5: ldo5 {
390                      regulator-name = "ldo5";
391                  };
392              };
393
394              usb_power_supply: usb-power {
395                  compatible = "x-powers,axp202-usb-power-supply";
396              };
397          };
398      };
399