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