1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mfd/rockchip,rk817.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: RK817 Power Management Integrated Circuit
8
9maintainers:
10  - Chris Zhong <zyw@rock-chips.com>
11  - Zhang Qing <zhangqing@rock-chips.com>
12
13description: |
14  Rockchip RK817 series PMIC. This device consists of an i2c controlled MFD
15  that includes regulators, an RTC, a power button, an audio codec, and a
16  battery charger manager.
17
18properties:
19  compatible:
20    enum:
21      - rockchip,rk817
22
23  reg:
24    maxItems: 1
25
26  interrupts:
27    maxItems: 1
28
29  '#clock-cells':
30    description:
31      See <dt-bindings/clock/rockchip,rk808.h> for clock IDs.
32    minimum: 0
33    maximum: 1
34
35  clock-output-names:
36    description:
37      From common clock binding to override the default output clock name.
38
39  rockchip,system-power-controller:
40    type: boolean
41    description:
42      Telling whether or not this PMIC is controlling the system power.
43
44  wakeup-source:
45    type: boolean
46    description:
47      Device can be used as a wakeup source.
48
49  vcc1-supply:
50    description:
51      The input supply for DCDC_REG1.
52
53  vcc2-supply:
54    description:
55      The input supply for DCDC_REG2.
56
57  vcc3-supply:
58    description:
59      The input supply for DCDC_REG3.
60
61  vcc4-supply:
62    description:
63      The input supply for DCDC_REG4.
64
65  vcc5-supply:
66    description:
67      The input supply for LDO_REG1, LDO_REG2, and LDO_REG3.
68
69  vcc6-supply:
70    description:
71      The input supply for LDO_REG4, LDO_REG5, and LDO_REG6.
72
73  vcc7-supply:
74    description:
75      The input supply for LDO_REG7, LDO_REG8, and LDO_REG9.
76
77  vcc8-supply:
78    description:
79      The input supply for BOOST.
80
81  vcc9-supply:
82    description:
83      The input supply for OTG_SWITCH.
84
85  regulators:
86    type: object
87    patternProperties:
88      "^(LDO_REG[1-9]|DCDC_REG[1-4]|BOOST|OTG_SWITCH)$":
89        type: object
90        unevaluatedProperties: false
91        $ref: ../regulator/regulator.yaml#
92    unevaluatedProperties: false
93
94  clocks:
95    description:
96      The input clock for the audio codec.
97
98  clock-names:
99    description:
100      The clock name for the codec clock.
101    items:
102      - const: mclk
103
104  '#sound-dai-cells':
105    description:
106      Needed for the interpretation of sound dais.
107    const: 0
108
109  codec:
110    description: |
111      The child node for the codec to hold additional properties. If no
112      additional properties are required for the codec, this node can be
113      omitted.
114    type: object
115    additionalProperties: false
116    properties:
117      rockchip,mic-in-differential:
118        type: boolean
119        description:
120          Describes if the microphone uses differential mode.
121
122  charger:
123    description: |
124      The child node for the charger to hold additional properties. If a
125      battery is not in use, this node can be omitted.
126    type: object
127    $ref: /schemas/power/supply/power-supply.yaml
128
129    properties:
130      monitored-battery:
131        description: |
132          A phandle to a monitored battery node that contains a valid
133          value for:
134          charge-full-design-microamp-hours,
135          charge-term-current-microamp,
136          constant-charge-current-max-microamp,
137          constant-charge-voltage-max-microvolt,
138          voltage-max-design-microvolt,
139          voltage-min-design-microvolt,
140          and a valid ocv-capacity table.
141
142      rockchip,resistor-sense-micro-ohms:
143        description: |
144          Value in microohms of the battery sense resistor. This value is
145          used by the driver to set the correct divisor value to translate
146          ADC readings into the proper units of measure.
147        enum: [10000, 20000]
148
149      rockchip,sleep-enter-current-microamp:
150        description: |
151          Value in microamps of the sleep enter current for the charger.
152          Value is used by the driver to calibrate the relax threshold.
153
154      rockchip,sleep-filter-current-microamp:
155        description:
156          Value in microamps of the sleep filter current for the charger.
157          Value is used by the driver to derive the sleep sample current.
158
159    required:
160      - monitored-battery
161      - rockchip,resistor-sense-micro-ohms
162      - rockchip,sleep-enter-current-microamp
163      - rockchip,sleep-filter-current-microamp
164
165    additionalProperties: false
166
167allOf:
168  - if:
169      properties:
170        '#clock-cells':
171          const: 0
172
173    then:
174      properties:
175        clock-output-names:
176          maxItems: 1
177
178    else:
179      properties:
180        clock-output-names:
181          maxItems: 2
182
183required:
184  - compatible
185  - reg
186  - interrupts
187  - "#clock-cells"
188
189additionalProperties: false
190
191examples:
192  - |
193    #include <dt-bindings/clock/px30-cru.h>
194    #include <dt-bindings/pinctrl/rockchip.h>
195    #include <dt-bindings/interrupt-controller/irq.h>
196    #include <dt-bindings/gpio/gpio.h>
197    i2c {
198        #address-cells = <1>;
199        #size-cells = <0>;
200
201        rk817: pmic@20 {
202            compatible = "rockchip,rk817";
203            reg = <0x20>;
204            interrupt-parent = <&gpio0>;
205            interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>;
206            clock-output-names = "rk808-clkout1", "xin32k";
207            clock-names = "mclk";
208            clocks = <&cru SCLK_I2S1_OUT>;
209            pinctrl-names = "default";
210            pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>;
211            wakeup-source;
212            #clock-cells = <1>;
213            #sound-dai-cells = <0>;
214
215            vcc1-supply = <&vccsys>;
216            vcc2-supply = <&vccsys>;
217            vcc3-supply = <&vccsys>;
218            vcc4-supply = <&vccsys>;
219            vcc5-supply = <&vccsys>;
220            vcc6-supply = <&vccsys>;
221            vcc7-supply = <&vccsys>;
222
223            regulators {
224                vdd_logic: DCDC_REG1 {
225                    regulator-name = "vdd_logic";
226                    regulator-min-microvolt = <950000>;
227                    regulator-max-microvolt = <1150000>;
228                    regulator-ramp-delay = <6001>;
229                    regulator-always-on;
230                    regulator-boot-on;
231
232                    regulator-state-mem {
233                        regulator-on-in-suspend;
234                        regulator-suspend-microvolt = <950000>;
235                    };
236                };
237
238                vdd_arm: DCDC_REG2 {
239                    regulator-name = "vdd_arm";
240                    regulator-min-microvolt = <950000>;
241                    regulator-max-microvolt = <1350000>;
242                    regulator-ramp-delay = <6001>;
243                    regulator-always-on;
244                    regulator-boot-on;
245
246                    regulator-state-mem {
247                        regulator-off-in-suspend;
248                        regulator-suspend-microvolt = <950000>;
249                    };
250                };
251
252                vcc_ddr: DCDC_REG3 {
253                    regulator-name = "vcc_ddr";
254                    regulator-always-on;
255                    regulator-boot-on;
256
257                    regulator-state-mem {
258                        regulator-on-in-suspend;
259                    };
260                };
261
262                vcc_3v3: DCDC_REG4 {
263                    regulator-name = "vcc_3v3";
264                    regulator-min-microvolt = <3300000>;
265                    regulator-max-microvolt = <3300000>;
266                    regulator-always-on;
267                    regulator-boot-on;
268
269                    regulator-state-mem {
270                        regulator-off-in-suspend;
271                        regulator-suspend-microvolt = <3300000>;
272                    };
273                };
274
275                vcc_1v8: LDO_REG2 {
276                    regulator-name = "vcc_1v8";
277                    regulator-min-microvolt = <1800000>;
278                    regulator-max-microvolt = <1800000>;
279                    regulator-always-on;
280                    regulator-boot-on;
281
282                    regulator-state-mem {
283                        regulator-on-in-suspend;
284                        regulator-suspend-microvolt = <1800000>;
285                    };
286                };
287
288                vdd_1v0: LDO_REG3 {
289                    regulator-name = "vdd_1v0";
290                    regulator-min-microvolt = <1000000>;
291                    regulator-max-microvolt = <1000000>;
292                    regulator-always-on;
293                    regulator-boot-on;
294
295                    regulator-state-mem {
296                        regulator-on-in-suspend;
297                        regulator-suspend-microvolt = <1000000>;
298                    };
299                };
300
301                vcc3v3_pmu: LDO_REG4 {
302                    regulator-name = "vcc3v3_pmu";
303                    regulator-min-microvolt = <3300000>;
304                    regulator-max-microvolt = <3300000>;
305                    regulator-always-on;
306                    regulator-boot-on;
307
308                    regulator-state-mem {
309                        regulator-on-in-suspend;
310                        regulator-suspend-microvolt = <3300000>;
311                    };
312                };
313
314                vccio_sd: LDO_REG5 {
315                    regulator-name = "vccio_sd";
316                    regulator-min-microvolt = <1800000>;
317                    regulator-max-microvolt = <3300000>;
318                    regulator-always-on;
319                    regulator-boot-on;
320
321                    regulator-state-mem {
322                        regulator-on-in-suspend;
323                        regulator-suspend-microvolt = <3300000>;
324                    };
325                };
326
327                vcc_sd: LDO_REG6 {
328                    regulator-name = "vcc_sd";
329                    regulator-min-microvolt = <3300000>;
330                    regulator-max-microvolt = <3300000>;
331                    regulator-boot-on;
332
333                    regulator-state-mem {
334                        regulator-on-in-suspend;
335                        regulator-suspend-microvolt = <3300000>;
336                    };
337                };
338
339                vcc_bl: LDO_REG7 {
340                    regulator-name = "vcc_bl";
341                    regulator-min-microvolt = <3300000>;
342                    regulator-max-microvolt = <3300000>;
343
344                    regulator-state-mem {
345                        regulator-off-in-suspend;
346                        regulator-suspend-microvolt = <3300000>;
347                    };
348                };
349
350                vcc_lcd: LDO_REG8 {
351                    regulator-name = "vcc_lcd";
352                    regulator-min-microvolt = <2800000>;
353                    regulator-max-microvolt = <2800000>;
354
355                    regulator-state-mem {
356                        regulator-off-in-suspend;
357                        regulator-suspend-microvolt = <2800000>;
358                    };
359                };
360
361                vcc_cam: LDO_REG9 {
362                    regulator-name = "vcc_cam";
363                    regulator-min-microvolt = <3000000>;
364                    regulator-max-microvolt = <3000000>;
365
366                    regulator-state-mem {
367                        regulator-off-in-suspend;
368                        regulator-suspend-microvolt = <3000000>;
369                    };
370                };
371            };
372
373            rk817_charger: charger {
374                monitored-battery = <&battery>;
375                rockchip,resistor-sense-micro-ohms = <10000>;
376                rockchip,sleep-enter-current-microamp = <300000>;
377                rockchip,sleep-filter-current-microamp = <100000>;
378            };
379
380            rk817_codec: codec {
381                rockchip,mic-in-differential;
382            };
383        };
384    };
385