diff options
Diffstat (limited to 'arch/arm/mach-ux500/board-mop500.c')
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.c | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index fcb587f825cc..cac83a694880 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -18,12 +18,14 @@ | |||
18 | #include <linux/amba/pl022.h> | 18 | #include <linux/amba/pl022.h> |
19 | #include <linux/spi/spi.h> | 19 | #include <linux/spi/spi.h> |
20 | #include <linux/mfd/ab8500.h> | 20 | #include <linux/mfd/ab8500.h> |
21 | #include <linux/input/matrix_keypad.h> | ||
21 | 22 | ||
22 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
23 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
24 | 25 | ||
25 | #include <plat/pincfg.h> | 26 | #include <plat/pincfg.h> |
26 | #include <plat/i2c.h> | 27 | #include <plat/i2c.h> |
28 | #include <plat/ske.h> | ||
27 | 29 | ||
28 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
29 | #include <mach/setup.h> | 31 | #include <mach/setup.h> |
@@ -49,6 +51,24 @@ static pin_cfg_t mop500_pins[] = { | |||
49 | GPIO11_I2C2_SCL, | 51 | GPIO11_I2C2_SCL, |
50 | GPIO229_I2C3_SDA, | 52 | GPIO229_I2C3_SDA, |
51 | GPIO230_I2C3_SCL, | 53 | GPIO230_I2C3_SCL, |
54 | |||
55 | /* SKE keypad */ | ||
56 | GPIO153_KP_I7, | ||
57 | GPIO154_KP_I6, | ||
58 | GPIO155_KP_I5, | ||
59 | GPIO156_KP_I4, | ||
60 | GPIO157_KP_O7, | ||
61 | GPIO158_KP_O6, | ||
62 | GPIO159_KP_O5, | ||
63 | GPIO160_KP_O4, | ||
64 | GPIO161_KP_I3, | ||
65 | GPIO162_KP_I2, | ||
66 | GPIO163_KP_I1, | ||
67 | GPIO164_KP_I0, | ||
68 | GPIO165_KP_O3, | ||
69 | GPIO166_KP_O2, | ||
70 | GPIO167_KP_O1, | ||
71 | GPIO168_KP_O0, | ||
52 | }; | 72 | }; |
53 | 73 | ||
54 | static void ab4500_spi_cs_control(u32 command) | 74 | static void ab4500_spi_cs_control(u32 command) |
@@ -148,12 +168,120 @@ static struct amba_device *amba_devs[] __initdata = { | |||
148 | &u8500_ssp0_device, | 168 | &u8500_ssp0_device, |
149 | }; | 169 | }; |
150 | 170 | ||
171 | static const unsigned int ux500_keymap[] = { | ||
172 | KEY(2, 5, KEY_END), | ||
173 | KEY(4, 1, KEY_POWER), | ||
174 | KEY(3, 5, KEY_VOLUMEDOWN), | ||
175 | KEY(1, 3, KEY_3), | ||
176 | KEY(5, 2, KEY_RIGHT), | ||
177 | KEY(5, 0, KEY_9), | ||
178 | |||
179 | KEY(0, 5, KEY_MENU), | ||
180 | KEY(7, 6, KEY_ENTER), | ||
181 | KEY(4, 5, KEY_0), | ||
182 | KEY(6, 7, KEY_2), | ||
183 | KEY(3, 4, KEY_UP), | ||
184 | KEY(3, 3, KEY_DOWN), | ||
185 | |||
186 | KEY(6, 4, KEY_SEND), | ||
187 | KEY(6, 2, KEY_BACK), | ||
188 | KEY(4, 2, KEY_VOLUMEUP), | ||
189 | KEY(5, 5, KEY_1), | ||
190 | KEY(4, 3, KEY_LEFT), | ||
191 | KEY(3, 2, KEY_7), | ||
192 | }; | ||
193 | |||
194 | static const struct matrix_keymap_data ux500_keymap_data = { | ||
195 | .keymap = ux500_keymap, | ||
196 | .keymap_size = ARRAY_SIZE(ux500_keymap), | ||
197 | }; | ||
198 | |||
199 | /* | ||
200 | * Nomadik SKE keypad | ||
201 | */ | ||
202 | #define ROW_PIN_I0 164 | ||
203 | #define ROW_PIN_I1 163 | ||
204 | #define ROW_PIN_I2 162 | ||
205 | #define ROW_PIN_I3 161 | ||
206 | #define ROW_PIN_I4 156 | ||
207 | #define ROW_PIN_I5 155 | ||
208 | #define ROW_PIN_I6 154 | ||
209 | #define ROW_PIN_I7 153 | ||
210 | #define COL_PIN_O0 168 | ||
211 | #define COL_PIN_O1 167 | ||
212 | #define COL_PIN_O2 166 | ||
213 | #define COL_PIN_O3 165 | ||
214 | #define COL_PIN_O4 160 | ||
215 | #define COL_PIN_O5 159 | ||
216 | #define COL_PIN_O6 158 | ||
217 | #define COL_PIN_O7 157 | ||
218 | |||
219 | #define SKE_KPD_MAX_ROWS 8 | ||
220 | #define SKE_KPD_MAX_COLS 8 | ||
221 | |||
222 | static int ske_kp_rows[] = { | ||
223 | ROW_PIN_I0, ROW_PIN_I1, ROW_PIN_I2, ROW_PIN_I3, | ||
224 | ROW_PIN_I4, ROW_PIN_I5, ROW_PIN_I6, ROW_PIN_I7, | ||
225 | }; | ||
226 | |||
227 | /* | ||
228 | * ske_set_gpio_row: request and set gpio rows | ||
229 | */ | ||
230 | static int ske_set_gpio_row(int gpio) | ||
231 | { | ||
232 | int ret; | ||
233 | |||
234 | ret = gpio_request(gpio, "ske-kp"); | ||
235 | if (ret < 0) { | ||
236 | pr_err("ske_set_gpio_row: gpio request failed\n"); | ||
237 | return ret; | ||
238 | } | ||
239 | |||
240 | ret = gpio_direction_output(gpio, 1); | ||
241 | if (ret < 0) { | ||
242 | pr_err("ske_set_gpio_row: gpio direction failed\n"); | ||
243 | gpio_free(gpio); | ||
244 | } | ||
245 | |||
246 | return ret; | ||
247 | } | ||
248 | |||
249 | /* | ||
250 | * ske_kp_init - enable the gpio configuration | ||
251 | */ | ||
252 | static int ske_kp_init(void) | ||
253 | { | ||
254 | int ret, i; | ||
255 | |||
256 | for (i = 0; i < SKE_KPD_MAX_ROWS; i++) { | ||
257 | ret = ske_set_gpio_row(ske_kp_rows[i]); | ||
258 | if (ret < 0) { | ||
259 | pr_err("ske_kp_init: failed init\n"); | ||
260 | return ret; | ||
261 | } | ||
262 | } | ||
263 | |||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | static struct ske_keypad_platform_data ske_keypad_board = { | ||
268 | .init = ske_kp_init, | ||
269 | .keymap_data = &ux500_keymap_data, | ||
270 | .no_autorepeat = true, | ||
271 | .krow = SKE_KPD_MAX_ROWS, /* 8x8 matrix */ | ||
272 | .kcol = SKE_KPD_MAX_COLS, | ||
273 | .debounce_ms = 40, /* in millsecs */ | ||
274 | }; | ||
275 | |||
276 | |||
277 | |||
151 | /* add any platform devices here - TODO */ | 278 | /* add any platform devices here - TODO */ |
152 | static struct platform_device *platform_devs[] __initdata = { | 279 | static struct platform_device *platform_devs[] __initdata = { |
153 | &u8500_i2c0_device, | 280 | &u8500_i2c0_device, |
154 | &ux500_i2c1_device, | 281 | &ux500_i2c1_device, |
155 | &ux500_i2c2_device, | 282 | &ux500_i2c2_device, |
156 | &ux500_i2c3_device, | 283 | &ux500_i2c3_device, |
284 | &ux500_ske_keypad_device, | ||
157 | }; | 285 | }; |
158 | 286 | ||
159 | static void __init u8500_init_machine(void) | 287 | static void __init u8500_init_machine(void) |
@@ -168,6 +296,7 @@ static void __init u8500_init_machine(void) | |||
168 | ux500_i2c1_device.dev.platform_data = &u8500_i2c1_data; | 296 | ux500_i2c1_device.dev.platform_data = &u8500_i2c1_data; |
169 | ux500_i2c2_device.dev.platform_data = &u8500_i2c2_data; | 297 | ux500_i2c2_device.dev.platform_data = &u8500_i2c2_data; |
170 | ux500_i2c3_device.dev.platform_data = &u8500_i2c3_data; | 298 | ux500_i2c3_device.dev.platform_data = &u8500_i2c3_data; |
299 | ux500_ske_keypad_device.dev.platform_data = &ske_keypad_board; | ||
171 | 300 | ||
172 | u8500_ssp0_device.dev.platform_data = &ssp0_platform_data; | 301 | u8500_ssp0_device.dev.platform_data = &ssp0_platform_data; |
173 | 302 | ||