diff options
Diffstat (limited to 'arch/arm/mach-mx51/mx51_ccwmx51js.c')
-rw-r--r-- | arch/arm/mach-mx51/mx51_ccwmx51js.c | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/arch/arm/mach-mx51/mx51_ccwmx51js.c b/arch/arm/mach-mx51/mx51_ccwmx51js.c index f02746a3dab0..803e26d3006c 100644 --- a/arch/arm/mach-mx51/mx51_ccwmx51js.c +++ b/arch/arm/mach-mx51/mx51_ccwmx51js.c @@ -44,6 +44,8 @@ #include <asm/mach/keypad.h> #include <mach/memory.h> #include <mach/gpio.h> +#include <linux/input.h> +#include <linux/gpio_keys.h> #include <mach/mmc.h> #include "board-mx51_ccwmx51js.h" #include "iomux.h" @@ -649,6 +651,94 @@ static void mxc_init_wm8753(void) } +/* + * GPIO Buttons + */ +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) +static struct gpio_keys_button ccwmx51js_buttons[] = { + { + .gpio = IOMUX_TO_GPIO(MX51_PIN_GPIO1_8), + .code = BTN_1, + .desc = "Button 1", + .active_low = 1, + .wakeup = 1, + }, + { + .gpio = IOMUX_TO_GPIO(MX51_PIN_GPIO1_1), + .code = BTN_2, + .desc = "Button 2", + .active_low = 1, + .wakeup = 1, + } +}; + +static struct gpio_keys_platform_data ccwmx51js_button_data = { + .buttons = ccwmx51js_buttons, + .nbuttons = ARRAY_SIZE(ccwmx51js_buttons), +}; + +static struct platform_device ccwmx51js_button_device = { + .name = "gpio-keys", + .id = -1, + .num_resources = 0, + .dev = { + .platform_data = &ccwmx51js_button_data, + } +}; + +static void __init ccwmx51js_add_device_buttons(void) +{ + platform_device_register(&ccwmx51js_button_device); +} +#else +static void __init ek_add_device_buttons(void) {} +#endif + + +#if defined(CONFIG_NEW_LEDS) + +/* + * GPIO LEDs + */ +static struct gpio_led_platform_data led_data; + +static struct gpio_led ccwmx51js_leds[] = { + { + .name = "LED1", + .gpio = IOMUX_TO_GPIO(MX51_PIN_NANDF_RB2), + .active_low = 1, + .default_trigger = "none", + }, + { + .name = "LED2", + .gpio = IOMUX_TO_GPIO(MX51_PIN_NANDF_RB1), + .active_low = 1, + .default_trigger = "none", + } +}; + +static struct platform_device ccwmx51js_gpio_leds_device = { + .name = "leds-gpio", + .id = -1, + .dev.platform_data = &led_data, +}; + +void __init ccwmx51js_gpio_leds(struct gpio_led *leds, int nr) +{ + if (!nr) + return; + + led_data.leds = leds; + led_data.num_leds = nr; + platform_device_register(&ccwmx51js_gpio_leds_device); +} + +#else +void __init at91_gpio_leds(struct gpio_led *leds, int nr) {} +#endif + + + /*! * Board specific initialization. */ @@ -685,6 +775,8 @@ static void __init mxc_board_init(void) #endif pm_power_off = mxc_power_off; mxc_init_fec(); + ccwmx51js_add_device_buttons(); + ccwmx51js_gpio_leds(ccwmx51js_leds, ARRAY_SIZE(ccwmx51js_leds)); } static void __init mx51_ccwmx51js_timer_init(void) |