xref: /linux/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml (revision 7255fcc80d4b525cc10cfaaf7f485830d4ed2000)
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mfd/google,cros-ec.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: ChromeOS Embedded Controller
8
9maintainers:
10  - Benson Leung <bleung@chromium.org>
11  - Guenter Roeck <groeck@chromium.org>
12
13description:
14  Google's ChromeOS EC is a microcontroller which talks to the AP and
15  implements various functions such as keyboard and battery charging.
16  The EC can be connected through various interfaces (I2C, SPI, and others)
17  and the compatible string specifies which interface is being used.
18
19properties:
20  compatible:
21    oneOf:
22      - description:
23          For implementations of the EC connected through I2C.
24        const: google,cros-ec-i2c
25      - description:
26          For implementations of the EC connected through SPI.
27        const: google,cros-ec-spi
28      - description:
29          For implementations of the FPMCU connected through SPI.
30        items:
31          - const: google,cros-ec-fp
32          - const: google,cros-ec-spi
33      - description:
34          For implementations of the EC connected through RPMSG.
35        const: google,cros-ec-rpmsg
36      - description:
37          For implementations of the EC connected through UART.
38        const: google,cros-ec-uart
39
40  controller-data: true
41
42  google,cros-ec-spi-pre-delay:
43    description:
44      This property specifies the delay in usecs between the
45      assertion of the CS and the first clock pulse.
46    $ref: /schemas/types.yaml#/definitions/uint32
47    default: 0
48
49  google,cros-ec-spi-msg-delay:
50    description:
51      This property specifies the delay in usecs between messages.
52    $ref: /schemas/types.yaml#/definitions/uint32
53    default: 0
54
55  google,has-vbc-nvram:
56    description:
57      Some implementations of the EC include a small nvram space used to
58      store verified boot context data. This boolean flag is used to specify
59      whether this nvram is present or not.
60    type: boolean
61
62  mediatek,rpmsg-name:
63    description:
64      Must be defined if the cros-ec is a rpmsg device for a Mediatek
65      ARM Cortex M4 Co-processor. Contains the name of the rpmsg
66      device. Used to match the subnode to the rpmsg device announced by
67      the SCP.
68    $ref: /schemas/types.yaml#/definitions/string
69
70  spi-max-frequency: true
71
72  reg:
73    maxItems: 1
74
75  interrupts:
76    maxItems: 1
77
78  reset-gpios:
79    maxItems: 1
80
81  boot0-gpios:
82    maxItems: 1
83    description: Assert for bootloader mode.
84
85  vdd-supply: true
86
87  wakeup-source:
88    description: Button can wake-up the system.
89
90  '#address-cells':
91    const: 1
92
93  '#size-cells':
94    const: 0
95
96  '#gpio-cells':
97    const: 2
98
99  gpio-controller: true
100
101  typec:
102    $ref: /schemas/chrome/google,cros-ec-typec.yaml#
103
104  ec-pwm:
105    $ref: /schemas/pwm/google,cros-ec-pwm.yaml#
106    deprecated: true
107
108  pwm:
109    $ref: /schemas/pwm/google,cros-ec-pwm.yaml#
110
111  kbd-led-backlight:
112    $ref: /schemas/chrome/google,cros-kbd-led-backlight.yaml#
113
114  keyboard-controller:
115    $ref: /schemas/input/google,cros-ec-keyb.yaml#
116
117  proximity:
118    $ref: /schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#
119
120  codecs:
121    type: object
122    additionalProperties: false
123
124    properties:
125      '#address-cells':
126        const: 2
127
128      '#size-cells':
129        const: 1
130
131    patternProperties:
132      "^ec-codec@[a-f0-9]+$":
133        type: object
134        $ref: /schemas/sound/google,cros-ec-codec.yaml#
135
136    required:
137      - "#address-cells"
138      - "#size-cells"
139
140  cbas:
141    type: object
142
143    description:
144      This device is used to signal when a detachable base is attached
145      to a Chrome OS tablet. This device cannot be detected at runtime.
146
147    properties:
148      compatible:
149        const: google,cros-cbas
150
151    required:
152      - compatible
153
154    additionalProperties: false
155
156patternProperties:
157  "^i2c-tunnel[0-9]*$":
158    type: object
159    $ref: /schemas/i2c/google,cros-ec-i2c-tunnel.yaml#
160
161  "^regulator@[0-9]+$":
162    type: object
163    $ref: /schemas/regulator/google,cros-ec-regulator.yaml#
164
165  "^extcon[0-9]*$":
166    type: object
167    $ref: /schemas/extcon/extcon-usbc-cros-ec.yaml#
168
169required:
170  - compatible
171
172allOf:
173  - if:
174      properties:
175        compatible:
176          not:
177            contains:
178              const: google,cros-ec-spi
179    then:
180      properties:
181        controller-data: false
182        google,cros-ec-spi-pre-delay: false
183        google,cros-ec-spi-msg-delay: false
184        spi-max-frequency: false
185    else:
186      $ref: /schemas/spi/spi-peripheral-props.yaml
187
188  - if:
189      properties:
190        compatible:
191          not:
192            contains:
193              const: google,cros-ec-rpmsg
194    then:
195      properties:
196        mediatek,rpmsg-name: false
197
198  - if:
199      properties:
200        compatible:
201          not:
202            contains:
203              enum:
204                - google,cros-ec-rpmsg
205                - google,cros-ec-uart
206    then:
207      required:
208        - reg
209        - interrupts
210
211  - if:
212      properties:
213        compatible:
214          contains:
215            const: google,cros-ec-fp
216    then:
217      properties:
218        '#address-cells': false
219        '#size-cells': false
220        typec: false
221        ec-pwm: false
222        kbd-led-backlight: false
223        keyboard-controller: false
224        proximity: false
225        codecs: false
226        cbas: false
227
228      patternProperties:
229        "^i2c-tunnel[0-9]*$": false
230        "^regulator@[0-9]+$": false
231        "^extcon[0-9]*$": false
232
233      # Using additionalProperties: false here and
234      # listing true properties doesn't work
235
236      required:
237        - reset-gpios
238        - boot0-gpios
239        - vdd-supply
240    else:
241      properties:
242        reset-gpios: false
243        boot0-gpios: false
244        vdd-supply: false
245
246additionalProperties: false
247
248examples:
249  # Example for I2C
250  - |
251    #include <dt-bindings/gpio/gpio.h>
252    #include <dt-bindings/interrupt-controller/irq.h>
253
254    i2c {
255        #address-cells = <1>;
256        #size-cells = <0>;
257
258        cros-ec@1e {
259            compatible = "google,cros-ec-i2c";
260            reg = <0x1e>;
261            interrupts = <6 0>;
262            interrupt-parent = <&gpio0>;
263        };
264    };
265
266  # Example for SPI
267  - |
268    #include <dt-bindings/gpio/gpio.h>
269    #include <dt-bindings/interrupt-controller/irq.h>
270
271    spi {
272        #address-cells = <1>;
273        #size-cells = <0>;
274
275        cros-ec@0 {
276            compatible = "google,cros-ec-spi";
277            reg = <0x0>;
278            google,cros-ec-spi-msg-delay = <30>;
279            google,cros-ec-spi-pre-delay = <10>;
280            interrupts = <99 0>;
281            interrupt-parent = <&gpio7>;
282            spi-max-frequency = <5000000>;
283            #gpio-cells = <2>;
284            gpio-controller;
285
286            proximity {
287                compatible = "google,cros-ec-mkbp-proximity";
288            };
289
290            cbas {
291                compatible = "google,cros-cbas";
292            };
293        };
294    };
295
296  # Example for RPMSG
297  - |
298    scp0 {
299        cros-ec {
300            compatible = "google,cros-ec-rpmsg";
301        };
302    };
303
304  # Example for FPMCU
305  - |
306    spi {
307      #address-cells = <0x1>;
308      #size-cells = <0x0>;
309
310      ec@0 {
311        compatible = "google,cros-ec-fp", "google,cros-ec-spi";
312        reg = <0x0>;
313        interrupt-parent = <&gpio_controller>;
314        interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
315        spi-max-frequency = <3000000>;
316        reset-gpios = <&gpio_controller 5 GPIO_ACTIVE_LOW>;
317        boot0-gpios = <&gpio_controller 10 GPIO_ACTIVE_HIGH>;
318        vdd-supply = <&pp3300_fp_mcu>;
319      };
320    };
321
322  # Example for UART
323  - |
324    serial {
325        cros-ec {
326            compatible = "google,cros-ec-uart";
327        };
328    };
329...
330