xref: /freebsd/sys/contrib/device-tree/Bindings/mfd/google,cros-ec.yaml (revision e67e85659c0de33e617e5fbf1028c6e8b49eee53)
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    allOf:
42      - $ref: /schemas/types.yaml#/definitions/uint32
43      - default: 0
44      - minimum: 0
45
46  google,cros-ec-spi-msg-delay:
47    description:
48      This property specifies the delay in usecs between messages.
49    allOf:
50      - $ref: /schemas/types.yaml#/definitions/uint32
51      - default: 0
52      - minimum: 0
53
54  google,has-vbc-nvram:
55    description:
56      Some implementations of the EC include a small nvram space used to
57      store verified boot context data. This boolean flag is used to specify
58      whether this nvram is present or not.
59    type: boolean
60
61  mediatek,rpmsg-name:
62    description:
63      Must be defined if the cros-ec is a rpmsg device for a Mediatek
64      ARM Cortex M4 Co-processor. Contains the name pf the rpmsg
65      device. Used to match the subnode to the rpmsg device announced by
66      the SCP.
67    $ref: "/schemas/types.yaml#/definitions/string"
68
69  spi-max-frequency:
70    description: Maximum SPI frequency of the device in Hz.
71
72  reg:
73    maxItems: 1
74
75  interrupts:
76    maxItems: 1
77
78  wakeup-source:
79    description: Button can wake-up the system.
80
81  '#address-cells':
82    const: 1
83
84  '#size-cells':
85    const: 0
86
87  typec:
88    $ref: "/schemas/chrome/google,cros-ec-typec.yaml#"
89
90  ec-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
151if:
152  properties:
153    compatible:
154      contains:
155        enum:
156          - google,cros-ec-i2c
157          - google,cros-ec-rpmsg
158then:
159  properties:
160    google,cros-ec-spi-pre-delay: false
161    google,cros-ec-spi-msg-delay: false
162    spi-max-frequency: false
163
164additionalProperties: false
165
166examples:
167  # Example for I2C
168  - |
169    #include <dt-bindings/gpio/gpio.h>
170    #include <dt-bindings/interrupt-controller/irq.h>
171
172    i2c0 {
173        #address-cells = <1>;
174        #size-cells = <0>;
175
176        cros-ec@1e {
177            compatible = "google,cros-ec-i2c";
178            reg = <0x1e>;
179            interrupts = <6 0>;
180            interrupt-parent = <&gpio0>;
181        };
182    };
183
184  # Example for SPI
185  - |
186    #include <dt-bindings/gpio/gpio.h>
187    #include <dt-bindings/interrupt-controller/irq.h>
188
189    spi0 {
190        #address-cells = <1>;
191        #size-cells = <0>;
192
193        cros-ec@0 {
194            compatible = "google,cros-ec-spi";
195            reg = <0x0>;
196            google,cros-ec-spi-msg-delay = <30>;
197            google,cros-ec-spi-pre-delay = <10>;
198            interrupts = <99 0>;
199            interrupt-parent = <&gpio7>;
200            spi-max-frequency = <5000000>;
201
202            proximity {
203                    compatible = "google,cros-ec-mkbp-proximity";
204            };
205
206            cbas {
207                compatible = "google,cros-cbas";
208            };
209        };
210    };
211
212  # Example for RPMSG
213  - |
214    scp0 {
215        cros-ec {
216            compatible = "google,cros-ec-rpmsg";
217        };
218    };
219...
220