xref: /freebsd/sys/contrib/device-tree/Bindings/mfd/google,cros-ec.yaml (revision 8bab661a3316d8bd9b9fbd11a3b4371b91507bd2)
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 connected through I2C.
24        const: google,cros-ec-i2c
25      - description:
26          For implementations of the EC connected through SPI.
27        const: google,cros-ec-spi
28      - description:
29          For implementations of the FPMCU connected through SPI.
30        items:
31          - const: google,cros-ec-fp
32          - const: google,cros-ec-spi
33      - description:
34          For implementations of the EC connected through RPMSG.
35        const: google,cros-ec-rpmsg
36
37  controller-data: true
38
39  google,cros-ec-spi-pre-delay:
40    description:
41      This property specifies the delay in usecs between the
42      assertion of the CS and the first clock pulse.
43    $ref: /schemas/types.yaml#/definitions/uint32
44    default: 0
45
46  google,cros-ec-spi-msg-delay:
47    description:
48      This property specifies the delay in usecs between messages.
49    $ref: /schemas/types.yaml#/definitions/uint32
50    default: 0
51
52  google,has-vbc-nvram:
53    description:
54      Some implementations of the EC include a small nvram space used to
55      store verified boot context data. This boolean flag is used to specify
56      whether this nvram is present or not.
57    type: boolean
58
59  mediatek,rpmsg-name:
60    description:
61      Must be defined if the cros-ec is a rpmsg device for a Mediatek
62      ARM Cortex M4 Co-processor. Contains the name of the rpmsg
63      device. Used to match the subnode to the rpmsg device announced by
64      the SCP.
65    $ref: "/schemas/types.yaml#/definitions/string"
66
67  spi-max-frequency: true
68
69  reg:
70    maxItems: 1
71
72  interrupts:
73    maxItems: 1
74
75  reset-gpios:
76    maxItems: 1
77
78  boot0-gpios:
79    maxItems: 1
80    description: Assert for bootloader mode.
81
82  vdd-supply: true
83
84  wakeup-source:
85    description: Button can wake-up the system.
86
87  '#address-cells':
88    const: 1
89
90  '#size-cells':
91    const: 0
92
93  typec:
94    $ref: "/schemas/chrome/google,cros-ec-typec.yaml#"
95
96  ec-pwm:
97    $ref: "/schemas/pwm/google,cros-ec-pwm.yaml#"
98    deprecated: true
99
100  pwm:
101    $ref: "/schemas/pwm/google,cros-ec-pwm.yaml#"
102
103  kbd-led-backlight:
104    $ref: "/schemas/chrome/google,cros-kbd-led-backlight.yaml#"
105
106  keyboard-controller:
107    $ref: "/schemas/input/google,cros-ec-keyb.yaml#"
108
109  proximity:
110    $ref: "/schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#"
111
112  codecs:
113    type: object
114    additionalProperties: false
115
116    properties:
117      '#address-cells':
118        const: 2
119
120      '#size-cells':
121        const: 1
122
123    patternProperties:
124      "^ec-codec@[a-f0-9]+$":
125        type: object
126        $ref: "/schemas/sound/google,cros-ec-codec.yaml#"
127
128    required:
129      - "#address-cells"
130      - "#size-cells"
131
132  cbas:
133    type: object
134
135    description:
136      This device is used to signal when a detachable base is attached
137      to a Chrome OS tablet. This device cannot be detected at runtime.
138
139    properties:
140      compatible:
141        const: google,cros-cbas
142
143    required:
144      - compatible
145
146    additionalProperties: false
147
148patternProperties:
149  "^i2c-tunnel[0-9]*$":
150    type: object
151    $ref: "/schemas/i2c/google,cros-ec-i2c-tunnel.yaml#"
152
153  "^regulator@[0-9]+$":
154    type: object
155    $ref: "/schemas/regulator/google,cros-ec-regulator.yaml#"
156
157  "^extcon[0-9]*$":
158    type: object
159    $ref: "/schemas/extcon/extcon-usbc-cros-ec.yaml#"
160
161required:
162  - compatible
163
164allOf:
165  - if:
166      properties:
167        compatible:
168          not:
169            contains:
170              const: google,cros-ec-spi
171    then:
172      properties:
173        controller-data: false
174        google,cros-ec-spi-pre-delay: false
175        google,cros-ec-spi-msg-delay: false
176        spi-max-frequency: false
177    else:
178      $ref: /schemas/spi/spi-peripheral-props.yaml
179
180  - if:
181      properties:
182        compatible:
183          not:
184            contains:
185              const: google,cros-ec-rpmsg
186    then:
187      properties:
188        mediatek,rpmsg-name: false
189
190      required:
191        - reg
192        - interrupts
193
194  - if:
195      properties:
196        compatible:
197          contains:
198            const: google,cros-ec-fp
199    then:
200      properties:
201        '#address-cells': false
202        '#size-cells': false
203        typec: false
204        ec-pwm: false
205        kbd-led-backlight: false
206        keyboard-controller: false
207        proximity: false
208        codecs: false
209        cbas: false
210
211      patternProperties:
212        "^i2c-tunnel[0-9]*$": false
213        "^regulator@[0-9]+$": false
214        "^extcon[0-9]*$": false
215
216      # Using additionalProperties: false here and
217      # listing true properties doesn't work
218
219      required:
220        - reset-gpios
221        - boot0-gpios
222        - vdd-supply
223    else:
224      properties:
225        reset-gpios: false
226        boot0-gpios: false
227        vdd-supply: false
228
229additionalProperties: false
230
231examples:
232  # Example for I2C
233  - |
234    #include <dt-bindings/gpio/gpio.h>
235    #include <dt-bindings/interrupt-controller/irq.h>
236
237    i2c0 {
238        #address-cells = <1>;
239        #size-cells = <0>;
240
241        cros-ec@1e {
242            compatible = "google,cros-ec-i2c";
243            reg = <0x1e>;
244            interrupts = <6 0>;
245            interrupt-parent = <&gpio0>;
246        };
247    };
248
249  # Example for SPI
250  - |
251    #include <dt-bindings/gpio/gpio.h>
252    #include <dt-bindings/interrupt-controller/irq.h>
253
254    spi0 {
255        #address-cells = <1>;
256        #size-cells = <0>;
257
258        cros-ec@0 {
259            compatible = "google,cros-ec-spi";
260            reg = <0x0>;
261            google,cros-ec-spi-msg-delay = <30>;
262            google,cros-ec-spi-pre-delay = <10>;
263            interrupts = <99 0>;
264            interrupt-parent = <&gpio7>;
265            spi-max-frequency = <5000000>;
266
267            proximity {
268                compatible = "google,cros-ec-mkbp-proximity";
269            };
270
271            cbas {
272                compatible = "google,cros-cbas";
273            };
274        };
275    };
276
277  # Example for RPMSG
278  - |
279    scp0 {
280        cros-ec {
281            compatible = "google,cros-ec-rpmsg";
282        };
283    };
284
285  # Example for FPMCU
286  - |
287    spi0 {
288      #address-cells = <0x1>;
289      #size-cells = <0x0>;
290
291      ec@0 {
292        compatible = "google,cros-ec-fp", "google,cros-ec-spi";
293        reg = <0x0>;
294        interrupt-parent = <&gpio_controller>;
295        interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
296        spi-max-frequency = <3000000>;
297        reset-gpios = <&gpio_controller 5 GPIO_ACTIVE_LOW>;
298        boot0-gpios = <&gpio_controller 10 GPIO_ACTIVE_HIGH>;
299        vdd-supply = <&pp3300_fp_mcu>;
300      };
301    };
302...
303