keyboard-spear.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * Copyright (C) 2010 ST Microelectronics
  3. * Rajeev Kumar <rajeevkumar.linux@gmail.com>
  4. *
  5. * This file is licensed under the terms of the GNU General Public
  6. * License version 2. This program is licensed "as is" without any
  7. * warranty of any kind, whether express or implied.
  8. */
  9. #ifndef __PLAT_KEYBOARD_H
  10. #define __PLAT_KEYBOARD_H
  11. #include <linux/bitops.h>
  12. #include <linux/input.h>
  13. #include <linux/input/matrix_keypad.h>
  14. #include <linux/types.h>
  15. #define DECLARE_9x9_KEYMAP(_name) \
  16. int _name[] = { \
  17. KEY(0, 0, KEY_ESC), \
  18. KEY(0, 1, KEY_1), \
  19. KEY(0, 2, KEY_2), \
  20. KEY(0, 3, KEY_3), \
  21. KEY(0, 4, KEY_4), \
  22. KEY(0, 5, KEY_5), \
  23. KEY(0, 6, KEY_6), \
  24. KEY(0, 7, KEY_7), \
  25. KEY(0, 8, KEY_8), \
  26. KEY(1, 0, KEY_9), \
  27. KEY(1, 1, KEY_MINUS), \
  28. KEY(1, 2, KEY_EQUAL), \
  29. KEY(1, 3, KEY_BACKSPACE), \
  30. KEY(1, 4, KEY_TAB), \
  31. KEY(1, 5, KEY_Q), \
  32. KEY(1, 6, KEY_W), \
  33. KEY(1, 7, KEY_E), \
  34. KEY(1, 8, KEY_R), \
  35. KEY(2, 0, KEY_T), \
  36. KEY(2, 1, KEY_Y), \
  37. KEY(2, 2, KEY_U), \
  38. KEY(2, 3, KEY_I), \
  39. KEY(2, 4, KEY_O), \
  40. KEY(2, 5, KEY_P), \
  41. KEY(2, 6, KEY_LEFTBRACE), \
  42. KEY(2, 7, KEY_RIGHTBRACE), \
  43. KEY(2, 8, KEY_ENTER), \
  44. KEY(3, 0, KEY_LEFTCTRL), \
  45. KEY(3, 1, KEY_A), \
  46. KEY(3, 2, KEY_S), \
  47. KEY(3, 3, KEY_D), \
  48. KEY(3, 4, KEY_F), \
  49. KEY(3, 5, KEY_G), \
  50. KEY(3, 6, KEY_H), \
  51. KEY(3, 7, KEY_J), \
  52. KEY(3, 8, KEY_K), \
  53. KEY(4, 0, KEY_L), \
  54. KEY(4, 1, KEY_SEMICOLON), \
  55. KEY(4, 2, KEY_APOSTROPHE), \
  56. KEY(4, 3, KEY_GRAVE), \
  57. KEY(4, 4, KEY_LEFTSHIFT), \
  58. KEY(4, 5, KEY_BACKSLASH), \
  59. KEY(4, 6, KEY_Z), \
  60. KEY(4, 7, KEY_X), \
  61. KEY(4, 8, KEY_C), \
  62. KEY(5, 0, KEY_V), \
  63. KEY(5, 1, KEY_B), \
  64. KEY(5, 2, KEY_N), \
  65. KEY(5, 3, KEY_M), \
  66. KEY(5, 4, KEY_COMMA), \
  67. KEY(5, 5, KEY_DOT), \
  68. KEY(5, 6, KEY_SLASH), \
  69. KEY(5, 7, KEY_RIGHTSHIFT), \
  70. KEY(5, 8, KEY_KPASTERISK), \
  71. KEY(6, 0, KEY_LEFTALT), \
  72. KEY(6, 1, KEY_SPACE), \
  73. KEY(6, 2, KEY_CAPSLOCK), \
  74. KEY(6, 3, KEY_F1), \
  75. KEY(6, 4, KEY_F2), \
  76. KEY(6, 5, KEY_F3), \
  77. KEY(6, 6, KEY_F4), \
  78. KEY(6, 7, KEY_F5), \
  79. KEY(6, 8, KEY_F6), \
  80. KEY(7, 0, KEY_F7), \
  81. KEY(7, 1, KEY_F8), \
  82. KEY(7, 2, KEY_F9), \
  83. KEY(7, 3, KEY_F10), \
  84. KEY(7, 4, KEY_NUMLOCK), \
  85. KEY(7, 5, KEY_SCROLLLOCK), \
  86. KEY(7, 6, KEY_KP7), \
  87. KEY(7, 7, KEY_KP8), \
  88. KEY(7, 8, KEY_KP9), \
  89. KEY(8, 0, KEY_KPMINUS), \
  90. KEY(8, 1, KEY_KP4), \
  91. KEY(8, 2, KEY_KP5), \
  92. KEY(8, 3, KEY_KP6), \
  93. KEY(8, 4, KEY_KPPLUS), \
  94. KEY(8, 5, KEY_KP1), \
  95. KEY(8, 6, KEY_KP2), \
  96. KEY(8, 7, KEY_KP3), \
  97. KEY(8, 8, KEY_KP0), \
  98. }
  99. #define DECLARE_6x6_KEYMAP(_name) \
  100. int _name[] = { \
  101. KEY(0, 0, KEY_RESERVED), \
  102. KEY(0, 1, KEY_1), \
  103. KEY(0, 2, KEY_2), \
  104. KEY(0, 3, KEY_3), \
  105. KEY(0, 4, KEY_4), \
  106. KEY(0, 5, KEY_5), \
  107. KEY(1, 0, KEY_Q), \
  108. KEY(1, 1, KEY_W), \
  109. KEY(1, 2, KEY_E), \
  110. KEY(1, 3, KEY_R), \
  111. KEY(1, 4, KEY_T), \
  112. KEY(1, 5, KEY_Y), \
  113. KEY(2, 0, KEY_D), \
  114. KEY(2, 1, KEY_F), \
  115. KEY(2, 2, KEY_G), \
  116. KEY(2, 3, KEY_H), \
  117. KEY(2, 4, KEY_J), \
  118. KEY(2, 5, KEY_K), \
  119. KEY(3, 0, KEY_B), \
  120. KEY(3, 1, KEY_N), \
  121. KEY(3, 2, KEY_M), \
  122. KEY(3, 3, KEY_COMMA), \
  123. KEY(3, 4, KEY_DOT), \
  124. KEY(3, 5, KEY_SLASH), \
  125. KEY(4, 0, KEY_F6), \
  126. KEY(4, 1, KEY_F7), \
  127. KEY(4, 2, KEY_F8), \
  128. KEY(4, 3, KEY_F9), \
  129. KEY(4, 4, KEY_F10), \
  130. KEY(4, 5, KEY_NUMLOCK), \
  131. KEY(5, 0, KEY_KP2), \
  132. KEY(5, 1, KEY_KP3), \
  133. KEY(5, 2, KEY_KP0), \
  134. KEY(5, 3, KEY_KPDOT), \
  135. KEY(5, 4, KEY_RO), \
  136. KEY(5, 5, KEY_ZENKAKUHANKAKU), \
  137. }
  138. #define KEYPAD_9x9 0
  139. #define KEYPAD_6x6 1
  140. #define KEYPAD_2x2 2
  141. /**
  142. * struct kbd_platform_data - spear keyboard platform data
  143. * keymap: pointer to keymap data (table and size)
  144. * rep: enables key autorepeat
  145. * mode: choose keyboard support(9x9, 6x6, 2x2)
  146. * suspended_rate: rate at which keyboard would operate in suspended mode
  147. *
  148. * This structure is supposed to be used by platform code to supply
  149. * keymaps to drivers that implement keyboards.
  150. */
  151. struct kbd_platform_data {
  152. const struct matrix_keymap_data *keymap;
  153. bool rep;
  154. unsigned int mode;
  155. unsigned int suspended_rate;
  156. };
  157. #endif /* __PLAT_KEYBOARD_H */