xref: /freebsd/sys/contrib/device-tree/Bindings/input/google,cros-ec-keyb.yaml (revision fac71e4e09885bb2afa3d984a0c239a52e1a7418)
16be33864SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
26be33864SEmmanuel Vadot%YAML 1.2
36be33864SEmmanuel Vadot---
46be33864SEmmanuel Vadot
56be33864SEmmanuel Vadot$id: http://devicetree.org/schemas/input/google,cros-ec-keyb.yaml#
66be33864SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
76be33864SEmmanuel Vadot
86be33864SEmmanuel Vadottitle: ChromeOS EC Keyboard
96be33864SEmmanuel Vadot
106be33864SEmmanuel Vadotmaintainers:
116be33864SEmmanuel Vadot  - Simon Glass <sjg@chromium.org>
126be33864SEmmanuel Vadot  - Benson Leung <bleung@chromium.org>
136be33864SEmmanuel Vadot
146be33864SEmmanuel Vadotdescription: |
156be33864SEmmanuel Vadot  Google's ChromeOS EC Keyboard is a simple matrix keyboard
166be33864SEmmanuel Vadot  implemented on a separate EC (Embedded Controller) device. It provides
176be33864SEmmanuel Vadot  a message for reading key scans from the EC. These are then converted
18d5b0e70fSEmmanuel Vadot  into keycodes for processing by the kernel. This device also supports
19d5b0e70fSEmmanuel Vadot  switches/buttons like power and volume buttons.
206be33864SEmmanuel Vadot
216be33864SEmmanuel Vadotproperties:
226be33864SEmmanuel Vadot  compatible:
23d5b0e70fSEmmanuel Vadot    oneOf:
24d5b0e70fSEmmanuel Vadot      - description: ChromeOS EC with only buttons/switches
25d5b0e70fSEmmanuel Vadot        const: google,cros-ec-keyb-switches
26d5b0e70fSEmmanuel Vadot      - description: ChromeOS EC with keyboard and possibly buttons/switches
276be33864SEmmanuel Vadot        const: google,cros-ec-keyb
286be33864SEmmanuel Vadot
296be33864SEmmanuel Vadot  google,needs-ghost-filter:
306be33864SEmmanuel Vadot    description:
316be33864SEmmanuel Vadot      Enable a ghost filter for the matrix keyboard. This is recommended
326be33864SEmmanuel Vadot      if the EC does not have its own logic or hardware for this.
336be33864SEmmanuel Vadot    type: boolean
346be33864SEmmanuel Vadot
355def4c47SEmmanuel Vadot  function-row-physmap:
36d5b0e70fSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32-array
375def4c47SEmmanuel Vadot    minItems: 1
385def4c47SEmmanuel Vadot    maxItems: 15
395def4c47SEmmanuel Vadot    description: |
405def4c47SEmmanuel Vadot      An ordered u32 array describing the rows/columns (in the scan matrix)
415def4c47SEmmanuel Vadot      of top row keys from physical left (KEY_F1) to right. Each entry
425def4c47SEmmanuel Vadot      encodes the row/column as:
435def4c47SEmmanuel Vadot      (((row) & 0xFF) << 24) | (((column) & 0xFF) << 16)
445def4c47SEmmanuel Vadot      where the lower 16 bits are reserved. This property is specified only
455def4c47SEmmanuel Vadot      when the keyboard has a custom design for the top row keys.
465def4c47SEmmanuel Vadot
47d5b0e70fSEmmanuel Vadotdependencies:
48*fac71e4eSEmmanuel Vadot  function-row-physmap: [ 'linux,keymap' ]
49d5b0e70fSEmmanuel Vadot  google,needs-ghost-filter: [ 'linux,keymap' ]
50d5b0e70fSEmmanuel Vadot
516be33864SEmmanuel Vadotrequired:
526be33864SEmmanuel Vadot  - compatible
536be33864SEmmanuel Vadot
54d5b0e70fSEmmanuel Vadotif:
55d5b0e70fSEmmanuel Vadot  properties:
56d5b0e70fSEmmanuel Vadot    compatible:
57d5b0e70fSEmmanuel Vadot      contains:
58d5b0e70fSEmmanuel Vadot        const: google,cros-ec-keyb
59d5b0e70fSEmmanuel Vadotthen:
60*fac71e4eSEmmanuel Vadot  $ref: /schemas/input/matrix-keymap.yaml#
61d5b0e70fSEmmanuel Vadot  required:
62d5b0e70fSEmmanuel Vadot    - keypad,num-rows
63d5b0e70fSEmmanuel Vadot    - keypad,num-columns
64d5b0e70fSEmmanuel Vadot    - linux,keymap
65d5b0e70fSEmmanuel Vadot
666be33864SEmmanuel VadotunevaluatedProperties: false
676be33864SEmmanuel Vadot
686be33864SEmmanuel Vadotexamples:
696be33864SEmmanuel Vadot  - |
705def4c47SEmmanuel Vadot    #include <dt-bindings/input/input.h>
71d5b0e70fSEmmanuel Vadot    keyboard-controller {
726be33864SEmmanuel Vadot        compatible = "google,cros-ec-keyb";
736be33864SEmmanuel Vadot        keypad,num-rows = <8>;
746be33864SEmmanuel Vadot        keypad,num-columns = <13>;
756be33864SEmmanuel Vadot        google,needs-ghost-filter;
765def4c47SEmmanuel Vadot        function-row-physmap = <
775def4c47SEmmanuel Vadot            MATRIX_KEY(0x00, 0x02, 0)   /* T1 */
785def4c47SEmmanuel Vadot            MATRIX_KEY(0x03, 0x02, 0)   /* T2 */
795def4c47SEmmanuel Vadot            MATRIX_KEY(0x02, 0x02, 0)   /* T3 */
805def4c47SEmmanuel Vadot            MATRIX_KEY(0x01, 0x02, 0)   /* T4 */
815def4c47SEmmanuel Vadot            MATRIX_KEY(0x03, 0x04, 0)   /* T5 */
825def4c47SEmmanuel Vadot            MATRIX_KEY(0x02, 0x04, 0)   /* T6 */
835def4c47SEmmanuel Vadot            MATRIX_KEY(0x01, 0x04, 0)   /* T7 */
845def4c47SEmmanuel Vadot            MATRIX_KEY(0x02, 0x09, 0)   /* T8 */
855def4c47SEmmanuel Vadot            MATRIX_KEY(0x01, 0x09, 0)   /* T9 */
865def4c47SEmmanuel Vadot            MATRIX_KEY(0x00, 0x04, 0)   /* T10 */
875def4c47SEmmanuel Vadot        >;
886be33864SEmmanuel Vadot        /*
896be33864SEmmanuel Vadot         * Keymap entries take the form of 0xRRCCKKKK where
906be33864SEmmanuel Vadot         * RR=Row CC=Column KKKK=Key Code
916be33864SEmmanuel Vadot         * The values below are for a US keyboard layout and
926be33864SEmmanuel Vadot         * are taken from the Linux driver. Note that the
936be33864SEmmanuel Vadot         * 102ND key is not used for US keyboards.
946be33864SEmmanuel Vadot         */
956be33864SEmmanuel Vadot        linux,keymap = <
966be33864SEmmanuel Vadot            /* CAPSLCK F1         B          F10     */
976be33864SEmmanuel Vadot            0x0001003a 0x0002003b 0x00030030 0x00040044
986be33864SEmmanuel Vadot            /* N       =          R_ALT      ESC     */
996be33864SEmmanuel Vadot            0x00060031 0x0008000d 0x000a0064 0x01010001
1006be33864SEmmanuel Vadot            /* F4      G          F7         H       */
1016be33864SEmmanuel Vadot            0x0102003e 0x01030022 0x01040041 0x01060023
1026be33864SEmmanuel Vadot            /* '       F9         BKSPACE    L_CTRL  */
1036be33864SEmmanuel Vadot            0x01080028 0x01090043 0x010b000e 0x0200001d
1046be33864SEmmanuel Vadot            /* TAB     F3         T          F6      */
1056be33864SEmmanuel Vadot            0x0201000f 0x0202003d 0x02030014 0x02040040
1066be33864SEmmanuel Vadot            /* ]       Y          102ND      [       */
1076be33864SEmmanuel Vadot            0x0205001b 0x02060015 0x02070056 0x0208001a
1086be33864SEmmanuel Vadot            /* F8      GRAVE      F2         5       */
1096be33864SEmmanuel Vadot            0x02090042 0x03010029 0x0302003c 0x03030006
1106be33864SEmmanuel Vadot            /* F5      6          -          \       */
1116be33864SEmmanuel Vadot            0x0304003f 0x03060007 0x0308000c 0x030b002b
1126be33864SEmmanuel Vadot            /* R_CTRL  A          D          F       */
1136be33864SEmmanuel Vadot            0x04000061 0x0401001e 0x04020020 0x04030021
1146be33864SEmmanuel Vadot            /* S       K          J          ;       */
1156be33864SEmmanuel Vadot            0x0404001f 0x04050025 0x04060024 0x04080027
1166be33864SEmmanuel Vadot            /* L       ENTER      Z          C       */
1176be33864SEmmanuel Vadot            0x04090026 0x040b001c 0x0501002c 0x0502002e
1186be33864SEmmanuel Vadot            /* V       X          ,          M       */
1196be33864SEmmanuel Vadot            0x0503002f 0x0504002d 0x05050033 0x05060032
1206be33864SEmmanuel Vadot            /* L_SHIFT /          .          SPACE   */
1216be33864SEmmanuel Vadot            0x0507002a 0x05080035 0x05090034 0x050B0039
1226be33864SEmmanuel Vadot            /* 1       3          4          2       */
1236be33864SEmmanuel Vadot            0x06010002 0x06020004 0x06030005 0x06040003
1246be33864SEmmanuel Vadot            /* 8       7          0          9       */
1256be33864SEmmanuel Vadot            0x06050009 0x06060008 0x0608000b 0x0609000a
1266be33864SEmmanuel Vadot            /* L_ALT   DOWN       RIGHT      Q       */
1276be33864SEmmanuel Vadot            0x060a0038 0x060b006c 0x060c006a 0x07010010
1286be33864SEmmanuel Vadot            /* E       R          W          I       */
1296be33864SEmmanuel Vadot            0x07020012 0x07030013 0x07040011 0x07050017
1306be33864SEmmanuel Vadot            /* U       R_SHIFT    P          O       */
1316be33864SEmmanuel Vadot            0x07060016 0x07070036 0x07080019 0x07090018
1326be33864SEmmanuel Vadot            /* UP      LEFT    */
1336be33864SEmmanuel Vadot            0x070b0067 0x070c0069>;
1346be33864SEmmanuel Vadot    };
135d5b0e70fSEmmanuel Vadot  - |
136d5b0e70fSEmmanuel Vadot    /* No matrix keyboard, just buttons/switches */
137d5b0e70fSEmmanuel Vadot    keyboard-controller {
138d5b0e70fSEmmanuel Vadot        compatible = "google,cros-ec-keyb-switches";
139d5b0e70fSEmmanuel Vadot    };
140d5b0e70fSEmmanuel Vadot...
141