diff options
author | Sundar Iyer <sundar.iyer@stericsson.com> | 2010-12-03 10:05:36 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@stericsson.com> | 2010-12-19 14:51:37 -0500 |
commit | e43abe6f98641e40460d74a002f09c7751db48f9 (patch) | |
tree | 309e9e716b1cbf95aab7b73c6b97907a123621c9 /arch/arm/mach-ux500 | |
parent | 593e9d70fb0f1ece1cf2a61c701dec35d8e41f8d (diff) |
mach-ux500: move keymaps to new file
Move keylayouts to a dedicated file and plug these keylayouts
for input platform data. This will make addition of new and custom
keylayouts localized.
Signed-off-by: Sundar Iyer <sundar.iyer@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Diffstat (limited to 'arch/arm/mach-ux500')
-rw-r--r-- | arch/arm/mach-ux500/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-ux500/board-mop500-keypads.c | 134 | ||||
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.c | 111 | ||||
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-ux500/devices-db8500.c | 2 |
5 files changed, 140 insertions, 111 deletions
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index 841118335607..3d2c6a510a87 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile | |||
@@ -5,7 +5,8 @@ | |||
5 | obj-y := clock.o cpu.o devices.o devices-common.o | 5 | obj-y := clock.o cpu.o devices.o devices-common.o |
6 | obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o | 6 | obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o |
7 | obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o prcmu.o | 7 | obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o prcmu.o |
8 | obj-$(CONFIG_MACH_U8500_MOP) += board-mop500.o board-mop500-sdi.o | 8 | obj-$(CONFIG_MACH_U8500_MOP) += board-mop500.o board-mop500-sdi.o \ |
9 | board-mop500-keypads.o | ||
9 | obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o | 10 | obj-$(CONFIG_MACH_U5500) += board-u5500.o board-u5500-sdi.o |
10 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o | 11 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o |
11 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 12 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
diff --git a/arch/arm/mach-ux500/board-mop500-keypads.c b/arch/arm/mach-ux500/board-mop500-keypads.c new file mode 100644 index 000000000000..b634615b1381 --- /dev/null +++ b/arch/arm/mach-ux500/board-mop500-keypads.c | |||
@@ -0,0 +1,134 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * License Terms: GNU General Public License v2 | ||
5 | * | ||
6 | * Keypad layouts for various boards | ||
7 | */ | ||
8 | |||
9 | #include <linux/i2c.h> | ||
10 | #include <linux/gpio.h> | ||
11 | #include <linux/interrupt.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | #include <linux/mfd/stmpe.h> | ||
14 | #include <linux/input/matrix_keypad.h> | ||
15 | |||
16 | #include <plat/pincfg.h> | ||
17 | #include <plat/ske.h> | ||
18 | |||
19 | #include <mach/devices.h> | ||
20 | #include <mach/hardware.h> | ||
21 | |||
22 | #include "devices-db8500.h" | ||
23 | #include "board-mop500.h" | ||
24 | |||
25 | /* STMPE/SKE keypad use this key layout */ | ||
26 | static const unsigned int mop500_keymap[] = { | ||
27 | KEY(2, 5, KEY_END), | ||
28 | KEY(4, 1, KEY_POWER), | ||
29 | KEY(3, 5, KEY_VOLUMEDOWN), | ||
30 | KEY(1, 3, KEY_3), | ||
31 | KEY(5, 2, KEY_RIGHT), | ||
32 | KEY(5, 0, KEY_9), | ||
33 | |||
34 | KEY(0, 5, KEY_MENU), | ||
35 | KEY(7, 6, KEY_ENTER), | ||
36 | KEY(4, 5, KEY_0), | ||
37 | KEY(6, 7, KEY_2), | ||
38 | KEY(3, 4, KEY_UP), | ||
39 | KEY(3, 3, KEY_DOWN), | ||
40 | |||
41 | KEY(6, 4, KEY_SEND), | ||
42 | KEY(6, 2, KEY_BACK), | ||
43 | KEY(4, 2, KEY_VOLUMEUP), | ||
44 | KEY(5, 5, KEY_1), | ||
45 | KEY(4, 3, KEY_LEFT), | ||
46 | KEY(3, 2, KEY_7), | ||
47 | }; | ||
48 | |||
49 | static const struct matrix_keymap_data mop500_keymap_data = { | ||
50 | .keymap = mop500_keymap, | ||
51 | .keymap_size = ARRAY_SIZE(mop500_keymap), | ||
52 | }; | ||
53 | |||
54 | /* | ||
55 | * Nomadik SKE keypad | ||
56 | */ | ||
57 | #define ROW_PIN_I0 164 | ||
58 | #define ROW_PIN_I1 163 | ||
59 | #define ROW_PIN_I2 162 | ||
60 | #define ROW_PIN_I3 161 | ||
61 | #define ROW_PIN_I4 156 | ||
62 | #define ROW_PIN_I5 155 | ||
63 | #define ROW_PIN_I6 154 | ||
64 | #define ROW_PIN_I7 153 | ||
65 | #define COL_PIN_O0 168 | ||
66 | #define COL_PIN_O1 167 | ||
67 | #define COL_PIN_O2 166 | ||
68 | #define COL_PIN_O3 165 | ||
69 | #define COL_PIN_O4 160 | ||
70 | #define COL_PIN_O5 159 | ||
71 | #define COL_PIN_O6 158 | ||
72 | #define COL_PIN_O7 157 | ||
73 | |||
74 | #define SKE_KPD_MAX_ROWS 8 | ||
75 | #define SKE_KPD_MAX_COLS 8 | ||
76 | |||
77 | static int ske_kp_rows[] = { | ||
78 | ROW_PIN_I0, ROW_PIN_I1, ROW_PIN_I2, ROW_PIN_I3, | ||
79 | ROW_PIN_I4, ROW_PIN_I5, ROW_PIN_I6, ROW_PIN_I7, | ||
80 | }; | ||
81 | |||
82 | /* | ||
83 | * ske_set_gpio_row: request and set gpio rows | ||
84 | */ | ||
85 | static int ske_set_gpio_row(int gpio) | ||
86 | { | ||
87 | int ret; | ||
88 | |||
89 | ret = gpio_request(gpio, "ske-kp"); | ||
90 | if (ret < 0) { | ||
91 | pr_err("ske_set_gpio_row: gpio request failed\n"); | ||
92 | return ret; | ||
93 | } | ||
94 | |||
95 | ret = gpio_direction_output(gpio, 1); | ||
96 | if (ret < 0) { | ||
97 | pr_err("ske_set_gpio_row: gpio direction failed\n"); | ||
98 | gpio_free(gpio); | ||
99 | } | ||
100 | |||
101 | return ret; | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | * ske_kp_init - enable the gpio configuration | ||
106 | */ | ||
107 | static int ske_kp_init(void) | ||
108 | { | ||
109 | int ret, i; | ||
110 | |||
111 | for (i = 0; i < SKE_KPD_MAX_ROWS; i++) { | ||
112 | ret = ske_set_gpio_row(ske_kp_rows[i]); | ||
113 | if (ret < 0) { | ||
114 | pr_err("ske_kp_init: failed init\n"); | ||
115 | return ret; | ||
116 | } | ||
117 | } | ||
118 | |||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | static struct ske_keypad_platform_data ske_keypad_board = { | ||
123 | .init = ske_kp_init, | ||
124 | .keymap_data = &mop500_keymap_data, | ||
125 | .no_autorepeat = true, | ||
126 | .krow = SKE_KPD_MAX_ROWS, /* 8x8 matrix */ | ||
127 | .kcol = SKE_KPD_MAX_COLS, | ||
128 | .debounce_ms = 40, /* in millisecs */ | ||
129 | }; | ||
130 | |||
131 | void mop500_keypad_init(void) | ||
132 | { | ||
133 | db8500_add_ske_keypad(&ske_keypad_board); | ||
134 | } | ||
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index 060b23aab8e4..0bc0aa311de1 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | #include <plat/pincfg.h> | 27 | #include <plat/pincfg.h> |
28 | #include <plat/i2c.h> | 28 | #include <plat/i2c.h> |
29 | #include <plat/ske.h> | ||
30 | 29 | ||
31 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
32 | #include <mach/setup.h> | 31 | #include <mach/setup.h> |
@@ -172,116 +171,8 @@ static void __init mop500_i2c_init(void) | |||
172 | db8500_add_i2c3(&u8500_i2c3_data); | 171 | db8500_add_i2c3(&u8500_i2c3_data); |
173 | } | 172 | } |
174 | 173 | ||
175 | static const unsigned int ux500_keymap[] = { | ||
176 | KEY(2, 5, KEY_END), | ||
177 | KEY(4, 1, KEY_POWER), | ||
178 | KEY(3, 5, KEY_VOLUMEDOWN), | ||
179 | KEY(1, 3, KEY_3), | ||
180 | KEY(5, 2, KEY_RIGHT), | ||
181 | KEY(5, 0, KEY_9), | ||
182 | |||
183 | KEY(0, 5, KEY_MENU), | ||
184 | KEY(7, 6, KEY_ENTER), | ||
185 | KEY(4, 5, KEY_0), | ||
186 | KEY(6, 7, KEY_2), | ||
187 | KEY(3, 4, KEY_UP), | ||
188 | KEY(3, 3, KEY_DOWN), | ||
189 | |||
190 | KEY(6, 4, KEY_SEND), | ||
191 | KEY(6, 2, KEY_BACK), | ||
192 | KEY(4, 2, KEY_VOLUMEUP), | ||
193 | KEY(5, 5, KEY_1), | ||
194 | KEY(4, 3, KEY_LEFT), | ||
195 | KEY(3, 2, KEY_7), | ||
196 | }; | ||
197 | |||
198 | static const struct matrix_keymap_data ux500_keymap_data = { | ||
199 | .keymap = ux500_keymap, | ||
200 | .keymap_size = ARRAY_SIZE(ux500_keymap), | ||
201 | }; | ||
202 | |||
203 | /* | ||
204 | * Nomadik SKE keypad | ||
205 | */ | ||
206 | #define ROW_PIN_I0 164 | ||
207 | #define ROW_PIN_I1 163 | ||
208 | #define ROW_PIN_I2 162 | ||
209 | #define ROW_PIN_I3 161 | ||
210 | #define ROW_PIN_I4 156 | ||
211 | #define ROW_PIN_I5 155 | ||
212 | #define ROW_PIN_I6 154 | ||
213 | #define ROW_PIN_I7 153 | ||
214 | #define COL_PIN_O0 168 | ||
215 | #define COL_PIN_O1 167 | ||
216 | #define COL_PIN_O2 166 | ||
217 | #define COL_PIN_O3 165 | ||
218 | #define COL_PIN_O4 160 | ||
219 | #define COL_PIN_O5 159 | ||
220 | #define COL_PIN_O6 158 | ||
221 | #define COL_PIN_O7 157 | ||
222 | |||
223 | #define SKE_KPD_MAX_ROWS 8 | ||
224 | #define SKE_KPD_MAX_COLS 8 | ||
225 | |||
226 | static int ske_kp_rows[] = { | ||
227 | ROW_PIN_I0, ROW_PIN_I1, ROW_PIN_I2, ROW_PIN_I3, | ||
228 | ROW_PIN_I4, ROW_PIN_I5, ROW_PIN_I6, ROW_PIN_I7, | ||
229 | }; | ||
230 | |||
231 | /* | ||
232 | * ske_set_gpio_row: request and set gpio rows | ||
233 | */ | ||
234 | static int ske_set_gpio_row(int gpio) | ||
235 | { | ||
236 | int ret; | ||
237 | |||
238 | ret = gpio_request(gpio, "ske-kp"); | ||
239 | if (ret < 0) { | ||
240 | pr_err("ske_set_gpio_row: gpio request failed\n"); | ||
241 | return ret; | ||
242 | } | ||
243 | |||
244 | ret = gpio_direction_output(gpio, 1); | ||
245 | if (ret < 0) { | ||
246 | pr_err("ske_set_gpio_row: gpio direction failed\n"); | ||
247 | gpio_free(gpio); | ||
248 | } | ||
249 | |||
250 | return ret; | ||
251 | } | ||
252 | |||
253 | /* | ||
254 | * ske_kp_init - enable the gpio configuration | ||
255 | */ | ||
256 | static int ske_kp_init(void) | ||
257 | { | ||
258 | int ret, i; | ||
259 | |||
260 | for (i = 0; i < SKE_KPD_MAX_ROWS; i++) { | ||
261 | ret = ske_set_gpio_row(ske_kp_rows[i]); | ||
262 | if (ret < 0) { | ||
263 | pr_err("ske_kp_init: failed init\n"); | ||
264 | return ret; | ||
265 | } | ||
266 | } | ||
267 | |||
268 | return 0; | ||
269 | } | ||
270 | |||
271 | static struct ske_keypad_platform_data ske_keypad_board = { | ||
272 | .init = ske_kp_init, | ||
273 | .keymap_data = &ux500_keymap_data, | ||
274 | .no_autorepeat = true, | ||
275 | .krow = SKE_KPD_MAX_ROWS, /* 8x8 matrix */ | ||
276 | .kcol = SKE_KPD_MAX_COLS, | ||
277 | .debounce_ms = 40, /* in millsecs */ | ||
278 | }; | ||
279 | |||
280 | |||
281 | |||
282 | /* add any platform devices here - TODO */ | 174 | /* add any platform devices here - TODO */ |
283 | static struct platform_device *platform_devs[] __initdata = { | 175 | static struct platform_device *platform_devs[] __initdata = { |
284 | &ux500_ske_keypad_device, | ||
285 | }; | 176 | }; |
286 | 177 | ||
287 | static void __init mop500_spi_init(void) | 178 | static void __init mop500_spi_init(void) |
@@ -309,6 +200,8 @@ static void __init u8500_init_machine(void) | |||
309 | mop500_spi_init(); | 200 | mop500_spi_init(); |
310 | mop500_uart_init(); | 201 | mop500_uart_init(); |
311 | 202 | ||
203 | mop500_keypad_init(); | ||
204 | |||
312 | platform_device_register(&ab8500_device); | 205 | platform_device_register(&ab8500_device); |
313 | 206 | ||
314 | i2c_register_board_info(0, mop500_i2c0_devices, | 207 | i2c_register_board_info(0, mop500_i2c0_devices, |
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h index 3a338e6850a4..3104ae2a02c2 100644 --- a/arch/arm/mach-ux500/board-mop500.h +++ b/arch/arm/mach-ux500/board-mop500.h | |||
@@ -16,5 +16,6 @@ | |||
16 | 16 | ||
17 | extern void mop500_sdi_init(void); | 17 | extern void mop500_sdi_init(void); |
18 | extern void mop500_sdi_tc35892_init(void); | 18 | extern void mop500_sdi_tc35892_init(void); |
19 | extern void mop500_keypad_init(void); | ||
19 | 20 | ||
20 | #endif | 21 | #endif |
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c index a7b0a183c037..23c695d54977 100644 --- a/arch/arm/mach-ux500/devices-db8500.c +++ b/arch/arm/mach-ux500/devices-db8500.c | |||
@@ -128,7 +128,7 @@ struct resource keypad_resources[] = { | |||
128 | }, | 128 | }, |
129 | }; | 129 | }; |
130 | 130 | ||
131 | struct platform_device ux500_ske_keypad_device = { | 131 | struct platform_device u8500_ske_keypad_device = { |
132 | .name = "nmk-ske-keypad", | 132 | .name = "nmk-ske-keypad", |
133 | .id = -1, | 133 | .id = -1, |
134 | .num_resources = ARRAY_SIZE(keypad_resources), | 134 | .num_resources = ARRAY_SIZE(keypad_resources), |