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 is connected through I2C.
24        const: google,cros-ec-i2c
25      - description:
26          For implementations of the EC is connected through SPI.
27        const: google,cros-ec-spi
28      - description:
29          For implementations of the EC is connected through RPMSG.
30        const: google,cros-ec-rpmsg
31
32  controller-data:
33    description:
34      SPI controller data, see bindings/spi/samsung,spi-peripheral-props.yaml
35    type: object
36
37  google,cros-ec-spi-pre-delay:
38    description:
39      This property specifies the delay in usecs between the
40      assertion of the CS and the first clock pulse.
41    $ref: /schemas/types.yaml#/definitions/uint32
42    default: 0
43
44  google,cros-ec-spi-msg-delay:
45    description:
46      This property specifies the delay in usecs between messages.
47    $ref: /schemas/types.yaml#/definitions/uint32
48    default: 0
49
50  google,has-vbc-nvram:
51    description:
52      Some implementations of the EC include a small nvram space used to
53      store verified boot context data. This boolean flag is used to specify
54      whether this nvram is present or not.
55    type: boolean
56
57  mediatek,rpmsg-name:
58    description:
59      Must be defined if the cros-ec is a rpmsg device for a Mediatek
60      ARM Cortex M4 Co-processor. Contains the name of the rpmsg
61      device. Used to match the subnode to the rpmsg device announced by
62      the SCP.
63    $ref: "/schemas/types.yaml#/definitions/string"
64
65  spi-max-frequency:
66    description: Maximum SPI frequency of the device in Hz.
67
68  reg:
69    maxItems: 1
70
71  interrupts:
72    maxItems: 1
73
74  wakeup-source:
75    description: Button can wake-up the system.
76
77  '#address-cells':
78    const: 1
79
80  '#size-cells':
81    const: 0
82
83  typec:
84    $ref: "/schemas/chrome/google,cros-ec-typec.yaml#"
85
86  ec-pwm:
87    $ref: "/schemas/pwm/google,cros-ec-pwm.yaml#"
88    deprecated: true
89
90  pwm:
91    $ref: "/schemas/pwm/google,cros-ec-pwm.yaml#"
92
93  keyboard-controller:
94    $ref: "/schemas/input/google,cros-ec-keyb.yaml#"
95
96  proximity:
97    $ref: "/schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#"
98
99  codecs:
100    type: object
101    additionalProperties: false
102
103    properties:
104      '#address-cells':
105        const: 2
106
107      '#size-cells':
108        const: 1
109
110    patternProperties:
111      "^ec-codec@[a-f0-9]+$":
112        type: object
113        $ref: "/schemas/sound/google,cros-ec-codec.yaml#"
114
115    required:
116      - "#address-cells"
117      - "#size-cells"
118
119  cbas:
120    type: object
121
122    description:
123      This device is used to signal when a detachable base is attached
124      to a Chrome OS tablet. This device cannot be detected at runtime.
125
126    properties:
127      compatible:
128        const: google,cros-cbas
129
130    required:
131      - compatible
132
133    additionalProperties: false
134
135patternProperties:
136  "^i2c-tunnel[0-9]*$":
137    type: object
138    $ref: "/schemas/i2c/google,cros-ec-i2c-tunnel.yaml#"
139
140  "^regulator@[0-9]+$":
141    type: object
142    $ref: "/schemas/regulator/google,cros-ec-regulator.yaml#"
143
144  "^extcon[0-9]*$":
145    type: object
146    $ref: "/schemas/extcon/extcon-usbc-cros-ec.yaml#"
147
148required:
149  - compatible
150
151allOf:
152  - if:
153      properties:
154        compatible:
155          contains:
156            enum:
157              - google,cros-ec-i2c
158              - google,cros-ec-rpmsg
159    then:
160      properties:
161        google,cros-ec-spi-pre-delay: false
162        google,cros-ec-spi-msg-delay: false
163        spi-max-frequency: false
164    else:
165      $ref: /schemas/spi/spi-peripheral-props.yaml
166
167additionalProperties: false
168
169examples:
170  # Example for I2C
171  - |
172    #include <dt-bindings/gpio/gpio.h>
173    #include <dt-bindings/interrupt-controller/irq.h>
174
175    i2c0 {
176        #address-cells = <1>;
177        #size-cells = <0>;
178
179        cros-ec@1e {
180            compatible = "google,cros-ec-i2c";
181            reg = <0x1e>;
182            interrupts = <6 0>;
183            interrupt-parent = <&gpio0>;
184        };
185    };
186
187  # Example for SPI
188  - |
189    #include <dt-bindings/gpio/gpio.h>
190    #include <dt-bindings/interrupt-controller/irq.h>
191
192    spi0 {
193        #address-cells = <1>;
194        #size-cells = <0>;
195
196        cros-ec@0 {
197            compatible = "google,cros-ec-spi";
198            reg = <0x0>;
199            google,cros-ec-spi-msg-delay = <30>;
200            google,cros-ec-spi-pre-delay = <10>;
201            interrupts = <99 0>;
202            interrupt-parent = <&gpio7>;
203            spi-max-frequency = <5000000>;
204
205            proximity {
206                compatible = "google,cros-ec-mkbp-proximity";
207            };
208
209            cbas {
210                compatible = "google,cros-cbas";
211            };
212        };
213    };
214
215  # Example for RPMSG
216  - |
217    scp0 {
218        cros-ec {
219            compatible = "google,cros-ec-rpmsg";
220        };
221    };
222...
223