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