diff options
author | Jochen Friedrich <jochen@scram.de> | 2011-08-18 16:51:06 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-10-17 04:12:42 -0400 |
commit | dbd406f9d0a1d33a1303eb75cbe3f9435513d339 (patch) | |
tree | c84b7e57f891945aa1a5a8b079948094073965c4 /arch/arm/mach-sa1100 | |
parent | de0bc0d1b008d1240c03a0bac4f5534f995ab802 (diff) |
ARM: 7025/1: simpad: add GPIO based device definitions.
Register keyboard, polled keyboard and I2C platform
devices based on GPIOs.
Signed-off-by: Jochen Friedrich <jochen@scram.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r-- | arch/arm/mach-sa1100/simpad.c | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c index c3c66b0d6b6e..9f0eefdaa2a1 100644 --- a/arch/arm/mach-sa1100/simpad.c +++ b/arch/arm/mach-sa1100/simpad.c | |||
@@ -29,6 +29,9 @@ | |||
29 | 29 | ||
30 | #include <linux/serial_core.h> | 30 | #include <linux/serial_core.h> |
31 | #include <linux/ioport.h> | 31 | #include <linux/ioport.h> |
32 | #include <linux/input.h> | ||
33 | #include <linux/gpio_keys.h> | ||
34 | #include <linux/i2c-gpio.h> | ||
32 | 35 | ||
33 | #include "generic.h" | 36 | #include "generic.h" |
34 | 37 | ||
@@ -249,6 +252,65 @@ static void simpad_power_off(void) | |||
249 | 252 | ||
250 | } | 253 | } |
251 | 254 | ||
255 | /* | ||
256 | * gpio_keys | ||
257 | */ | ||
258 | |||
259 | static struct gpio_keys_button simpad_button_table[] = { | ||
260 | { KEY_POWER, IRQ_GPIO_POWER_BUTTON, 1, "power button" }, | ||
261 | }; | ||
262 | |||
263 | static struct gpio_keys_platform_data simpad_keys_data = { | ||
264 | .buttons = simpad_button_table, | ||
265 | .nbuttons = ARRAY_SIZE(simpad_button_table), | ||
266 | }; | ||
267 | |||
268 | static struct platform_device simpad_keys = { | ||
269 | .name = "gpio-keys", | ||
270 | .dev = { | ||
271 | .platform_data = &simpad_keys_data, | ||
272 | }, | ||
273 | }; | ||
274 | |||
275 | static struct gpio_keys_button simpad_polled_button_table[] = { | ||
276 | { KEY_PROG1, SIMPAD_UCB1X00_GPIO_PROG1, 1, "prog1 button" }, | ||
277 | { KEY_PROG2, SIMPAD_UCB1X00_GPIO_PROG2, 1, "prog2 button" }, | ||
278 | { KEY_UP, SIMPAD_UCB1X00_GPIO_UP, 1, "up button" }, | ||
279 | { KEY_DOWN, SIMPAD_UCB1X00_GPIO_DOWN, 1, "down button" }, | ||
280 | { KEY_LEFT, SIMPAD_UCB1X00_GPIO_LEFT, 1, "left button" }, | ||
281 | { KEY_RIGHT, SIMPAD_UCB1X00_GPIO_RIGHT, 1, "right button" }, | ||
282 | }; | ||
283 | |||
284 | static struct gpio_keys_platform_data simpad_polled_keys_data = { | ||
285 | .buttons = simpad_polled_button_table, | ||
286 | .nbuttons = ARRAY_SIZE(simpad_polled_button_table), | ||
287 | .poll_interval = 50, | ||
288 | }; | ||
289 | |||
290 | static struct platform_device simpad_polled_keys = { | ||
291 | .name = "gpio-keys-polled", | ||
292 | .dev = { | ||
293 | .platform_data = &simpad_polled_keys_data, | ||
294 | }, | ||
295 | }; | ||
296 | |||
297 | /* | ||
298 | * i2c | ||
299 | */ | ||
300 | static struct i2c_gpio_platform_data simpad_i2c_data = { | ||
301 | .sda_pin = GPIO_GPIO21, | ||
302 | .scl_pin = GPIO_GPIO25, | ||
303 | .udelay = 10, | ||
304 | .timeout = HZ, | ||
305 | }; | ||
306 | |||
307 | static struct platform_device simpad_i2c = { | ||
308 | .name = "i2c-gpio", | ||
309 | .id = 0, | ||
310 | .dev = { | ||
311 | .platform_data = &simpad_i2c_data, | ||
312 | }, | ||
313 | }; | ||
252 | 314 | ||
253 | /* | 315 | /* |
254 | * MediaQ Video Device | 316 | * MediaQ Video Device |
@@ -259,7 +321,10 @@ static struct platform_device simpad_mq200fb = { | |||
259 | }; | 321 | }; |
260 | 322 | ||
261 | static struct platform_device *devices[] __initdata = { | 323 | static struct platform_device *devices[] __initdata = { |
262 | &simpad_mq200fb | 324 | &simpad_keys, |
325 | &simpad_polled_keys, | ||
326 | &simpad_mq200fb, | ||
327 | &simpad_i2c, | ||
263 | }; | 328 | }; |
264 | 329 | ||
265 | 330 | ||