summaryrefslogtreecommitdiff
path: root/Documentation/devicetree/bindings/mfd/google,cros-ec.yaml
blob: 3d5efa5578d1b19ca4e6b514ed77b884ca6c735f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mfd/google,cros-ec.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: ChromeOS Embedded Controller

maintainers:
  - Benson Leung <bleung@chromium.org>
  - Guenter Roeck <groeck@chromium.org>

description:
  Google's ChromeOS EC is a microcontroller which talks to the AP and
  implements various functions such as keyboard and battery charging.
  The EC can be connected through various interfaces (I2C, SPI, and others)
  and the compatible string specifies which interface is being used.

properties:
  compatible:
    oneOf:
      - description:
          For implementations of the EC connected through I2C.
        const: google,cros-ec-i2c
      - description:
          For implementations of the EC connected through SPI.
        const: google,cros-ec-spi
      - description:
          For implementations of the FPMCU connected through SPI.
        items:
          - const: google,cros-ec-fp
          - const: google,cros-ec-spi
      - description:
          For implementations of the EC connected through RPMSG.
        const: google,cros-ec-rpmsg

  controller-data: true

  google,cros-ec-spi-pre-delay:
    description:
      This property specifies the delay in usecs between the
      assertion of the CS and the first clock pulse.
    $ref: /schemas/types.yaml#/definitions/uint32
    default: 0

  google,cros-ec-spi-msg-delay:
    description:
      This property specifies the delay in usecs between messages.
    $ref: /schemas/types.yaml#/definitions/uint32
    default: 0

  google,has-vbc-nvram:
    description:
      Some implementations of the EC include a small nvram space used to
      store verified boot context data. This boolean flag is used to specify
      whether this nvram is present or not.
    type: boolean

  mediatek,rpmsg-name:
    description:
      Must be defined if the cros-ec is a rpmsg device for a Mediatek
      ARM Cortex M4 Co-processor. Contains the name of the rpmsg
      device. Used to match the subnode to the rpmsg device announced by
      the SCP.
    $ref: "/schemas/types.yaml#/definitions/string"

  spi-max-frequency: true

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  reset-gpios:
    maxItems: 1

  boot0-gpios:
    maxItems: 1
    description: Assert for bootloader mode.

  vdd-supply: true

  wakeup-source:
    description: Button can wake-up the system.

  '#address-cells':
    const: 1

  '#size-cells':
    const: 0

  typec:
    $ref: "/schemas/chrome/google,cros-ec-typec.yaml#"

  ec-pwm:
    $ref: "/schemas/pwm/google,cros-ec-pwm.yaml#"
    deprecated: true

  pwm:
    $ref: "/schemas/pwm/google,cros-ec-pwm.yaml#"

  kbd-led-backlight:
    $ref: "/schemas/chrome/google,cros-kbd-led-backlight.yaml#"

  keyboard-controller:
    $ref: "/schemas/input/google,cros-ec-keyb.yaml#"

  proximity:
    $ref: "/schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#"

  codecs:
    type: object
    additionalProperties: false

    properties:
      '#address-cells':
        const: 2

      '#size-cells':
        const: 1

    patternProperties:
      "^ec-codec@[a-f0-9]+$":
        type: object
        $ref: "/schemas/sound/google,cros-ec-codec.yaml#"

    required:
      - "#address-cells"
      - "#size-cells"

  cbas:
    type: object

    description:
      This device is used to signal when a detachable base is attached
      to a Chrome OS tablet. This device cannot be detected at runtime.

    properties:
      compatible:
        const: google,cros-cbas

    required:
      - compatible

    additionalProperties: false

patternProperties:
  "^i2c-tunnel[0-9]*$":
    type: object
    $ref: "/schemas/i2c/google,cros-ec-i2c-tunnel.yaml#"

  "^regulator@[0-9]+$":
    type: object
    $ref: "/schemas/regulator/google,cros-ec-regulator.yaml#"

  "^extcon[0-9]*$":
    type: object
    $ref: "/schemas/extcon/extcon-usbc-cros-ec.yaml#"

required:
  - compatible

allOf:
  - if:
      properties:
        compatible:
          not:
            contains:
              const: google,cros-ec-spi
    then:
      properties:
        controller-data: false
        google,cros-ec-spi-pre-delay: false
        google,cros-ec-spi-msg-delay: false
        spi-max-frequency: false
    else:
      $ref: /schemas/spi/spi-peripheral-props.yaml

  - if:
      properties:
        compatible:
          not:
            contains:
              const: google,cros-ec-rpmsg
    then:
      properties:
        mediatek,rpmsg-name: false

      required:
        - reg
        - interrupts

  - if:
      properties:
        compatible:
          contains:
            const: google,cros-ec-fp
    then:
      properties:
        '#address-cells': false
        '#size-cells': false
        typec: false
        ec-pwm: false
        kbd-led-backlight: false
        keyboard-controller: false
        proximity: false
        codecs: false
        cbas: false

      patternProperties:
        "^i2c-tunnel[0-9]*$": false
        "^regulator@[0-9]+$": false
        "^extcon[0-9]*$": false

      # Using additionalProperties: false here and
      # listing true properties doesn't work

      required:
        - reset-gpios
        - boot0-gpios
        - vdd-supply
    else:
      properties:
        reset-gpios: false
        boot0-gpios: false
        vdd-supply: false

additionalProperties: false

examples:
  # Example for I2C
  - |
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/interrupt-controller/irq.h>

    i2c0 {
        #address-cells = <1>;
        #size-cells = <0>;

        cros-ec@1e {
            compatible = "google,cros-ec-i2c";
            reg = <0x1e>;
            interrupts = <6 0>;
            interrupt-parent = <&gpio0>;
        };
    };

  # Example for SPI
  - |
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/interrupt-controller/irq.h>

    spi0 {
        #address-cells = <1>;
        #size-cells = <0>;

        cros-ec@0 {
            compatible = "google,cros-ec-spi";
            reg = <0x0>;
            google,cros-ec-spi-msg-delay = <30>;
            google,cros-ec-spi-pre-delay = <10>;
            interrupts = <99 0>;
            interrupt-parent = <&gpio7>;
            spi-max-frequency = <5000000>;

            proximity {
                compatible = "google,cros-ec-mkbp-proximity";
            };

            cbas {
                compatible = "google,cros-cbas";
            };
        };
    };

  # Example for RPMSG
  - |
    scp0 {
        cros-ec {
            compatible = "google,cros-ec-rpmsg";
        };
    };

  # Example for FPMCU
  - |
    spi0 {
      #address-cells = <0x1>;
      #size-cells = <0x0>;

      ec@0 {
        compatible = "google,cros-ec-fp", "google,cros-ec-spi";
        reg = <0x0>;
        interrupt-parent = <&gpio_controller>;
        interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
        spi-max-frequency = <3000000>;
        reset-gpios = <&gpio_controller 5 GPIO_ACTIVE_LOW>;
        boot0-gpios = <&gpio_controller 10 GPIO_ACTIVE_HIGH>;
        vdd-supply = <&pp3300_fp_mcu>;
      };
    };
...