google,cros-ec-keyb.yaml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
  2. %YAML 1.2
  3. ---
  4. $id: http://devicetree.org/schemas/input/google,cros-ec-keyb.yaml#
  5. $schema: http://devicetree.org/meta-schemas/core.yaml#
  6. title: ChromeOS EC Keyboard
  7. maintainers:
  8. - Simon Glass <sjg@chromium.org>
  9. - Benson Leung <bleung@chromium.org>
  10. description: |
  11. Google's ChromeOS EC Keyboard is a simple matrix keyboard
  12. implemented on a separate EC (Embedded Controller) device. It provides
  13. a message for reading key scans from the EC. These are then converted
  14. into keycodes for processing by the kernel. This device also supports
  15. switches/buttons like power and volume buttons.
  16. properties:
  17. compatible:
  18. oneOf:
  19. - description: ChromeOS EC with only buttons/switches
  20. const: google,cros-ec-keyb-switches
  21. - description: ChromeOS EC with keyboard and possibly buttons/switches
  22. const: google,cros-ec-keyb
  23. google,needs-ghost-filter:
  24. description:
  25. Enable a ghost filter for the matrix keyboard. This is recommended
  26. if the EC does not have its own logic or hardware for this.
  27. type: boolean
  28. function-row-physmap:
  29. $ref: /schemas/types.yaml#/definitions/uint32-array
  30. minItems: 1
  31. maxItems: 15
  32. description: |
  33. An ordered u32 array describing the rows/columns (in the scan matrix)
  34. of top row keys from physical left (KEY_F1) to right. Each entry
  35. encodes the row/column as:
  36. (((row) & 0xFF) << 24) | (((column) & 0xFF) << 16)
  37. where the lower 16 bits are reserved. This property is specified only
  38. when the keyboard has a custom design for the top row keys.
  39. dependencies:
  40. function-row-physmap: [ 'linux,keymap' ]
  41. google,needs-ghost-filter: [ 'linux,keymap' ]
  42. required:
  43. - compatible
  44. if:
  45. properties:
  46. compatible:
  47. contains:
  48. const: google,cros-ec-keyb
  49. then:
  50. $ref: /schemas/input/matrix-keymap.yaml#
  51. required:
  52. - keypad,num-rows
  53. - keypad,num-columns
  54. - linux,keymap
  55. unevaluatedProperties: false
  56. examples:
  57. - |
  58. #include <dt-bindings/input/input.h>
  59. keyboard-controller {
  60. compatible = "google,cros-ec-keyb";
  61. keypad,num-rows = <8>;
  62. keypad,num-columns = <13>;
  63. google,needs-ghost-filter;
  64. function-row-physmap = <
  65. MATRIX_KEY(0x00, 0x02, 0) /* T1 */
  66. MATRIX_KEY(0x03, 0x02, 0) /* T2 */
  67. MATRIX_KEY(0x02, 0x02, 0) /* T3 */
  68. MATRIX_KEY(0x01, 0x02, 0) /* T4 */
  69. MATRIX_KEY(0x03, 0x04, 0) /* T5 */
  70. MATRIX_KEY(0x02, 0x04, 0) /* T6 */
  71. MATRIX_KEY(0x01, 0x04, 0) /* T7 */
  72. MATRIX_KEY(0x02, 0x09, 0) /* T8 */
  73. MATRIX_KEY(0x01, 0x09, 0) /* T9 */
  74. MATRIX_KEY(0x00, 0x04, 0) /* T10 */
  75. >;
  76. /*
  77. * Keymap entries take the form of 0xRRCCKKKK where
  78. * RR=Row CC=Column KKKK=Key Code
  79. * The values below are for a US keyboard layout and
  80. * are taken from the Linux driver. Note that the
  81. * 102ND key is not used for US keyboards.
  82. */
  83. linux,keymap = <
  84. /* CAPSLCK F1 B F10 */
  85. 0x0001003a 0x0002003b 0x00030030 0x00040044
  86. /* N = R_ALT ESC */
  87. 0x00060031 0x0008000d 0x000a0064 0x01010001
  88. /* F4 G F7 H */
  89. 0x0102003e 0x01030022 0x01040041 0x01060023
  90. /* ' F9 BKSPACE L_CTRL */
  91. 0x01080028 0x01090043 0x010b000e 0x0200001d
  92. /* TAB F3 T F6 */
  93. 0x0201000f 0x0202003d 0x02030014 0x02040040
  94. /* ] Y 102ND [ */
  95. 0x0205001b 0x02060015 0x02070056 0x0208001a
  96. /* F8 GRAVE F2 5 */
  97. 0x02090042 0x03010029 0x0302003c 0x03030006
  98. /* F5 6 - \ */
  99. 0x0304003f 0x03060007 0x0308000c 0x030b002b
  100. /* R_CTRL A D F */
  101. 0x04000061 0x0401001e 0x04020020 0x04030021
  102. /* S K J ; */
  103. 0x0404001f 0x04050025 0x04060024 0x04080027
  104. /* L ENTER Z C */
  105. 0x04090026 0x040b001c 0x0501002c 0x0502002e
  106. /* V X , M */
  107. 0x0503002f 0x0504002d 0x05050033 0x05060032
  108. /* L_SHIFT / . SPACE */
  109. 0x0507002a 0x05080035 0x05090034 0x050B0039
  110. /* 1 3 4 2 */
  111. 0x06010002 0x06020004 0x06030005 0x06040003
  112. /* 8 7 0 9 */
  113. 0x06050009 0x06060008 0x0608000b 0x0609000a
  114. /* L_ALT DOWN RIGHT Q */
  115. 0x060a0038 0x060b006c 0x060c006a 0x07010010
  116. /* E R W I */
  117. 0x07020012 0x07030013 0x07040011 0x07050017
  118. /* U R_SHIFT P O */
  119. 0x07060016 0x07070036 0x07080019 0x07090018
  120. /* UP LEFT */
  121. 0x070b0067 0x070c0069>;
  122. };
  123. - |
  124. /* No matrix keyboard, just buttons/switches */
  125. keyboard-controller {
  126. compatible = "google,cros-ec-keyb-switches";
  127. };
  128. ...