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  - Enric Balletbo i Serra <enric.balletbo@collabora.com>
12  - Guenter Roeck <groeck@chromium.org>
13
14description:
15  Google's ChromeOS EC is a microcontroller which talks to the AP and
16  implements various functions such as keyboard and battery charging.
17  The EC can be connected through various interfaces (I2C, SPI, and others)
18  and the compatible string specifies which interface is being used.
19
20properties:
21  compatible:
22    oneOf:
23      - description:
24          For implementations of the EC is connected through I2C.
25        const: google,cros-ec-i2c
26      - description:
27          For implementations of the EC is connected through SPI.
28        const: google,cros-ec-spi
29      - description:
30          For implementations of the EC is connected through RPMSG.
31        const: google,cros-ec-rpmsg
32
33  controller-data:
34    description:
35      SPI controller data, see bindings/spi/spi-samsung.txt
36    type: object
37
38  google,cros-ec-spi-pre-delay:
39    description:
40      This property specifies the delay in usecs between the
41      assertion of the CS and the first clock pulse.
42    allOf:
43      - $ref: /schemas/types.yaml#/definitions/uint32
44      - default: 0
45      - minimum: 0
46
47  google,cros-ec-spi-msg-delay:
48    description:
49      This property specifies the delay in usecs between messages.
50    allOf:
51      - $ref: /schemas/types.yaml#/definitions/uint32
52      - default: 0
53      - minimum: 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  mtk,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 pf 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:
71    description: Maximum SPI frequency of the device in Hz.
72
73  reg:
74    maxItems: 1
75
76  interrupts:
77    maxItems: 1
78
79  wakeup-source:
80    description: Button can wake-up the system.
81
82  '#address-cells':
83    const: 1
84
85  '#size-cells':
86    const: 0
87
88  typec:
89    $ref: "/schemas/chrome/google,cros-ec-typec.yaml#"
90
91  ec-pwm:
92    $ref: "/schemas/pwm/google,cros-ec-pwm.yaml#"
93
94  keyboard-controller:
95    $ref: "/schemas/input/google,cros-ec-keyb.yaml#"
96
97  proximity:
98    $ref: "/schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#"
99
100  codecs:
101    type: object
102    additionalProperties: false
103
104    properties:
105      '#address-cells':
106        const: 2
107
108      '#size-cells':
109        const: 1
110
111    patternProperties:
112      "^ec-codec@[a-f0-9]+$":
113        type: object
114        $ref: "/schemas/sound/google,cros-ec-codec.yaml#"
115
116    required:
117      - "#address-cells"
118      - "#size-cells"
119
120  cbas:
121    type: object
122
123    description:
124      This device is used to signal when a detachable base is attached
125      to a Chrome OS tablet. This device cannot be detected at runtime.
126
127    properties:
128      compatible:
129        const: google,cros-cbas
130
131    required:
132      - compatible
133
134    additionalProperties: false
135
136patternProperties:
137  "^i2c-tunnel[0-9]*$":
138    type: object
139    $ref: "/schemas/i2c/google,cros-ec-i2c-tunnel.yaml#"
140
141  "^regulator@[0-9]+$":
142    type: object
143    $ref: "/schemas/regulator/google,cros-ec-regulator.yaml#"
144
145  "^extcon[0-9]*$":
146    type: object
147    $ref: "/schemas/extcon/extcon-usbc-cros-ec.yaml#"
148
149required:
150  - compatible
151
152if:
153  properties:
154    compatible:
155      contains:
156        enum:
157          - google,cros-ec-i2c
158          - google,cros-ec-rpmsg
159then:
160  properties:
161    google,cros-ec-spi-pre-delay: false
162    google,cros-ec-spi-msg-delay: false
163    spi-max-frequency: false
164
165additionalProperties: false
166
167examples:
168  # Example for I2C
169  - |
170    #include <dt-bindings/gpio/gpio.h>
171    #include <dt-bindings/interrupt-controller/irq.h>
172
173    i2c0 {
174        #address-cells = <1>;
175        #size-cells = <0>;
176
177        cros-ec@1e {
178            compatible = "google,cros-ec-i2c";
179            reg = <0x1e>;
180            interrupts = <6 0>;
181            interrupt-parent = <&gpio0>;
182        };
183    };
184
185  # Example for SPI
186  - |
187    #include <dt-bindings/gpio/gpio.h>
188    #include <dt-bindings/interrupt-controller/irq.h>
189
190    spi0 {
191        #address-cells = <1>;
192        #size-cells = <0>;
193
194        cros-ec@0 {
195            compatible = "google,cros-ec-spi";
196            reg = <0x0>;
197            google,cros-ec-spi-msg-delay = <30>;
198            google,cros-ec-spi-pre-delay = <10>;
199            interrupts = <99 0>;
200            interrupt-parent = <&gpio7>;
201            spi-max-frequency = <5000000>;
202
203            proximity {
204                    compatible = "google,cros-ec-mkbp-proximity";
205            };
206
207            cbas {
208                compatible = "google,cros-cbas";
209            };
210        };
211    };
212
213  # Example for RPMSG
214  - |
215    scp0 {
216        cros-ec {
217            compatible = "google,cros-ec-rpmsg";
218        };
219    };
220...
221