Skip to content

Commit 1269b2f

Browse files
marvintwentyfourkwizart
authored andcommitted
ARM: tegra: add nvec keyboard driver
Adopted version of nvec keyboard driver from linux kernel. Signed-off-by: Andrey Danin <danindrey@mail.ru> [squashed, forward ported, and cleaned up] Signed-off-by: Marc Dietrich <marvin24@gmx.de>
1 parent 2522ee3 commit 1269b2f

File tree

7 files changed

+612
-0
lines changed

7 files changed

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

drivers/i2c/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ obj-$(CONFIG_$(SPL_)I2C_CROS_EC_LDO) += cros_ec_ldo.o
1212

1313
obj-$(CONFIG_$(SPL_)SYS_I2C_LEGACY) += i2c_core.o
1414
obj-$(CONFIG_TEGRA_NVEC) += tegra_nvec.o
15+
obj-$(CONFIG_TEGRA_NVEC_KEYBOARD) += tegra_nvec_keyboard.o
1516
obj-$(CONFIG_SYS_I2C_ASPEED) += ast_i2c.o
1617
obj-$(CONFIG_SYS_I2C_AT91) += at91_i2c.o
1718
obj-$(CONFIG_SYS_I2C_CADENCE) += i2c-cdns.o

0 commit comments

Comments
 (0)