blob: f1d3ba0dafb2afd25dba1d37d52f914b5ebc15a3 [file] [log] [blame]
Rakesh Iyer11f5b302011-01-19 23:38:47 -08001/*
2 * Keyboard class input driver for the NVIDIA Tegra SoC internal matrix
3 * keyboard controller
4 *
5 * Copyright (c) 2009-2011, 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
Rakesh Iyer3f277572011-07-30 12:01:48 -070022#include <linux/kernel.h>
Rakesh Iyer11f5b302011-01-19 23:38:47 -080023#include <linux/module.h>
24#include <linux/input.h>
25#include <linux/platform_device.h>
26#include <linux/delay.h>
27#include <linux/io.h>
28#include <linux/interrupt.h>
Olof Johanssona445c7f2011-12-29 09:58:16 -080029#include <linux/of.h>
Rakesh Iyer11f5b302011-01-19 23:38:47 -080030#include <linux/clk.h>
31#include <linux/slab.h>
Stephen Warrena85442a2012-09-04 20:27:38 -070032#include <linux/input/tegra_kbc.h>
Rakesh Iyer11f5b302011-01-19 23:38:47 -080033#include <mach/clk.h>
Rakesh Iyer11f5b302011-01-19 23:38:47 -080034
35#define KBC_MAX_DEBOUNCE_CNT 0x3ffu
36
37/* KBC row scan time and delay for beginning the row scan. */
38#define KBC_ROW_SCAN_TIME 16
39#define KBC_ROW_SCAN_DLY 5
40
41/* KBC uses a 32KHz clock so a cycle = 1/32Khz */
Rakesh Iyer3f277572011-07-30 12:01:48 -070042#define KBC_CYCLE_MS 32
Rakesh Iyer11f5b302011-01-19 23:38:47 -080043
44/* KBC Registers */
45
46/* KBC Control Register */
47#define KBC_CONTROL_0 0x0
48#define KBC_FIFO_TH_CNT_SHIFT(cnt) (cnt << 14)
49#define KBC_DEBOUNCE_CNT_SHIFT(cnt) (cnt << 4)
50#define KBC_CONTROL_FIFO_CNT_INT_EN (1 << 3)
Rakesh Iyerb6834b02012-01-22 23:27:54 -080051#define KBC_CONTROL_KEYPRESS_INT_EN (1 << 1)
Rakesh Iyer11f5b302011-01-19 23:38:47 -080052#define KBC_CONTROL_KBC_EN (1 << 0)
53
54/* KBC Interrupt Register */
55#define KBC_INT_0 0x4
56#define KBC_INT_FIFO_CNT_INT_STATUS (1 << 2)
Rakesh Iyerfd0fc212011-12-29 19:27:44 -080057#define KBC_INT_KEYPRESS_INT_STATUS (1 << 0)
Rakesh Iyer11f5b302011-01-19 23:38:47 -080058
59#define KBC_ROW_CFG0_0 0x8
60#define KBC_COL_CFG0_0 0x18
Rakesh Iyerd0d150e2011-09-08 15:34:11 -070061#define KBC_TO_CNT_0 0x24
Rakesh Iyer11f5b302011-01-19 23:38:47 -080062#define KBC_INIT_DLY_0 0x28
63#define KBC_RPT_DLY_0 0x2c
64#define KBC_KP_ENT0_0 0x30
65#define KBC_KP_ENT1_0 0x34
66#define KBC_ROW0_MASK_0 0x38
67
68#define KBC_ROW_SHIFT 3
69
70struct tegra_kbc {
71 void __iomem *mmio;
72 struct input_dev *idev;
73 unsigned int irq;
Rakesh Iyer11f5b302011-01-19 23:38:47 -080074 spinlock_t lock;
75 unsigned int repoll_dly;
76 unsigned long cp_dly_jiffies;
Rakesh Iyerd0d150e2011-09-08 15:34:11 -070077 unsigned int cp_to_wkup_dly;
Rakesh Iyer4e8b65f2011-02-18 08:38:02 -080078 bool use_fn_map;
Rakesh Iyer34abeeb2011-04-27 23:18:15 -070079 bool use_ghost_filter;
Rakesh Iyerfd0fc212011-12-29 19:27:44 -080080 bool keypress_caused_wake;
Rakesh Iyer11f5b302011-01-19 23:38:47 -080081 const struct tegra_kbc_platform_data *pdata;
Rakesh Iyer4e8b65f2011-02-18 08:38:02 -080082 unsigned short keycode[KBC_MAX_KEY * 2];
Rakesh Iyer11f5b302011-01-19 23:38:47 -080083 unsigned short current_keys[KBC_MAX_KPENT];
84 unsigned int num_pressed_keys;
Rakesh Iyerfd0fc212011-12-29 19:27:44 -080085 u32 wakeup_key;
Rakesh Iyer11f5b302011-01-19 23:38:47 -080086 struct timer_list timer;
87 struct clk *clk;
88};
89
Bill Pembertond6f6dfd2012-11-23 21:30:24 -080090static const u32 tegra_kbc_default_keymap[] = {
Rakesh Iyer11f5b302011-01-19 23:38:47 -080091 KEY(0, 2, KEY_W),
92 KEY(0, 3, KEY_S),
93 KEY(0, 4, KEY_A),
94 KEY(0, 5, KEY_Z),
95 KEY(0, 7, KEY_FN),
96
Rakesh Iyere7acc842011-01-28 22:05:14 -080097 KEY(1, 7, KEY_LEFTMETA),
Rakesh Iyer11f5b302011-01-19 23:38:47 -080098
99 KEY(2, 6, KEY_RIGHTALT),
100 KEY(2, 7, KEY_LEFTALT),
101
102 KEY(3, 0, KEY_5),
103 KEY(3, 1, KEY_4),
104 KEY(3, 2, KEY_R),
105 KEY(3, 3, KEY_E),
106 KEY(3, 4, KEY_F),
107 KEY(3, 5, KEY_D),
108 KEY(3, 6, KEY_X),
109
110 KEY(4, 0, KEY_7),
111 KEY(4, 1, KEY_6),
112 KEY(4, 2, KEY_T),
113 KEY(4, 3, KEY_H),
114 KEY(4, 4, KEY_G),
115 KEY(4, 5, KEY_V),
116 KEY(4, 6, KEY_C),
117 KEY(4, 7, KEY_SPACE),
118
119 KEY(5, 0, KEY_9),
120 KEY(5, 1, KEY_8),
121 KEY(5, 2, KEY_U),
122 KEY(5, 3, KEY_Y),
123 KEY(5, 4, KEY_J),
124 KEY(5, 5, KEY_N),
125 KEY(5, 6, KEY_B),
126 KEY(5, 7, KEY_BACKSLASH),
127
128 KEY(6, 0, KEY_MINUS),
129 KEY(6, 1, KEY_0),
130 KEY(6, 2, KEY_O),
131 KEY(6, 3, KEY_I),
132 KEY(6, 4, KEY_L),
133 KEY(6, 5, KEY_K),
134 KEY(6, 6, KEY_COMMA),
135 KEY(6, 7, KEY_M),
136
137 KEY(7, 1, KEY_EQUAL),
138 KEY(7, 2, KEY_RIGHTBRACE),
139 KEY(7, 3, KEY_ENTER),
140 KEY(7, 7, KEY_MENU),
141
142 KEY(8, 4, KEY_RIGHTSHIFT),
143 KEY(8, 5, KEY_LEFTSHIFT),
144
145 KEY(9, 5, KEY_RIGHTCTRL),
146 KEY(9, 7, KEY_LEFTCTRL),
147
148 KEY(11, 0, KEY_LEFTBRACE),
149 KEY(11, 1, KEY_P),
150 KEY(11, 2, KEY_APOSTROPHE),
151 KEY(11, 3, KEY_SEMICOLON),
152 KEY(11, 4, KEY_SLASH),
153 KEY(11, 5, KEY_DOT),
154
155 KEY(12, 0, KEY_F10),
156 KEY(12, 1, KEY_F9),
157 KEY(12, 2, KEY_BACKSPACE),
158 KEY(12, 3, KEY_3),
159 KEY(12, 4, KEY_2),
160 KEY(12, 5, KEY_UP),
161 KEY(12, 6, KEY_PRINT),
162 KEY(12, 7, KEY_PAUSE),
163
164 KEY(13, 0, KEY_INSERT),
165 KEY(13, 1, KEY_DELETE),
166 KEY(13, 3, KEY_PAGEUP),
167 KEY(13, 4, KEY_PAGEDOWN),
168 KEY(13, 5, KEY_RIGHT),
169 KEY(13, 6, KEY_DOWN),
170 KEY(13, 7, KEY_LEFT),
171
172 KEY(14, 0, KEY_F11),
173 KEY(14, 1, KEY_F12),
174 KEY(14, 2, KEY_F8),
175 KEY(14, 3, KEY_Q),
176 KEY(14, 4, KEY_F4),
177 KEY(14, 5, KEY_F3),
178 KEY(14, 6, KEY_1),
179 KEY(14, 7, KEY_F7),
180
181 KEY(15, 0, KEY_ESC),
182 KEY(15, 1, KEY_GRAVE),
183 KEY(15, 2, KEY_F5),
184 KEY(15, 3, KEY_TAB),
185 KEY(15, 4, KEY_F1),
186 KEY(15, 5, KEY_F2),
187 KEY(15, 6, KEY_CAPSLOCK),
188 KEY(15, 7, KEY_F6),
Rakesh Iyer4e8b65f2011-02-18 08:38:02 -0800189
190 /* Software Handled Function Keys */
191 KEY(20, 0, KEY_KP7),
192
193 KEY(21, 0, KEY_KP9),
194 KEY(21, 1, KEY_KP8),
195 KEY(21, 2, KEY_KP4),
196 KEY(21, 4, KEY_KP1),
197
198 KEY(22, 1, KEY_KPSLASH),
199 KEY(22, 2, KEY_KP6),
200 KEY(22, 3, KEY_KP5),
201 KEY(22, 4, KEY_KP3),
202 KEY(22, 5, KEY_KP2),
203 KEY(22, 7, KEY_KP0),
204
205 KEY(27, 1, KEY_KPASTERISK),
206 KEY(27, 3, KEY_KPMINUS),
207 KEY(27, 4, KEY_KPPLUS),
208 KEY(27, 5, KEY_KPDOT),
209
210 KEY(28, 5, KEY_VOLUMEUP),
211
212 KEY(29, 3, KEY_HOME),
213 KEY(29, 4, KEY_END),
214 KEY(29, 5, KEY_BRIGHTNESSDOWN),
215 KEY(29, 6, KEY_VOLUMEDOWN),
216 KEY(29, 7, KEY_BRIGHTNESSUP),
217
218 KEY(30, 0, KEY_NUMLOCK),
219 KEY(30, 1, KEY_SCROLLLOCK),
220 KEY(30, 2, KEY_MUTE),
221
222 KEY(31, 4, KEY_HELP),
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800223};
224
Olof Johanssona445c7f2011-12-29 09:58:16 -0800225static const
Bill Pembertond6f6dfd2012-11-23 21:30:24 -0800226struct matrix_keymap_data tegra_kbc_default_keymap_data = {
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800227 .keymap = tegra_kbc_default_keymap,
228 .keymap_size = ARRAY_SIZE(tegra_kbc_default_keymap),
229};
230
231static void tegra_kbc_report_released_keys(struct input_dev *input,
232 unsigned short old_keycodes[],
233 unsigned int old_num_keys,
234 unsigned short new_keycodes[],
235 unsigned int new_num_keys)
236{
237 unsigned int i, j;
238
239 for (i = 0; i < old_num_keys; i++) {
240 for (j = 0; j < new_num_keys; j++)
241 if (old_keycodes[i] == new_keycodes[j])
242 break;
243
244 if (j == new_num_keys)
245 input_report_key(input, old_keycodes[i], 0);
246 }
247}
248
249static void tegra_kbc_report_pressed_keys(struct input_dev *input,
250 unsigned char scancodes[],
251 unsigned short keycodes[],
252 unsigned int num_pressed_keys)
253{
254 unsigned int i;
255
256 for (i = 0; i < num_pressed_keys; i++) {
257 input_event(input, EV_MSC, MSC_SCAN, scancodes[i]);
258 input_report_key(input, keycodes[i], 1);
259 }
260}
261
262static void tegra_kbc_report_keys(struct tegra_kbc *kbc)
263{
264 unsigned char scancodes[KBC_MAX_KPENT];
265 unsigned short keycodes[KBC_MAX_KPENT];
266 u32 val = 0;
267 unsigned int i;
268 unsigned int num_down = 0;
Rakesh Iyer4e8b65f2011-02-18 08:38:02 -0800269 bool fn_keypress = false;
Rakesh Iyer34abeeb2011-04-27 23:18:15 -0700270 bool key_in_same_row = false;
271 bool key_in_same_col = false;
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800272
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800273 for (i = 0; i < KBC_MAX_KPENT; i++) {
274 if ((i % 4) == 0)
275 val = readl(kbc->mmio + KBC_KP_ENT0_0 + i);
276
277 if (val & 0x80) {
278 unsigned int col = val & 0x07;
279 unsigned int row = (val >> 3) & 0x0f;
280 unsigned char scancode =
281 MATRIX_SCAN_CODE(row, col, KBC_ROW_SHIFT);
282
283 scancodes[num_down] = scancode;
Rakesh Iyer4e8b65f2011-02-18 08:38:02 -0800284 keycodes[num_down] = kbc->keycode[scancode];
285 /* If driver uses Fn map, do not report the Fn key. */
286 if ((keycodes[num_down] == KEY_FN) && kbc->use_fn_map)
287 fn_keypress = true;
288 else
289 num_down++;
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800290 }
291
292 val >>= 8;
293 }
Rakesh Iyer4e8b65f2011-02-18 08:38:02 -0800294
295 /*
Rakesh Iyer34abeeb2011-04-27 23:18:15 -0700296 * Matrix keyboard designs are prone to keyboard ghosting.
297 * Ghosting occurs if there are 3 keys such that -
298 * any 2 of the 3 keys share a row, and any 2 of them share a column.
299 * If so ignore the key presses for this iteration.
300 */
Dmitry Torokhov95439cb2011-09-09 09:24:20 -0700301 if (kbc->use_ghost_filter && num_down >= 3) {
Rakesh Iyer34abeeb2011-04-27 23:18:15 -0700302 for (i = 0; i < num_down; i++) {
303 unsigned int j;
304 u8 curr_col = scancodes[i] & 0x07;
305 u8 curr_row = scancodes[i] >> KBC_ROW_SHIFT;
306
307 /*
308 * Find 2 keys such that one key is in the same row
309 * and the other is in the same column as the i-th key.
310 */
311 for (j = i + 1; j < num_down; j++) {
312 u8 col = scancodes[j] & 0x07;
313 u8 row = scancodes[j] >> KBC_ROW_SHIFT;
314
315 if (col == curr_col)
316 key_in_same_col = true;
317 if (row == curr_row)
318 key_in_same_row = true;
319 }
320 }
321 }
322
323 /*
Rakesh Iyer4e8b65f2011-02-18 08:38:02 -0800324 * If the platform uses Fn keymaps, translate keys on a Fn keypress.
325 * Function keycodes are KBC_MAX_KEY apart from the plain keycodes.
326 */
327 if (fn_keypress) {
328 for (i = 0; i < num_down; i++) {
329 scancodes[i] += KBC_MAX_KEY;
330 keycodes[i] = kbc->keycode[scancodes[i]];
331 }
332 }
333
Rakesh Iyer34abeeb2011-04-27 23:18:15 -0700334 /* Ignore the key presses for this iteration? */
335 if (key_in_same_col && key_in_same_row)
336 return;
337
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800338 tegra_kbc_report_released_keys(kbc->idev,
339 kbc->current_keys, kbc->num_pressed_keys,
340 keycodes, num_down);
341 tegra_kbc_report_pressed_keys(kbc->idev, scancodes, keycodes, num_down);
342 input_sync(kbc->idev);
343
344 memcpy(kbc->current_keys, keycodes, sizeof(kbc->current_keys));
345 kbc->num_pressed_keys = num_down;
346}
347
Rakesh Iyerd0d150e2011-09-08 15:34:11 -0700348static void tegra_kbc_set_fifo_interrupt(struct tegra_kbc *kbc, bool enable)
349{
350 u32 val;
351
352 val = readl(kbc->mmio + KBC_CONTROL_0);
353 if (enable)
354 val |= KBC_CONTROL_FIFO_CNT_INT_EN;
355 else
356 val &= ~KBC_CONTROL_FIFO_CNT_INT_EN;
357 writel(val, kbc->mmio + KBC_CONTROL_0);
358}
359
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800360static void tegra_kbc_keypress_timer(unsigned long data)
361{
362 struct tegra_kbc *kbc = (struct tegra_kbc *)data;
363 unsigned long flags;
364 u32 val;
365 unsigned int i;
366
Dmitry Torokhov95439cb2011-09-09 09:24:20 -0700367 spin_lock_irqsave(&kbc->lock, flags);
368
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800369 val = (readl(kbc->mmio + KBC_INT_0) >> 4) & 0xf;
370 if (val) {
371 unsigned long dly;
372
373 tegra_kbc_report_keys(kbc);
374
375 /*
376 * If more than one keys are pressed we need not wait
377 * for the repoll delay.
378 */
379 dly = (val == 1) ? kbc->repoll_dly : 1;
380 mod_timer(&kbc->timer, jiffies + msecs_to_jiffies(dly));
381 } else {
382 /* Release any pressed keys and exit the polling loop */
383 for (i = 0; i < kbc->num_pressed_keys; i++)
384 input_report_key(kbc->idev, kbc->current_keys[i], 0);
385 input_sync(kbc->idev);
386
387 kbc->num_pressed_keys = 0;
388
389 /* All keys are released so enable the keypress interrupt */
Rakesh Iyerd0d150e2011-09-08 15:34:11 -0700390 tegra_kbc_set_fifo_interrupt(kbc, true);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800391 }
Dmitry Torokhov95439cb2011-09-09 09:24:20 -0700392
393 spin_unlock_irqrestore(&kbc->lock, flags);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800394}
395
396static irqreturn_t tegra_kbc_isr(int irq, void *args)
397{
398 struct tegra_kbc *kbc = args;
Dmitry Torokhov95439cb2011-09-09 09:24:20 -0700399 unsigned long flags;
Rakesh Iyerd0d150e2011-09-08 15:34:11 -0700400 u32 val;
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800401
Dmitry Torokhov95439cb2011-09-09 09:24:20 -0700402 spin_lock_irqsave(&kbc->lock, flags);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800403
404 /*
405 * Quickly bail out & reenable interrupts if the fifo threshold
406 * count interrupt wasn't the interrupt source
407 */
408 val = readl(kbc->mmio + KBC_INT_0);
409 writel(val, kbc->mmio + KBC_INT_0);
410
411 if (val & KBC_INT_FIFO_CNT_INT_STATUS) {
412 /*
Dmitry Torokhov95439cb2011-09-09 09:24:20 -0700413 * Until all keys are released, defer further processing to
414 * the polling loop in tegra_kbc_keypress_timer.
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800415 */
Dmitry Torokhov95439cb2011-09-09 09:24:20 -0700416 tegra_kbc_set_fifo_interrupt(kbc, false);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800417 mod_timer(&kbc->timer, jiffies + kbc->cp_dly_jiffies);
Rakesh Iyerfd0fc212011-12-29 19:27:44 -0800418 } else if (val & KBC_INT_KEYPRESS_INT_STATUS) {
419 /* We can be here only through system resume path */
420 kbc->keypress_caused_wake = true;
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800421 }
422
Dmitry Torokhov95439cb2011-09-09 09:24:20 -0700423 spin_unlock_irqrestore(&kbc->lock, flags);
424
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800425 return IRQ_HANDLED;
426}
427
428static void tegra_kbc_setup_wakekeys(struct tegra_kbc *kbc, bool filter)
429{
430 const struct tegra_kbc_platform_data *pdata = kbc->pdata;
431 int i;
432 unsigned int rst_val;
433
Rakesh Iyerbaafb432011-05-11 14:24:10 -0700434 /* Either mask all keys or none. */
435 rst_val = (filter && !pdata->wakeup) ? ~0 : 0;
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800436
437 for (i = 0; i < KBC_MAX_ROW; i++)
438 writel(rst_val, kbc->mmio + KBC_ROW0_MASK_0 + i * 4);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800439}
440
441static void tegra_kbc_config_pins(struct tegra_kbc *kbc)
442{
443 const struct tegra_kbc_platform_data *pdata = kbc->pdata;
444 int i;
445
446 for (i = 0; i < KBC_MAX_GPIO; i++) {
447 u32 r_shft = 5 * (i % 6);
448 u32 c_shft = 4 * (i % 8);
Rakesh Iyer7530c4a2011-01-28 22:05:14 -0800449 u32 r_mask = 0x1f << r_shft;
450 u32 c_mask = 0x0f << c_shft;
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800451 u32 r_offs = (i / 6) * 4 + KBC_ROW_CFG0_0;
452 u32 c_offs = (i / 8) * 4 + KBC_COL_CFG0_0;
453 u32 row_cfg = readl(kbc->mmio + r_offs);
454 u32 col_cfg = readl(kbc->mmio + c_offs);
455
456 row_cfg &= ~r_mask;
457 col_cfg &= ~c_mask;
458
Shridhar Rasal023cea02012-02-03 00:27:30 -0800459 switch (pdata->pin_cfg[i].type) {
460 case PIN_CFG_ROW:
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800461 row_cfg |= ((pdata->pin_cfg[i].num << 1) | 1) << r_shft;
Shridhar Rasal023cea02012-02-03 00:27:30 -0800462 break;
463
464 case PIN_CFG_COL:
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800465 col_cfg |= ((pdata->pin_cfg[i].num << 1) | 1) << c_shft;
Shridhar Rasal023cea02012-02-03 00:27:30 -0800466 break;
467
468 case PIN_CFG_IGNORE:
469 break;
470 }
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800471
472 writel(row_cfg, kbc->mmio + r_offs);
473 writel(col_cfg, kbc->mmio + c_offs);
474 }
475}
476
477static int tegra_kbc_start(struct tegra_kbc *kbc)
478{
479 const struct tegra_kbc_platform_data *pdata = kbc->pdata;
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800480 unsigned int debounce_cnt;
481 u32 val = 0;
482
Prashant Gaikwadf7624702012-06-05 09:59:39 +0530483 clk_prepare_enable(kbc->clk);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800484
485 /* Reset the KBC controller to clear all previous status.*/
486 tegra_periph_reset_assert(kbc->clk);
487 udelay(100);
488 tegra_periph_reset_deassert(kbc->clk);
489 udelay(100);
490
491 tegra_kbc_config_pins(kbc);
492 tegra_kbc_setup_wakekeys(kbc, false);
493
494 writel(pdata->repeat_cnt, kbc->mmio + KBC_RPT_DLY_0);
495
496 /* Keyboard debounce count is maximum of 12 bits. */
497 debounce_cnt = min(pdata->debounce_cnt, KBC_MAX_DEBOUNCE_CNT);
498 val = KBC_DEBOUNCE_CNT_SHIFT(debounce_cnt);
499 val |= KBC_FIFO_TH_CNT_SHIFT(1); /* set fifo interrupt threshold to 1 */
500 val |= KBC_CONTROL_FIFO_CNT_INT_EN; /* interrupt on FIFO threshold */
501 val |= KBC_CONTROL_KBC_EN; /* enable */
502 writel(val, kbc->mmio + KBC_CONTROL_0);
503
504 /*
505 * Compute the delay(ns) from interrupt mode to continuous polling
506 * mode so the timer routine is scheduled appropriately.
507 */
508 val = readl(kbc->mmio + KBC_INIT_DLY_0);
509 kbc->cp_dly_jiffies = usecs_to_jiffies((val & 0xfffff) * 32);
510
511 kbc->num_pressed_keys = 0;
512
513 /*
514 * Atomically clear out any remaining entries in the key FIFO
515 * and enable keyboard interrupts.
516 */
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800517 while (1) {
518 val = readl(kbc->mmio + KBC_INT_0);
519 val >>= 4;
520 if (!val)
521 break;
522
523 val = readl(kbc->mmio + KBC_KP_ENT0_0);
524 val = readl(kbc->mmio + KBC_KP_ENT1_0);
525 }
526 writel(0x7, kbc->mmio + KBC_INT_0);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800527
528 enable_irq(kbc->irq);
529
530 return 0;
531}
532
533static void tegra_kbc_stop(struct tegra_kbc *kbc)
534{
535 unsigned long flags;
536 u32 val;
537
538 spin_lock_irqsave(&kbc->lock, flags);
539 val = readl(kbc->mmio + KBC_CONTROL_0);
540 val &= ~1;
541 writel(val, kbc->mmio + KBC_CONTROL_0);
542 spin_unlock_irqrestore(&kbc->lock, flags);
543
544 disable_irq(kbc->irq);
545 del_timer_sync(&kbc->timer);
546
Prashant Gaikwadf7624702012-06-05 09:59:39 +0530547 clk_disable_unprepare(kbc->clk);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800548}
549
550static int tegra_kbc_open(struct input_dev *dev)
551{
552 struct tegra_kbc *kbc = input_get_drvdata(dev);
553
554 return tegra_kbc_start(kbc);
555}
556
557static void tegra_kbc_close(struct input_dev *dev)
558{
559 struct tegra_kbc *kbc = input_get_drvdata(dev);
560
561 return tegra_kbc_stop(kbc);
562}
563
Bill Pemberton5298cc42012-11-23 21:38:25 -0800564static bool
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800565tegra_kbc_check_pin_cfg(const struct tegra_kbc_platform_data *pdata,
566 struct device *dev, unsigned int *num_rows)
567{
568 int i;
569
570 *num_rows = 0;
571
572 for (i = 0; i < KBC_MAX_GPIO; i++) {
573 const struct tegra_kbc_pin_cfg *pin_cfg = &pdata->pin_cfg[i];
574
Shridhar Rasal023cea02012-02-03 00:27:30 -0800575 switch (pin_cfg->type) {
576 case PIN_CFG_ROW:
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800577 if (pin_cfg->num >= KBC_MAX_ROW) {
578 dev_err(dev,
579 "pin_cfg[%d]: invalid row number %d\n",
580 i, pin_cfg->num);
581 return false;
582 }
583 (*num_rows)++;
Shridhar Rasal023cea02012-02-03 00:27:30 -0800584 break;
585
586 case PIN_CFG_COL:
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800587 if (pin_cfg->num >= KBC_MAX_COL) {
588 dev_err(dev,
589 "pin_cfg[%d]: invalid column number %d\n",
590 i, pin_cfg->num);
591 return false;
592 }
Shridhar Rasal023cea02012-02-03 00:27:30 -0800593 break;
594
595 case PIN_CFG_IGNORE:
596 break;
597
598 default:
599 dev_err(dev,
600 "pin_cfg[%d]: invalid entry type %d\n",
601 pin_cfg->type, pin_cfg->num);
602 return false;
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800603 }
604 }
605
606 return true;
607}
608
Olof Johanssona445c7f2011-12-29 09:58:16 -0800609#ifdef CONFIG_OF
Bill Pemberton5298cc42012-11-23 21:38:25 -0800610static struct tegra_kbc_platform_data *tegra_kbc_dt_parse_pdata(
Dmitry Torokhovb45c8f32012-05-10 22:37:15 -0700611 struct platform_device *pdev)
Olof Johanssona445c7f2011-12-29 09:58:16 -0800612{
613 struct tegra_kbc_platform_data *pdata;
614 struct device_node *np = pdev->dev.of_node;
Olof Johansson145e9732012-03-13 21:36:29 -0700615 u32 prop;
616 int i;
Olof Johanssona445c7f2011-12-29 09:58:16 -0800617
618 if (!np)
619 return NULL;
620
Viresh Kumar131c7132012-03-26 23:55:24 -0700621 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
Olof Johanssona445c7f2011-12-29 09:58:16 -0800622 if (!pdata)
623 return NULL;
624
Olof Johansson145e9732012-03-13 21:36:29 -0700625 if (!of_property_read_u32(np, "nvidia,debounce-delay-ms", &prop))
Olof Johanssona445c7f2011-12-29 09:58:16 -0800626 pdata->debounce_cnt = prop;
627
Olof Johansson145e9732012-03-13 21:36:29 -0700628 if (!of_property_read_u32(np, "nvidia,repeat-delay-ms", &prop))
Olof Johanssona445c7f2011-12-29 09:58:16 -0800629 pdata->repeat_cnt = prop;
630
Olof Johansson145e9732012-03-13 21:36:29 -0700631 if (of_find_property(np, "nvidia,needs-ghost-filter", NULL))
Olof Johanssona445c7f2011-12-29 09:58:16 -0800632 pdata->use_ghost_filter = true;
633
Olof Johansson145e9732012-03-13 21:36:29 -0700634 if (of_find_property(np, "nvidia,wakeup-source", NULL))
Olof Johanssona445c7f2011-12-29 09:58:16 -0800635 pdata->wakeup = true;
636
637 /*
638 * All currently known keymaps with device tree support use the same
639 * pin_cfg, so set it up here.
640 */
641 for (i = 0; i < KBC_MAX_ROW; i++) {
642 pdata->pin_cfg[i].num = i;
Shridhar Rasal023cea02012-02-03 00:27:30 -0800643 pdata->pin_cfg[i].type = PIN_CFG_ROW;
Olof Johanssona445c7f2011-12-29 09:58:16 -0800644 }
645
646 for (i = 0; i < KBC_MAX_COL; i++) {
647 pdata->pin_cfg[KBC_MAX_ROW + i].num = i;
Shridhar Rasal023cea02012-02-03 00:27:30 -0800648 pdata->pin_cfg[KBC_MAX_ROW + i].type = PIN_CFG_COL;
Olof Johanssona445c7f2011-12-29 09:58:16 -0800649 }
650
651 return pdata;
652}
653#else
654static inline struct tegra_kbc_platform_data *tegra_kbc_dt_parse_pdata(
655 struct platform_device *pdev)
656{
657 return NULL;
658}
659#endif
660
Bill Pemberton5298cc42012-11-23 21:38:25 -0800661static int tegra_kbd_setup_keymap(struct tegra_kbc *kbc)
Dmitry Torokhovb45c8f32012-05-10 22:37:15 -0700662{
663 const struct tegra_kbc_platform_data *pdata = kbc->pdata;
664 const struct matrix_keymap_data *keymap_data = pdata->keymap_data;
665 unsigned int keymap_rows = KBC_MAX_KEY;
666 int retval;
667
668 if (keymap_data && pdata->use_fn_map)
669 keymap_rows *= 2;
670
671 retval = matrix_keypad_build_keymap(keymap_data, NULL,
672 keymap_rows, KBC_MAX_COL,
673 kbc->keycode, kbc->idev);
674 if (retval == -ENOSYS || retval == -ENOENT) {
675 /*
676 * If there is no OF support in kernel or keymap
677 * property is missing, use default keymap.
678 */
679 retval = matrix_keypad_build_keymap(
680 &tegra_kbc_default_keymap_data, NULL,
681 keymap_rows, KBC_MAX_COL,
682 kbc->keycode, kbc->idev);
683 }
684
685 return retval;
686}
687
Bill Pemberton5298cc42012-11-23 21:38:25 -0800688static int tegra_kbc_probe(struct platform_device *pdev)
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800689{
690 const struct tegra_kbc_platform_data *pdata = pdev->dev.platform_data;
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800691 struct tegra_kbc *kbc;
692 struct input_dev *input_dev;
693 struct resource *res;
694 int irq;
695 int err;
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800696 int num_rows = 0;
697 unsigned int debounce_cnt;
698 unsigned int scan_time_rows;
699
700 if (!pdata)
Olof Johanssona445c7f2011-12-29 09:58:16 -0800701 pdata = tegra_kbc_dt_parse_pdata(pdev);
702
703 if (!pdata)
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800704 return -EINVAL;
705
Olof Johanssona445c7f2011-12-29 09:58:16 -0800706 if (!tegra_kbc_check_pin_cfg(pdata, &pdev->dev, &num_rows)) {
707 err = -EINVAL;
708 goto err_free_pdata;
709 }
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800710
711 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
712 if (!res) {
713 dev_err(&pdev->dev, "failed to get I/O memory\n");
Olof Johanssona445c7f2011-12-29 09:58:16 -0800714 err = -ENXIO;
715 goto err_free_pdata;
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800716 }
717
718 irq = platform_get_irq(pdev, 0);
719 if (irq < 0) {
720 dev_err(&pdev->dev, "failed to get keyboard IRQ\n");
Olof Johanssona445c7f2011-12-29 09:58:16 -0800721 err = -ENXIO;
722 goto err_free_pdata;
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800723 }
724
725 kbc = kzalloc(sizeof(*kbc), GFP_KERNEL);
726 input_dev = input_allocate_device();
727 if (!kbc || !input_dev) {
728 err = -ENOMEM;
729 goto err_free_mem;
730 }
731
732 kbc->pdata = pdata;
733 kbc->idev = input_dev;
734 kbc->irq = irq;
735 spin_lock_init(&kbc->lock);
736 setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc);
737
738 res = request_mem_region(res->start, resource_size(res), pdev->name);
739 if (!res) {
740 dev_err(&pdev->dev, "failed to request I/O memory\n");
741 err = -EBUSY;
742 goto err_free_mem;
743 }
744
745 kbc->mmio = ioremap(res->start, resource_size(res));
746 if (!kbc->mmio) {
747 dev_err(&pdev->dev, "failed to remap I/O memory\n");
748 err = -ENXIO;
749 goto err_free_mem_region;
750 }
751
752 kbc->clk = clk_get(&pdev->dev, NULL);
753 if (IS_ERR(kbc->clk)) {
754 dev_err(&pdev->dev, "failed to get keyboard clock\n");
755 err = PTR_ERR(kbc->clk);
756 goto err_iounmap;
757 }
758
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800759 /*
760 * The time delay between two consecutive reads of the FIFO is
761 * the sum of the repeat time and the time taken for scanning
762 * the rows. There is an additional delay before the row scanning
763 * starts. The repoll delay is computed in milliseconds.
764 */
765 debounce_cnt = min(pdata->debounce_cnt, KBC_MAX_DEBOUNCE_CNT);
766 scan_time_rows = (KBC_ROW_SCAN_TIME + debounce_cnt) * num_rows;
767 kbc->repoll_dly = KBC_ROW_SCAN_DLY + scan_time_rows + pdata->repeat_cnt;
Rakesh Iyer3f277572011-07-30 12:01:48 -0700768 kbc->repoll_dly = DIV_ROUND_UP(kbc->repoll_dly, KBC_CYCLE_MS);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800769
Dmitry Torokhov19328112012-05-10 22:37:08 -0700770 kbc->wakeup_key = pdata->wakeup_key;
771 kbc->use_fn_map = pdata->use_fn_map;
772 kbc->use_ghost_filter = pdata->use_ghost_filter;
773
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800774 input_dev->name = pdev->name;
775 input_dev->id.bustype = BUS_HOST;
776 input_dev->dev.parent = &pdev->dev;
777 input_dev->open = tegra_kbc_open;
778 input_dev->close = tegra_kbc_close;
779
Dmitry Torokhovb45c8f32012-05-10 22:37:15 -0700780 err = tegra_kbd_setup_keymap(kbc);
Dmitry Torokhov19328112012-05-10 22:37:08 -0700781 if (err) {
Dmitry Torokhovb45c8f32012-05-10 22:37:15 -0700782 dev_err(&pdev->dev, "failed to setup keymap\n");
Dmitry Torokhov19328112012-05-10 22:37:08 -0700783 goto err_put_clk;
784 }
785
786 __set_bit(EV_REP, input_dev->evbit);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800787 input_set_capability(input_dev, EV_MSC, MSC_SCAN);
788
Dmitry Torokhov19328112012-05-10 22:37:08 -0700789 input_set_drvdata(input_dev, kbc);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800790
Rakesh Iyerfd0fc212011-12-29 19:27:44 -0800791 err = request_irq(kbc->irq, tegra_kbc_isr,
792 IRQF_NO_SUSPEND | IRQF_TRIGGER_HIGH, pdev->name, kbc);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800793 if (err) {
794 dev_err(&pdev->dev, "failed to request keyboard IRQ\n");
795 goto err_put_clk;
796 }
797
798 disable_irq(kbc->irq);
799
800 err = input_register_device(kbc->idev);
801 if (err) {
802 dev_err(&pdev->dev, "failed to register input device\n");
803 goto err_free_irq;
804 }
805
806 platform_set_drvdata(pdev, kbc);
807 device_init_wakeup(&pdev->dev, pdata->wakeup);
808
809 return 0;
810
811err_free_irq:
812 free_irq(kbc->irq, pdev);
813err_put_clk:
814 clk_put(kbc->clk);
815err_iounmap:
816 iounmap(kbc->mmio);
817err_free_mem_region:
818 release_mem_region(res->start, resource_size(res));
819err_free_mem:
Axel Lin22f83202011-08-11 09:22:45 -0700820 input_free_device(input_dev);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800821 kfree(kbc);
Olof Johanssona445c7f2011-12-29 09:58:16 -0800822err_free_pdata:
Dmitry Torokhovb45c8f32012-05-10 22:37:15 -0700823 if (!pdev->dev.platform_data)
Olof Johanssona445c7f2011-12-29 09:58:16 -0800824 kfree(pdata);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800825
826 return err;
827}
828
Bill Pembertone2619cf2012-11-23 21:50:47 -0800829static int tegra_kbc_remove(struct platform_device *pdev)
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800830{
831 struct tegra_kbc *kbc = platform_get_drvdata(pdev);
832 struct resource *res;
833
Olof Johanssona445c7f2011-12-29 09:58:16 -0800834 platform_set_drvdata(pdev, NULL);
835
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800836 free_irq(kbc->irq, pdev);
837 clk_put(kbc->clk);
838
839 input_unregister_device(kbc->idev);
840 iounmap(kbc->mmio);
841 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
842 release_mem_region(res->start, resource_size(res));
843
Olof Johanssona445c7f2011-12-29 09:58:16 -0800844 /*
845 * If we do not have platform data attached to the device we
846 * allocated it ourselves and thus need to free it.
847 */
848 if (!pdev->dev.platform_data)
849 kfree(kbc->pdata);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800850
Olof Johanssona445c7f2011-12-29 09:58:16 -0800851 kfree(kbc);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800852
853 return 0;
854}
855
856#ifdef CONFIG_PM_SLEEP
Laxman Dewangan1c407a12013-01-06 18:30:21 -0800857static void tegra_kbc_set_keypress_interrupt(struct tegra_kbc *kbc, bool enable)
858{
859 u32 val;
860
861 val = readl(kbc->mmio + KBC_CONTROL_0);
862 if (enable)
863 val |= KBC_CONTROL_KEYPRESS_INT_EN;
864 else
865 val &= ~KBC_CONTROL_KEYPRESS_INT_EN;
866 writel(val, kbc->mmio + KBC_CONTROL_0);
867}
868
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800869static int tegra_kbc_suspend(struct device *dev)
870{
871 struct platform_device *pdev = to_platform_device(dev);
872 struct tegra_kbc *kbc = platform_get_drvdata(pdev);
873
Rakesh Iyerd0d150e2011-09-08 15:34:11 -0700874 mutex_lock(&kbc->idev->mutex);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800875 if (device_may_wakeup(&pdev->dev)) {
Rakesh Iyerd0d150e2011-09-08 15:34:11 -0700876 disable_irq(kbc->irq);
877 del_timer_sync(&kbc->timer);
878 tegra_kbc_set_fifo_interrupt(kbc, false);
879
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800880 /* Forcefully clear the interrupt status */
881 writel(0x7, kbc->mmio + KBC_INT_0);
Rakesh Iyerd0d150e2011-09-08 15:34:11 -0700882 /*
883 * Store the previous resident time of continuous polling mode.
884 * Force the keyboard into interrupt mode.
885 */
886 kbc->cp_to_wkup_dly = readl(kbc->mmio + KBC_TO_CNT_0);
887 writel(0, kbc->mmio + KBC_TO_CNT_0);
888
889 tegra_kbc_setup_wakekeys(kbc, true);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800890 msleep(30);
Rakesh Iyerd0d150e2011-09-08 15:34:11 -0700891
Rakesh Iyerfd0fc212011-12-29 19:27:44 -0800892 kbc->keypress_caused_wake = false;
Rakesh Iyerb6834b02012-01-22 23:27:54 -0800893 /* Enable keypress interrupt before going into suspend. */
894 tegra_kbc_set_keypress_interrupt(kbc, true);
Rakesh Iyerfd0fc212011-12-29 19:27:44 -0800895 enable_irq(kbc->irq);
Rakesh Iyerd0d150e2011-09-08 15:34:11 -0700896 enable_irq_wake(kbc->irq);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800897 } else {
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800898 if (kbc->idev->users)
899 tegra_kbc_stop(kbc);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800900 }
Rakesh Iyerd0d150e2011-09-08 15:34:11 -0700901 mutex_unlock(&kbc->idev->mutex);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800902
903 return 0;
904}
905
906static int tegra_kbc_resume(struct device *dev)
907{
908 struct platform_device *pdev = to_platform_device(dev);
909 struct tegra_kbc *kbc = platform_get_drvdata(pdev);
910 int err = 0;
911
Rakesh Iyerd0d150e2011-09-08 15:34:11 -0700912 mutex_lock(&kbc->idev->mutex);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800913 if (device_may_wakeup(&pdev->dev)) {
914 disable_irq_wake(kbc->irq);
915 tegra_kbc_setup_wakekeys(kbc, false);
Rakesh Iyerb6834b02012-01-22 23:27:54 -0800916 /* We will use fifo interrupts for key detection. */
917 tegra_kbc_set_keypress_interrupt(kbc, false);
Rakesh Iyerd0d150e2011-09-08 15:34:11 -0700918
919 /* Restore the resident time of continuous polling mode. */
920 writel(kbc->cp_to_wkup_dly, kbc->mmio + KBC_TO_CNT_0);
921
922 tegra_kbc_set_fifo_interrupt(kbc, true);
923
Rakesh Iyerfd0fc212011-12-29 19:27:44 -0800924 if (kbc->keypress_caused_wake && kbc->wakeup_key) {
925 /*
926 * We can't report events directly from the ISR
927 * because timekeeping is stopped when processing
928 * wakeup request and we get a nasty warning when
929 * we try to call do_gettimeofday() in evdev
930 * handler.
931 */
932 input_report_key(kbc->idev, kbc->wakeup_key, 1);
933 input_sync(kbc->idev);
934 input_report_key(kbc->idev, kbc->wakeup_key, 0);
935 input_sync(kbc->idev);
936 }
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800937 } else {
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800938 if (kbc->idev->users)
939 err = tegra_kbc_start(kbc);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800940 }
Rakesh Iyerd0d150e2011-09-08 15:34:11 -0700941 mutex_unlock(&kbc->idev->mutex);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800942
943 return err;
944}
945#endif
946
947static SIMPLE_DEV_PM_OPS(tegra_kbc_pm_ops, tegra_kbc_suspend, tegra_kbc_resume);
948
Olof Johanssona445c7f2011-12-29 09:58:16 -0800949static const struct of_device_id tegra_kbc_of_match[] = {
950 { .compatible = "nvidia,tegra20-kbc", },
951 { },
952};
953MODULE_DEVICE_TABLE(of, tegra_kbc_of_match);
954
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800955static struct platform_driver tegra_kbc_driver = {
956 .probe = tegra_kbc_probe,
Bill Pemberton1cb0aa82012-11-23 21:27:39 -0800957 .remove = tegra_kbc_remove,
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800958 .driver = {
959 .name = "tegra-kbc",
960 .owner = THIS_MODULE,
961 .pm = &tegra_kbc_pm_ops,
Olof Johanssona445c7f2011-12-29 09:58:16 -0800962 .of_match_table = tegra_kbc_of_match,
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800963 },
964};
JJ Ding5146c842011-11-29 11:08:39 -0800965module_platform_driver(tegra_kbc_driver);
Rakesh Iyer11f5b302011-01-19 23:38:47 -0800966
967MODULE_LICENSE("GPL");
968MODULE_AUTHOR("Rakesh Iyer <riyer@nvidia.com>");
969MODULE_DESCRIPTION("Tegra matrix keyboard controller driver");
970MODULE_ALIAS("platform:tegra-kbc");