xref: /freebsd/sys/contrib/device-tree/Bindings/mfd/google,cros-ec.yaml (revision fac71e4e09885bb2afa3d984a0c239a52e1a7418)
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  typec:
97    $ref: /schemas/chrome/google,cros-ec-typec.yaml#
98
99  ec-pwm:
100    $ref: /schemas/pwm/google,cros-ec-pwm.yaml#
101    deprecated: true
102
103  pwm:
104    $ref: /schemas/pwm/google,cros-ec-pwm.yaml#
105
106  kbd-led-backlight:
107    $ref: /schemas/chrome/google,cros-kbd-led-backlight.yaml#
108
109  keyboard-controller:
110    $ref: /schemas/input/google,cros-ec-keyb.yaml#
111
112  proximity:
113    $ref: /schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#
114
115  codecs:
116    type: object
117    additionalProperties: false
118
119    properties:
120      '#address-cells':
121        const: 2
122
123      '#size-cells':
124        const: 1
125
126    patternProperties:
127      "^ec-codec@[a-f0-9]+$":
128        type: object
129        $ref: /schemas/sound/google,cros-ec-codec.yaml#
130
131    required:
132      - "#address-cells"
133      - "#size-cells"
134
135  cbas:
136    type: object
137
138    description:
139      This device is used to signal when a detachable base is attached
140      to a Chrome OS tablet. This device cannot be detected at runtime.
141
142    properties:
143      compatible:
144        const: google,cros-cbas
145
146    required:
147      - compatible
148
149    additionalProperties: false
150
151patternProperties:
152  "^i2c-tunnel[0-9]*$":
153    type: object
154    $ref: /schemas/i2c/google,cros-ec-i2c-tunnel.yaml#
155
156  "^regulator@[0-9]+$":
157    type: object
158    $ref: /schemas/regulator/google,cros-ec-regulator.yaml#
159
160  "^extcon[0-9]*$":
161    type: object
162    $ref: /schemas/extcon/extcon-usbc-cros-ec.yaml#
163
164required:
165  - compatible
166
167allOf:
168  - if:
169      properties:
170        compatible:
171          not:
172            contains:
173              const: google,cros-ec-spi
174    then:
175      properties:
176        controller-data: false
177        google,cros-ec-spi-pre-delay: false
178        google,cros-ec-spi-msg-delay: false
179        spi-max-frequency: false
180    else:
181      $ref: /schemas/spi/spi-peripheral-props.yaml
182
183  - if:
184      properties:
185        compatible:
186          not:
187            contains:
188              const: google,cros-ec-rpmsg
189    then:
190      properties:
191        mediatek,rpmsg-name: false
192
193  - if:
194      properties:
195        compatible:
196          not:
197            contains:
198              enum:
199                - google,cros-ec-rpmsg
200                - google,cros-ec-uart
201    then:
202      required:
203        - reg
204        - interrupts
205
206  - if:
207      properties:
208        compatible:
209          contains:
210            const: google,cros-ec-fp
211    then:
212      properties:
213        '#address-cells': false
214        '#size-cells': false
215        typec: false
216        ec-pwm: false
217        kbd-led-backlight: false
218        keyboard-controller: false
219        proximity: false
220        codecs: false
221        cbas: false
222
223      patternProperties:
224        "^i2c-tunnel[0-9]*$": false
225        "^regulator@[0-9]+$": false
226        "^extcon[0-9]*$": false
227
228      # Using additionalProperties: false here and
229      # listing true properties doesn't work
230
231      required:
232        - reset-gpios
233        - boot0-gpios
234        - vdd-supply
235    else:
236      properties:
237        reset-gpios: false
238        boot0-gpios: false
239        vdd-supply: false
240
241additionalProperties: false
242
243examples:
244  # Example for I2C
245  - |
246    #include <dt-bindings/gpio/gpio.h>
247    #include <dt-bindings/interrupt-controller/irq.h>
248
249    i2c {
250        #address-cells = <1>;
251        #size-cells = <0>;
252
253        cros-ec@1e {
254            compatible = "google,cros-ec-i2c";
255            reg = <0x1e>;
256            interrupts = <6 0>;
257            interrupt-parent = <&gpio0>;
258        };
259    };
260
261  # Example for SPI
262  - |
263    #include <dt-bindings/gpio/gpio.h>
264    #include <dt-bindings/interrupt-controller/irq.h>
265
266    spi {
267        #address-cells = <1>;
268        #size-cells = <0>;
269
270        cros-ec@0 {
271            compatible = "google,cros-ec-spi";
272            reg = <0x0>;
273            google,cros-ec-spi-msg-delay = <30>;
274            google,cros-ec-spi-pre-delay = <10>;
275            interrupts = <99 0>;
276            interrupt-parent = <&gpio7>;
277            spi-max-frequency = <5000000>;
278
279            proximity {
280                compatible = "google,cros-ec-mkbp-proximity";
281            };
282
283            cbas {
284                compatible = "google,cros-cbas";
285            };
286        };
287    };
288
289  # Example for RPMSG
290  - |
291    scp0 {
292        cros-ec {
293            compatible = "google,cros-ec-rpmsg";
294        };
295    };
296
297  # Example for FPMCU
298  - |
299    spi {
300      #address-cells = <0x1>;
301      #size-cells = <0x0>;
302
303      ec@0 {
304        compatible = "google,cros-ec-fp", "google,cros-ec-spi";
305        reg = <0x0>;
306        interrupt-parent = <&gpio_controller>;
307        interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
308        spi-max-frequency = <3000000>;
309        reset-gpios = <&gpio_controller 5 GPIO_ACTIVE_LOW>;
310        boot0-gpios = <&gpio_controller 10 GPIO_ACTIVE_HIGH>;
311        vdd-supply = <&pp3300_fp_mcu>;
312      };
313    };
314
315  # Example for UART
316  - |
317    serial {
318        cros-ec {
319            compatible = "google,cros-ec-uart";
320        };
321    };
322...
323