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    properties:
128      monitored-battery:
129        description: |
130          A phandle to a monitored battery node that contains a valid
131          value for:
132          charge-full-design-microamp-hours,
133          charge-term-current-microamp,
134          constant-charge-current-max-microamp,
135          constant-charge-voltage-max-microvolt,
136          voltage-max-design-microvolt,
137          voltage-min-design-microvolt,
138          and a valid ocv-capacity table.
139
140      rockchip,resistor-sense-micro-ohms:
141        description: |
142          Value in microohms of the battery sense resistor. This value is
143          used by the driver to set the correct divisor value to translate
144          ADC readings into the proper units of measure.
145        enum: [10000, 20000]
146
147      rockchip,sleep-enter-current-microamp:
148        description: |
149          Value in microamps of the sleep enter current for the charger.
150          Value is used by the driver to calibrate the relax threshold.
151
152      rockchip,sleep-filter-current-microamp:
153        description:
154          Value in microamps of the sleep filter current for the charger.
155          Value is used by the driver to derive the sleep sample current.
156
157    required:
158      - monitored-battery
159      - rockchip,resistor-sense-micro-ohms
160      - rockchip,sleep-enter-current-microamp
161      - rockchip,sleep-filter-current-microamp
162
163    additionalProperties: false
164
165allOf:
166  - if:
167      properties:
168        '#clock-cells':
169          const: 0
170
171    then:
172      properties:
173        clock-output-names:
174          maxItems: 1
175
176    else:
177      properties:
178        clock-output-names:
179          maxItems: 2
180
181required:
182  - compatible
183  - reg
184  - interrupts
185  - "#clock-cells"
186
187additionalProperties: false
188
189examples:
190  - |
191    #include <dt-bindings/clock/px30-cru.h>
192    #include <dt-bindings/pinctrl/rockchip.h>
193    #include <dt-bindings/interrupt-controller/irq.h>
194    #include <dt-bindings/gpio/gpio.h>
195    i2c {
196        #address-cells = <1>;
197        #size-cells = <0>;
198
199        rk817: pmic@20 {
200            compatible = "rockchip,rk817";
201            reg = <0x20>;
202            interrupt-parent = <&gpio0>;
203            interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>;
204            clock-output-names = "rk808-clkout1", "xin32k";
205            clock-names = "mclk";
206            clocks = <&cru SCLK_I2S1_OUT>;
207            pinctrl-names = "default";
208            pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>;
209            wakeup-source;
210            #clock-cells = <1>;
211            #sound-dai-cells = <0>;
212
213            vcc1-supply = <&vccsys>;
214            vcc2-supply = <&vccsys>;
215            vcc3-supply = <&vccsys>;
216            vcc4-supply = <&vccsys>;
217            vcc5-supply = <&vccsys>;
218            vcc6-supply = <&vccsys>;
219            vcc7-supply = <&vccsys>;
220
221            regulators {
222                vdd_logic: DCDC_REG1 {
223                    regulator-name = "vdd_logic";
224                    regulator-min-microvolt = <950000>;
225                    regulator-max-microvolt = <1150000>;
226                    regulator-ramp-delay = <6001>;
227                    regulator-always-on;
228                    regulator-boot-on;
229
230                    regulator-state-mem {
231                        regulator-on-in-suspend;
232                        regulator-suspend-microvolt = <950000>;
233                    };
234                };
235
236                vdd_arm: DCDC_REG2 {
237                    regulator-name = "vdd_arm";
238                    regulator-min-microvolt = <950000>;
239                    regulator-max-microvolt = <1350000>;
240                    regulator-ramp-delay = <6001>;
241                    regulator-always-on;
242                    regulator-boot-on;
243
244                    regulator-state-mem {
245                        regulator-off-in-suspend;
246                        regulator-suspend-microvolt = <950000>;
247                    };
248                };
249
250                vcc_ddr: DCDC_REG3 {
251                    regulator-name = "vcc_ddr";
252                    regulator-always-on;
253                    regulator-boot-on;
254
255                    regulator-state-mem {
256                        regulator-on-in-suspend;
257                    };
258                };
259
260                vcc_3v3: DCDC_REG4 {
261                    regulator-name = "vcc_3v3";
262                    regulator-min-microvolt = <3300000>;
263                    regulator-max-microvolt = <3300000>;
264                    regulator-always-on;
265                    regulator-boot-on;
266
267                    regulator-state-mem {
268                        regulator-off-in-suspend;
269                        regulator-suspend-microvolt = <3300000>;
270                    };
271                };
272
273                vcc_1v8: LDO_REG2 {
274                    regulator-name = "vcc_1v8";
275                    regulator-min-microvolt = <1800000>;
276                    regulator-max-microvolt = <1800000>;
277                    regulator-always-on;
278                    regulator-boot-on;
279
280                    regulator-state-mem {
281                        regulator-on-in-suspend;
282                        regulator-suspend-microvolt = <1800000>;
283                    };
284                };
285
286                vdd_1v0: LDO_REG3 {
287                    regulator-name = "vdd_1v0";
288                    regulator-min-microvolt = <1000000>;
289                    regulator-max-microvolt = <1000000>;
290                    regulator-always-on;
291                    regulator-boot-on;
292
293                    regulator-state-mem {
294                        regulator-on-in-suspend;
295                        regulator-suspend-microvolt = <1000000>;
296                    };
297                };
298
299                vcc3v3_pmu: LDO_REG4 {
300                    regulator-name = "vcc3v3_pmu";
301                    regulator-min-microvolt = <3300000>;
302                    regulator-max-microvolt = <3300000>;
303                    regulator-always-on;
304                    regulator-boot-on;
305
306                    regulator-state-mem {
307                        regulator-on-in-suspend;
308                        regulator-suspend-microvolt = <3300000>;
309                    };
310                };
311
312                vccio_sd: LDO_REG5 {
313                    regulator-name = "vccio_sd";
314                    regulator-min-microvolt = <1800000>;
315                    regulator-max-microvolt = <3300000>;
316                    regulator-always-on;
317                    regulator-boot-on;
318
319                    regulator-state-mem {
320                        regulator-on-in-suspend;
321                        regulator-suspend-microvolt = <3300000>;
322                    };
323                };
324
325                vcc_sd: LDO_REG6 {
326                    regulator-name = "vcc_sd";
327                    regulator-min-microvolt = <3300000>;
328                    regulator-max-microvolt = <3300000>;
329                    regulator-boot-on;
330
331                    regulator-state-mem {
332                        regulator-on-in-suspend;
333                        regulator-suspend-microvolt = <3300000>;
334                    };
335                };
336
337                vcc_bl: LDO_REG7 {
338                    regulator-name = "vcc_bl";
339                    regulator-min-microvolt = <3300000>;
340                    regulator-max-microvolt = <3300000>;
341
342                    regulator-state-mem {
343                        regulator-off-in-suspend;
344                        regulator-suspend-microvolt = <3300000>;
345                    };
346                };
347
348                vcc_lcd: LDO_REG8 {
349                    regulator-name = "vcc_lcd";
350                    regulator-min-microvolt = <2800000>;
351                    regulator-max-microvolt = <2800000>;
352
353                    regulator-state-mem {
354                        regulator-off-in-suspend;
355                        regulator-suspend-microvolt = <2800000>;
356                    };
357                };
358
359                vcc_cam: LDO_REG9 {
360                    regulator-name = "vcc_cam";
361                    regulator-min-microvolt = <3000000>;
362                    regulator-max-microvolt = <3000000>;
363
364                    regulator-state-mem {
365                        regulator-off-in-suspend;
366                        regulator-suspend-microvolt = <3000000>;
367                    };
368                };
369            };
370
371            rk817_charger: charger {
372                monitored-battery = <&battery>;
373                rockchip,resistor-sense-micro-ohms = <10000>;
374                rockchip,sleep-enter-current-microamp = <300000>;
375                rockchip,sleep-filter-current-microamp = <100000>;
376            };
377
378            rk817_codec: codec {
379                rockchip,mic-in-differential;
380            };
381        };
382    };
383