1 /*
2  * drivers/input/keyboard/tegra-nvec.c
3  *
4  * Keyboard class input driver for keyboards connected to an NvEc compliant
5  * embedded controller
6  *
7  * Copyright (c) 2009, NVIDIA Corporation.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
17  * more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22  */
23 
24 static unsigned short code_tab_102us[] = {
25 	/* 0x00 */
26 	KEY_GRAVE,
27 	KEY_ESC,
28 	KEY_1,
29 	KEY_2,
30 	KEY_3,
31 	KEY_4,
32 	KEY_5,
33 	KEY_6,
34 	KEY_7,
35 	KEY_8,
36 	KEY_9,
37 	KEY_0,
38 	KEY_MINUS,
39 	KEY_EQUAL,
40 	KEY_BACKSPACE,
41 	KEY_TAB,
42 	/* 0x10 */
43 	KEY_Q,
44 	KEY_W,
45 	KEY_E,
46 	KEY_R,
47 	KEY_T,
48 	KEY_Y,
49 	KEY_U,
50 	KEY_I,
51 	KEY_O,
52 	KEY_P,
53 	KEY_LEFTBRACE,
54 	KEY_RIGHTBRACE,
55 	KEY_ENTER,
56 	KEY_LEFTCTRL,
57 	KEY_A,
58 	KEY_S,
59 	/* 0x20 */
60 	KEY_D,
61 	KEY_F,
62 	KEY_G,
63 	KEY_H,
64 	KEY_J,
65 	KEY_K,
66 	KEY_L,
67 	KEY_SEMICOLON,
68 	KEY_APOSTROPHE,
69 	KEY_GRAVE,
70 	KEY_LEFTSHIFT,
71 	KEY_BACKSLASH,
72 	KEY_Z,
73 	KEY_X,
74 	KEY_C,
75 	KEY_V,
76 	/* 0x30 */
77 	KEY_B,
78 	KEY_N,
79 	KEY_M,
80 	KEY_COMMA,
81 	KEY_DOT,
82 	KEY_SLASH,
83 	KEY_RIGHTSHIFT,
84 	KEY_KPASTERISK,
85 	KEY_LEFTALT,
86 	KEY_SPACE,
87 	KEY_CAPSLOCK,
88 	KEY_F1,
89 	KEY_F2,
90 	KEY_F3,
91 	KEY_F4,
92 	KEY_F5,
93 	/* 0x40 */
94 	KEY_F6,
95 	KEY_F7,
96 	KEY_F8,
97 	KEY_F9,
98 	KEY_F10,
99 	KEY_FN,
100 	/* VK_SCROLL */
101 	0,
102 	KEY_KP7,
103 	KEY_KP8,
104 	KEY_KP9,
105 	KEY_KPMINUS,
106 	KEY_KP4,
107 	KEY_KP5,
108 	KEY_KP6,
109 	KEY_KPPLUS,
110 	KEY_KP1,
111 	/* 0x50 */
112 	KEY_KP2,
113 	KEY_KP3,
114 	KEY_KP0,
115 	KEY_KPDOT,
116 	/* VK_SNAPSHOT */
117 	KEY_MENU,
118 	KEY_POWER,
119 	/* VK_OEM_102 */
120 	KEY_102ND,
121 	KEY_F11,
122 	KEY_F12,
123 	0,
124 	0,
125 	0,
126 	0,
127 	0,
128 	0,
129 	0,
130 	/* 0x60 */
131 	0,
132 	0,
133 	0,
134 	KEY_SEARCH,
135 	0,
136 	0,
137 	0,
138 	0,
139 	0,
140 	0,
141 	0,
142 	0,
143 	0,
144 	0,
145 	0,
146 	0,
147 	/* 0x70 */
148 	0,
149 	0,
150 	0,
151 	KEY_KP5,
152 	0,
153 	0,
154 	0,
155 	0,
156 	0,
157 	0,
158 	0,
159 	0,
160 	0,
161 	KEY_KP9,
162 };
163 
164 static unsigned short extcode_tab_us102[] = {
165 	0,
166 	0,
167 	0,
168 	0,
169 	0,
170 	0,
171 	0,
172 	0,
173 	0,
174 	0,
175 	0,
176 	0,
177 	0,
178 	0,
179 	0,
180 	0,
181 	/* 0x10 */
182 	0,
183 	0,
184 	0,
185 	0,
186 	0,
187 	0,
188 	0,
189 	0,
190 	0,
191 	/* VK_MEDIA_NEXT_TRACK */
192 	0,
193 	0,
194 	0,
195 	/* VK_RETURN */
196 	0,
197 	KEY_RIGHTCTRL,
198 	0,
199 	0,
200 	/* 0x20 */
201 	KEY_MUTE,
202 	/* VK_LAUNCH_APP1 */
203 	0,
204 	/* VK_MEDIA_PLAY_PAUSE */
205 	0,
206 	0,
207 	/* VK_MEDIA_STOP */
208 	0,
209 	0,
210 	0,
211 	0,
212 	0,
213 	0,
214 	0,
215 	0,
216 	0,
217 	0,
218 	0,
219 	0,
220 	/* 0x30 */
221 	KEY_VOLUMEUP,
222 	0,
223 	/* VK_BROWSER_HOME */
224 	0,
225 	0,
226 	0,
227 	/* VK_DIVIDE */
228 	KEY_KPSLASH,
229 	0,
230 	/* VK_SNAPSHOT */
231 	KEY_SYSRQ,
232 	/* VK_RMENU */
233 	KEY_RIGHTALT,
234 	/* VK_OEM_NV_BACKLIGHT_UP */
235 	0,
236 	/* VK_OEM_NV_BACKLIGHT_DN */
237 	0,
238 	/* VK_OEM_NV_BACKLIGHT_AUTOTOGGLE */
239 	0,
240 	/* VK_OEM_NV_POWER_INFO */
241 	0,
242 	/* VK_OEM_NV_WIFI_TOGGLE */
243 	0,
244 	/* VK_OEM_NV_DISPLAY_SELECT */
245 	0,
246 	/* VK_OEM_NV_AIRPLANE_TOGGLE */
247 	0,
248 	/* 0x40 */
249 	0,
250 	KEY_LEFT,
251 	0,
252 	0,
253 	0,
254 	0,
255 	KEY_CANCEL,
256 	KEY_HOME,
257 	KEY_UP,
258 	KEY_PAGEUP,
259 	0,
260 	KEY_LEFT,
261 	0,
262 	KEY_RIGHT,
263 	0,
264 	KEY_END,
265 	/* 0x50 */
266 	KEY_DOWN,
267 	KEY_PAGEDOWN,
268 	KEY_INSERT,
269 	KEY_DELETE,
270 	0,
271 	0,
272 	0,
273 	0,
274 	0,
275 	0,
276 	0,
277 	KEY_LEFTMETA,
278 	0,
279 	KEY_ESC,
280 	KEY_KPMINUS,
281 	0,
282 	0,
283 	0,
284 	0,
285 	0,
286 	0,
287 	/* VK_BROWSER_SEARCH */
288 	0,
289 	/* VK_BROWSER_FAVORITES */
290 	0,
291 	/* VK_BROWSER_REFRESH */
292 	0,
293 	/* VK_BROWSER_STOP */
294 	0,
295 	/* VK_BROWSER_FORWARD */
296 	0,
297 	/* VK_BROWSER_BACK */
298 	0,
299 	/* VK_LAUNCH_APP2 */
300 	0,
301 	/* VK_LAUNCH_MAIL */
302 	0,
303 	/* VK_LAUNCH_MEDIA_SELECT */
304 	0,
305 };
306 
307 static unsigned short *code_tabs[] = { code_tab_102us, extcode_tab_us102 };
308