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