diff options
Diffstat (limited to 'arch/arm/mach-tegra/board-enterprise-kbc.c')
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-kbc.c | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-enterprise-kbc.c b/arch/arm/mach-tegra/board-enterprise-kbc.c new file mode 100644 index 00000000000..4b719d78c9a --- /dev/null +++ b/arch/arm/mach-tegra/board-enterprise-kbc.c | |||
@@ -0,0 +1,107 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-tegra/board-enterprise-kbc.c | ||
3 | * Keys configuration for Nvidia tegra3 enterprise platform. | ||
4 | * | ||
5 | * Copyright (C) 2011 NVIDIA, Inc. | ||
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 version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
19 | * 02111-1307, USA | ||
20 | */ | ||
21 | |||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/input.h> | ||
25 | #include <mach/io.h> | ||
26 | #include <mach/iomap.h> | ||
27 | #include <mach/kbc.h> | ||
28 | |||
29 | #include "board.h" | ||
30 | #include "board-enterprise.h" | ||
31 | #include "devices.h" | ||
32 | |||
33 | #define ENTERPRISE_ROW_COUNT 3 | ||
34 | #define ENTERPRISE_COL_COUNT 3 | ||
35 | |||
36 | static const u32 kbd_keymap[] = { | ||
37 | KEY(0, 0, KEY_POWER), | ||
38 | |||
39 | KEY(1, 0, KEY_HOME), | ||
40 | KEY(1, 1, KEY_BACK), | ||
41 | KEY(1, 2, KEY_VOLUMEDOWN), | ||
42 | |||
43 | KEY(2, 0, KEY_MENU), | ||
44 | KEY(2, 1, KEY_SEARCH), | ||
45 | KEY(2, 2, KEY_VOLUMEUP), | ||
46 | }; | ||
47 | |||
48 | static const struct matrix_keymap_data keymap_data = { | ||
49 | .keymap = kbd_keymap, | ||
50 | .keymap_size = ARRAY_SIZE(kbd_keymap), | ||
51 | }; | ||
52 | |||
53 | static struct tegra_kbc_wake_key enterprise_wake_cfg[] = { | ||
54 | [0] = { | ||
55 | .row = 0, | ||
56 | .col = 0, | ||
57 | }, | ||
58 | [1] = { | ||
59 | .row = 1, | ||
60 | .col = 0, | ||
61 | }, | ||
62 | [2] = { | ||
63 | .row = 1, | ||
64 | .col = 1, | ||
65 | }, | ||
66 | [3] = { | ||
67 | .row = 2, | ||
68 | .col = 0, | ||
69 | }, | ||
70 | }; | ||
71 | |||
72 | static struct tegra_kbc_platform_data enterprise_kbc_platform_data = { | ||
73 | .debounce_cnt = 20 * 32, /* 20 ms debaunce time */ | ||
74 | .repeat_cnt = 1, | ||
75 | .scan_count = 30, | ||
76 | .wakeup = true, | ||
77 | .keymap_data = &keymap_data, | ||
78 | .wake_cnt = 4, | ||
79 | .wake_cfg = &enterprise_wake_cfg[0], | ||
80 | #ifdef CONFIG_ANDROID | ||
81 | .disable_ev_rep = true, | ||
82 | #endif | ||
83 | }; | ||
84 | |||
85 | int __init enterprise_kbc_init(void) | ||
86 | { | ||
87 | struct tegra_kbc_platform_data *data = &enterprise_kbc_platform_data; | ||
88 | int i; | ||
89 | tegra_kbc_device.dev.platform_data = &enterprise_kbc_platform_data; | ||
90 | pr_info("Registering tegra-kbc\n"); | ||
91 | |||
92 | BUG_ON((KBC_MAX_ROW + KBC_MAX_COL) > KBC_MAX_GPIO); | ||
93 | for (i = 0; i < ENTERPRISE_ROW_COUNT; i++) { | ||
94 | data->pin_cfg[i].num = i; | ||
95 | data->pin_cfg[i].is_row = true; | ||
96 | data->pin_cfg[i].en = true; | ||
97 | } | ||
98 | for (i = 0; i < ENTERPRISE_COL_COUNT; i++) { | ||
99 | data->pin_cfg[i + KBC_PIN_GPIO_16].num = i; | ||
100 | data->pin_cfg[i + KBC_PIN_GPIO_16].en = true; | ||
101 | } | ||
102 | |||
103 | platform_device_register(&tegra_kbc_device); | ||
104 | pr_info("Registering successful tegra-kbc\n"); | ||
105 | return 0; | ||
106 | } | ||
107 | |||