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