# ChromeOS EC Keyboard

_Peios Kernel / Hardware and drivers / Device-tree binding reference / Input bindings_

> Device-tree binding reference for ChromeOS EC Keyboard.

<!-- SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) -->


<a id="dt-root"></a>

**Schema identifier (<code>&#36;id</code>):** <span id="dt-09f478f44eb202ea573e"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;schemas&#47;input&#47;google&#44;cros&#45;ec&#45;keyb&#46;yaml&#35;&#34;</code></span>

**Schema dialect (<code>&#36;schema</code>):** <span id="dt-dcb375baab6014763a68"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;meta&#45;schemas&#47;core&#46;yaml&#35;&#34;</code></span>

<a id="dt-e46b5a5dd81dbd751c9f"></a>

**Maintainers (<code>maintainers</code>):** <a id="dt-fbc39820abb8bb999095"></a> <span id="dt-fb78ddfc22abfc6fe56d"><code>&#34;Simon Glass &#60;sjg&#64;chromium&#46;org&#62;&#34;</code></span>, <span id="dt-0f999bb9185dbf6b58d8"><code>&#34;Benson Leung &#60;bleung&#64;chromium&#46;org&#62;&#34;</code></span>

<div id="dt-6d1c5ef59f0239d38c02">
<p style="white-space: pre-wrap">Google's ChromeOS EC Keyboard is a simple matrix keyboard
implemented on a separate EC (Embedded Controller) device. It provides
a message for reading key scans from the EC. These are then converted
into keycodes for processing by the kernel. This device also supports
switches/buttons like power and volume buttons.</p>
</div>

<a id="dt-e1f655ed0ff4d595dadc"></a>

## Properties and child nodes (<code>properties</code>)

<a id="dt-5c1d81699dcbe840de83"></a>

### <code>compatible</code> — required here

<a id="dt-39566f01414e34c67b85"></a>

#### Exactly one of these rules must match (<code>oneOf</code>)

<a id="dt-fe13e24e5c9612880f47"></a>

**Rule 1**

> <div id="dt-ab1c3e7063bd95dc962e">
> <p style="white-space: pre-wrap">ChromeOS EC with only buttons/switches</p>
> </div>
>
> **Exact value (<code>const</code>):** <span id="dt-d1fe1b456a54b64074d3"><code>&#34;google&#44;cros&#45;ec&#45;keyb&#45;switches&#34;</code></span>

<a id="dt-7482b6e745c4f056161a"></a>

**Rule 2**

> <div id="dt-4b64ce44adfe069638c4">
> <p style="white-space: pre-wrap">ChromeOS EC with keyboard and possibly buttons/switches</p>
> </div>
>
> **Exact value (<code>const</code>):** <span id="dt-58a429cd4bf531951c0d"><code>&#34;google&#44;cros&#45;ec&#45;keyb&#34;</code></span>

<a id="dt-7f16a7190f5c5f0556ae"></a>

### <code>google&#44;needs&#45;ghost&#45;filter</code> — not listed as required here

<div id="dt-4c070c5f2245dc46bed2">
<p style="white-space: pre-wrap">Enable a ghost filter for the matrix keyboard. This is recommended if the EC does not have its own logic or hardware for this.</p>
</div>

**Value type (<code>type</code>):** <span id="dt-cb9d4600a3dcc968e472"><code>&#34;boolean&#34;</code></span>

<a id="dt-155dc461a1319c831c87"></a>

### <code>function&#45;row&#45;physmap</code> — not listed as required here

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-6656b3249c32939aaf8e">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;uint32&#45;array</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-03a03f95a666fe4b033c>)</span>

**Minimum number of items (<code>minItems</code>):** <span id="dt-9a26ad9ad2b0e723c9ef"><code>1</code></span>

**Maximum number of items (<code>maxItems</code>):** <span id="dt-98505be929e8e7a6de08"><code>15</code></span>

<div id="dt-8f8e7f551470d2c9cd7f">
<p style="white-space: pre-wrap">An ordered u32 array describing the rows/columns (in the scan matrix)
of top row keys from physical left (KEY_F1) to right. Each entry
encodes the row/column as:
(((row) &amp; 0xFF) &lt;&lt; 24) | (((column) &amp; 0xFF) &lt;&lt; 16)
where the lower 16 bits are reserved. This property is specified only
when the keyboard has a custom design for the top row keys.</p>
</div>

<a id="dt-3d235861b18e278e9c09"></a>

## Property dependencies (<code>dependencies</code>)

<a id="dt-f9214a5386fecfd429ca"></a>

### <code>function&#45;row&#45;physmap</code> — applies when this property is present

Also requires: <span id="dt-e29d26649264dec70378"><code>&#34;linux&#44;keymap&#34;</code></span>

<a id="dt-e856bb7479e00aa641d8"></a>

### <code>google&#44;needs&#45;ghost&#45;filter</code> — applies when this property is present

Also requires: <span id="dt-f64deb4fed7e543ca513"><code>&#34;linux&#44;keymap&#34;</code></span>

**Required in this object (<code>required</code>):** <a id="dt-8313173ff1c9b300d560"></a> <span id="dt-048b70ee865d6847aa3d"><code>&#34;compatible&#34;</code></span>

<a id="dt-158e3f6339df9dc0e448"></a>

## Condition (<code>if</code>)

> <a id="dt-0c7b6d12024f922c1b96"></a>
>
> ### Properties and child nodes (<code>properties</code>)
>
> <a id="dt-824fdc441f7c94ae56ca"></a>
>
> #### <code>compatible</code> — not listed as required here
>
> <a id="dt-8239149d6c8b0a5dabbe"></a>
>
> **Rule for matching array elements (<code>contains</code>)**
>
> > **Exact value (<code>const</code>):** <span id="dt-0259836b095562054cc8"><code>&#34;google&#44;cros&#45;ec&#45;keyb&#34;</code></span>

<a id="dt-94d3067a06aec87aad7f"></a>

## When the condition matches (<code>then</code>)

> **Shared schema rule (<code>&#36;ref</code>):** <span id="dt-fc757682b7974f847c53">[<code>&#47;schemas&#47;input&#47;matrix&#45;keymap&#46;yaml&#35;</code>](</kernel/hardware/devicetree-bindings/dt-input/matrix-keymap.md#dt-root>)</span>
>
> **Required in this object (<code>required</code>):** <a id="dt-824165741bab07e919e7"></a> <span id="dt-0be16f81402541b26aff"><code>&#34;keypad&#44;num&#45;rows&#34;</code></span>, <span id="dt-dd9db9085e2885964a9c"><code>&#34;keypad&#44;num&#45;columns&#34;</code></span>, <span id="dt-0d447fba1979bb23b68c"><code>&#34;linux&#44;keymap&#34;</code></span>

<a id="dt-63ab525a9812ac23c446"></a>

## Properties not evaluated by applicable rules (<code>unevaluatedProperties</code>)

<code>false</code>

Not allowed by this rule.

<a id="dt-1a130cabaa8a47b058bf"></a>

## Examples (<code>examples</code>)

<pre id="dt-0bd6510295af0c95ff2d"><code class="language-dts">#include &lt;dt-bindings/input/input.h&gt;
keyboard-controller {
    compatible = "google,cros-ec-keyb";
    keypad,num-rows = &lt;8&gt;;
    keypad,num-columns = &lt;13&gt;;
    google,needs-ghost-filter;
    function-row-physmap = &lt;
        MATRIX_KEY(0x00, 0x02, 0)   /* T1 */
        MATRIX_KEY(0x03, 0x02, 0)   /* T2 */
        MATRIX_KEY(0x02, 0x02, 0)   /* T3 */
        MATRIX_KEY(0x01, 0x02, 0)   /* T4 */
        MATRIX_KEY(0x03, 0x04, 0)   /* T5 */
        MATRIX_KEY(0x02, 0x04, 0)   /* T6 */
        MATRIX_KEY(0x01, 0x04, 0)   /* T7 */
        MATRIX_KEY(0x02, 0x09, 0)   /* T8 */
        MATRIX_KEY(0x01, 0x09, 0)   /* T9 */
        MATRIX_KEY(0x00, 0x04, 0)   /* T10 */
    &gt;;
    /*
     * Keymap entries take the form of 0xRRCCKKKK where
     * RR=Row CC=Column KKKK=Key Code
     * The values below are for a US keyboard layout and
     * are taken from the Linux driver. Note that the
     * 102ND key is not used for US keyboards.
     */
    linux,keymap = &lt;
        /* CAPSLCK F1         B          F10     */
        0x0001003a 0x0002003b 0x00030030 0x00040044
        /* N       =          R_ALT      ESC     */
        0x00060031 0x0008000d 0x000a0064 0x01010001
        /* F4      G          F7         H       */
        0x0102003e 0x01030022 0x01040041 0x01060023
        /* '       F9         BKSPACE    L_CTRL  */
        0x01080028 0x01090043 0x010b000e 0x0200001d
        /* TAB     F3         T          F6      */
        0x0201000f 0x0202003d 0x02030014 0x02040040
        /* ]       Y          102ND      [       */
        0x0205001b 0x02060015 0x02070056 0x0208001a
        /* F8      GRAVE      F2         5       */
        0x02090042 0x03010029 0x0302003c 0x03030006
        /* F5      6          -          \       */
        0x0304003f 0x03060007 0x0308000c 0x030b002b
        /* R_CTRL  A          D          F       */
        0x04000061 0x0401001e 0x04020020 0x04030021
        /* S       K          J          ;       */
        0x0404001f 0x04050025 0x04060024 0x04080027
        /* L       ENTER      Z          C       */
        0x04090026 0x040b001c 0x0501002c 0x0502002e
        /* V       X          ,          M       */
        0x0503002f 0x0504002d 0x05050033 0x05060032
        /* L_SHIFT /          .          SPACE   */
        0x0507002a 0x05080035 0x05090034 0x050B0039
        /* 1       3          4          2       */
        0x06010002 0x06020004 0x06030005 0x06040003
        /* 8       7          0          9       */
        0x06050009 0x06060008 0x0608000b 0x0609000a
        /* L_ALT   DOWN       RIGHT      Q       */
        0x060a0038 0x060b006c 0x060c006a 0x07010010
        /* E       R          W          I       */
        0x07020012 0x07030013 0x07040011 0x07050017
        /* U       R_SHIFT    P          O       */
        0x07060016 0x07070036 0x07080019 0x07090018
        /* UP      LEFT    */
        0x070b0067 0x070c0069&gt;;
};
</code></pre>

<pre id="dt-bae0d43ea48e35208b4a"><code class="language-dts">/* No matrix keyboard, just buttons/switches */
keyboard-controller {
    compatible = "google,cros-ec-keyb-switches";
};
</code></pre>

## Source notes

<details>
<summary>Annotations retained from the schema source</summary>

<p id="dt-comment-0"><strong>Line 1:</strong> <span> SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)</span></p>

</details>
