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/spi-samsung.txt
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 pf 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
89  keyboard-controller:
90    $ref: "/schemas/input/google,cros-ec-keyb.yaml#"
91
92  proximity:
93    $ref: "/schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#"
94
95  codecs:
96    type: object
97    additionalProperties: false
98
99    properties:
100      '#address-cells':
101        const: 2
102
103      '#size-cells':
104        const: 1
105
106    patternProperties:
107      "^ec-codec@[a-f0-9]+$":
108        type: object
109        $ref: "/schemas/sound/google,cros-ec-codec.yaml#"
110
111    required:
112      - "#address-cells"
113      - "#size-cells"
114
115  cbas:
116    type: object
117
118    description:
119      This device is used to signal when a detachable base is attached
120      to a Chrome OS tablet. This device cannot be detected at runtime.
121
122    properties:
123      compatible:
124        const: google,cros-cbas
125
126    required:
127      - compatible
128
129    additionalProperties: false
130
131patternProperties:
132  "^i2c-tunnel[0-9]*$":
133    type: object
134    $ref: "/schemas/i2c/google,cros-ec-i2c-tunnel.yaml#"
135
136  "^regulator@[0-9]+$":
137    type: object
138    $ref: "/schemas/regulator/google,cros-ec-regulator.yaml#"
139
140  "^extcon[0-9]*$":
141    type: object
142    $ref: "/schemas/extcon/extcon-usbc-cros-ec.yaml#"
143
144required:
145  - compatible
146
147if:
148  properties:
149    compatible:
150      contains:
151        enum:
152          - google,cros-ec-i2c
153          - google,cros-ec-rpmsg
154then:
155  properties:
156    google,cros-ec-spi-pre-delay: false
157    google,cros-ec-spi-msg-delay: false
158    spi-max-frequency: false
159
160additionalProperties: false
161
162examples:
163  # Example for I2C
164  - |
165    #include <dt-bindings/gpio/gpio.h>
166    #include <dt-bindings/interrupt-controller/irq.h>
167
168    i2c0 {
169        #address-cells = <1>;
170        #size-cells = <0>;
171
172        cros-ec@1e {
173            compatible = "google,cros-ec-i2c";
174            reg = <0x1e>;
175            interrupts = <6 0>;
176            interrupt-parent = <&gpio0>;
177        };
178    };
179
180  # Example for SPI
181  - |
182    #include <dt-bindings/gpio/gpio.h>
183    #include <dt-bindings/interrupt-controller/irq.h>
184
185    spi0 {
186        #address-cells = <1>;
187        #size-cells = <0>;
188
189        cros-ec@0 {
190            compatible = "google,cros-ec-spi";
191            reg = <0x0>;
192            google,cros-ec-spi-msg-delay = <30>;
193            google,cros-ec-spi-pre-delay = <10>;
194            interrupts = <99 0>;
195            interrupt-parent = <&gpio7>;
196            spi-max-frequency = <5000000>;
197
198            proximity {
199                    compatible = "google,cros-ec-mkbp-proximity";
200            };
201
202            cbas {
203                compatible = "google,cros-cbas";
204            };
205        };
206    };
207
208  # Example for RPMSG
209  - |
210    scp0 {
211        cros-ec {
212            compatible = "google,cros-ec-rpmsg";
213        };
214    };
215...
216