1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mfd/mediatek,mt6370.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: MediaTek MT6370 SubPMIC
8
9maintainers:
10  - ChiYuan Huang <cy_huang@richtek.com>
11
12description: |
13  MT6370 is a highly-integrated smart power management IC, which includes a
14  single cell Li-Ion/Li-Polymer switching battery charger, a USB Type-C &
15  Power Delivery (PD) controller, dual flash LED current sources, a RGB LED
16  driver, a backlight WLED driver, a display bias driver and a general LDO for
17  portable devices.
18
19properties:
20  compatible:
21    const: mediatek,mt6370
22
23  reg:
24    maxItems: 1
25
26  wakeup-source: true
27
28  interrupts:
29    maxItems: 1
30
31  interrupt-controller: true
32
33  "#interrupt-cells":
34    const: 1
35
36  adc:
37    type: object
38    additionalProperties: false
39    description: |
40      Provides 9 channels for system monitoring, including VBUSDIV5 (lower
41      accuracy, higher measure range), VBUSDIV2 (higher accuracy, lower
42      measure range), VBAT, VSYS, CHG_VDDP, TS_BAT, IBUS, IBAT, and TEMP_JC.
43
44    properties:
45      compatible:
46        const: mediatek,mt6370-adc
47
48      "#io-channel-cells":
49        const: 1
50
51    required:
52      - compatible
53      - "#io-channel-cells"
54
55  backlight:
56    type: object
57    $ref: /schemas/leds/backlight/mediatek,mt6370-backlight.yaml#
58
59  charger:
60    type: object
61    $ref: /schemas/power/supply/mediatek,mt6370-charger.yaml#
62
63  tcpc:
64    type: object
65    $ref: /schemas/usb/mediatek,mt6370-tcpc.yaml#
66
67  indicator:
68    type: object
69    $ref: /schemas/leds/mediatek,mt6370-indicator.yaml#
70
71  flashlight:
72    type: object
73    $ref: /schemas/leds/mediatek,mt6370-flashlight.yaml#
74
75  regulators:
76    type: object
77    additionalProperties: false
78    description: |
79      List all supported regulators, which support the control for DisplayBias
80      voltages and one general purpose LDO which commonly used to drive the
81      vibrator.
82
83    patternProperties:
84      "^(dsvbst|vibldo)$":
85        $ref: /schemas/regulator/regulator.yaml#
86        type: object
87        unevaluatedProperties: false
88
89      "^(dsvpos|dsvneg)$":
90        $ref: /schemas/regulator/regulator.yaml#
91        type: object
92        unevaluatedProperties: false
93
94        properties:
95          enable-gpios:
96            maxItems: 1
97
98required:
99  - compatible
100  - reg
101  - interrupts
102  - interrupt-controller
103  - "#interrupt-cells"
104  - regulators
105  - adc
106  - backlight
107  - indicator
108  - tcpc
109  - charger
110  - flashlight
111
112additionalProperties: false
113
114examples:
115  - |
116    #include <dt-bindings/interrupt-controller/irq.h>
117    #include <dt-bindings/leds/common.h>
118    #include <dt-bindings/iio/adc/mediatek,mt6370_adc.h>
119    #include <dt-bindings/usb/pd.h>
120    i2c {
121      #address-cells = <1>;
122      #size-cells = <0>;
123
124      pmic@34 {
125        compatible = "mediatek,mt6370";
126        reg = <0x34>;
127        wakeup-source;
128        interrupts-extended = <&gpio26 3 IRQ_TYPE_LEVEL_LOW>;
129        interrupt-controller;
130        #interrupt-cells = <1>;
131
132        mt6370_adc: adc {
133          compatible = "mediatek,mt6370-adc";
134          #io-channel-cells = <1>;
135        };
136
137        backlight {
138          compatible = "mediatek,mt6370-backlight";
139          mediatek,bled-channel-use = /bits/ 8 <15>;
140        };
141
142        charger {
143          compatible = "mediatek,mt6370-charger";
144          interrupts = <68>, <48>, <6>;
145          interrupt-names = "uvp_d_evt", "attach_i", "mivr";
146          io-channels = <&mt6370_adc MT6370_CHAN_IBUS>;
147
148          mt6370_otg_vbus: usb-otg-vbus-regulator {
149            regulator-name = "mt6370-usb-otg-vbus";
150            regulator-min-microvolt = <4350000>;
151            regulator-max-microvolt = <5800000>;
152            regulator-min-microamp = <500000>;
153            regulator-max-microamp = <3000000>;
154          };
155        };
156
157        indicator {
158          compatible = "mediatek,mt6370-indicator";
159          #address-cells = <1>;
160          #size-cells = <0>;
161
162          multi-led@0 {
163            reg = <0>;
164            function = LED_FUNCTION_INDICATOR;
165            color = <LED_COLOR_ID_RGB>;
166            led-max-microamp = <24000>;
167            #address-cells = <1>;
168            #size-cells = <0>;
169            led@0 {
170              reg = <0>;
171              color = <LED_COLOR_ID_RED>;
172            };
173            led@1 {
174              reg = <1>;
175              color = <LED_COLOR_ID_GREEN>;
176            };
177            led@2 {
178              reg = <2>;
179              color = <LED_COLOR_ID_BLUE>;
180            };
181          };
182          led@3 {
183            reg = <3>;
184            function = LED_FUNCTION_INDICATOR;
185            color = <LED_COLOR_ID_WHITE>;
186            led-max-microamp = <6000>;
187          };
188        };
189
190        flashlight {
191          compatible = "mediatek,mt6370-flashlight";
192          #address-cells = <1>;
193          #size-cells = <0>;
194          led@0 {
195            reg = <0>;
196            led-sources = <0>;
197            function = LED_FUNCTION_FLASH;
198            color = <LED_COLOR_ID_WHITE>;
199            function-enumerator = <1>;
200            led-max-microamp = <200000>;
201            flash-max-microamp = <500000>;
202            flash-max-timeout-us = <1248000>;
203          };
204          led@1 {
205            reg = <1>;
206            led-sources = <1>;
207            function = LED_FUNCTION_FLASH;
208            color = <LED_COLOR_ID_WHITE>;
209            function-enumerator = <2>;
210            led-max-microamp = <200000>;
211            flash-max-microamp = <500000>;
212            flash-max-timeout-us = <1248000>;
213          };
214        };
215
216        tcpc {
217          compatible = "mediatek,mt6370-tcpc";
218          interrupts-extended = <&gpio26 4 IRQ_TYPE_LEVEL_LOW>;
219
220          connector {
221            compatible = "usb-c-connector";
222            label = "USB-C";
223            vbus-supply = <&mt6370_otg_vbus>;
224            data-role = "dual";
225            power-role = "dual";
226            try-power-role = "sink";
227            source-pdos = <PDO_FIXED(5000, 1000, PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP)>;
228            sink-pdos = <PDO_FIXED(5000, 2000, PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP)>;
229            op-sink-microwatt = <10000000>;
230
231            ports {
232              #address-cells = <1>;
233              #size-cells = <0>;
234
235              port@0 {
236                reg = <0>;
237                endpoint {
238                  remote-endpoint = <&usb_hs>;
239                };
240              };
241              port@1 {
242                reg = <1>;
243                endpoint {
244                  remote-endpoint = <&usb_ss>;
245                };
246              };
247              port@2 {
248                reg = <2>;
249                endpoint {
250                  remote-endpoint = <&dp_aux>;
251                };
252              };
253            };
254          };
255        };
256
257        regulators {
258          dsvbst {
259            regulator-name = "mt6370-dsv-vbst";
260            regulator-min-microvolt = <4000000>;
261            regulator-max-microvolt = <6200000>;
262          };
263          dsvpos {
264            regulator-name = "mt6370-dsv-vpos";
265            regulator-min-microvolt = <4000000>;
266            regulator-max-microvolt = <6000000>;
267            regulator-boot-on;
268          };
269          dsvneg {
270            regulator-name = "mt6370-dsv-vneg";
271            regulator-min-microvolt = <4000000>;
272            regulator-max-microvolt = <6000000>;
273            regulator-boot-on;
274          };
275          vibldo {
276            regulator-name = "mt6370-vib-ldo";
277            regulator-min-microvolt = <1600000>;
278            regulator-max-microvolt = <4000000>;
279          };
280        };
281      };
282    };
283