diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-mx5/mx51_ccwmx51js.c | 90 | ||||
-rw-r--r-- | arch/arm/mach-mx5/mx51_ccwmx51js_gpio.c | 22 |
2 files changed, 112 insertions, 0 deletions
diff --git a/arch/arm/mach-mx5/mx51_ccwmx51js.c b/arch/arm/mach-mx5/mx51_ccwmx51js.c index 167ada25a4c4..63e0377e751b 100644 --- a/arch/arm/mach-mx5/mx51_ccwmx51js.c +++ b/arch/arm/mach-mx5/mx51_ccwmx51js.c @@ -41,6 +41,8 @@ #include <asm/mach/arch.h> #include <asm/mach/time.h> #include <mach/memory.h> +#include <linux/input.h> +#include <linux/gpio_keys.h> #include <mach/gpio.h> #include <mach/mmc.h> #include <mach/mxc_dvfs.h> @@ -201,6 +203,92 @@ static void mxc_power_off(void) #endif } +/* + * 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. */ @@ -294,6 +382,8 @@ static void __init mxc_board_init(void) /* Configure PMIC irq line */ set_irq_type(IOMUX_TO_GPIO(MX51_PIN_GPIO1_5), IRQ_TYPE_EDGE_BOTH); #endif + ccwmx51js_add_device_buttons(); + ccwmx51js_gpio_leds(ccwmx51js_leds, ARRAY_SIZE(ccwmx51js_leds)); pm_power_off = mxc_power_off; } diff --git a/arch/arm/mach-mx5/mx51_ccwmx51js_gpio.c b/arch/arm/mach-mx5/mx51_ccwmx51js_gpio.c index 7d127a40fd92..51b9301a3547 100644 --- a/arch/arm/mach-mx5/mx51_ccwmx51js_gpio.c +++ b/arch/arm/mach-mx5/mx51_ccwmx51js_gpio.c @@ -376,6 +376,28 @@ static struct mxc_iomux_pin_cfg __initdata ccwmx51_iomux_devices_pins[] = { PAD_CTL_100K_PU | PAD_CTL_PKE_ENABLE | PAD_CTL_SRE_FAST), }, #endif + /* Push Buttons */ +#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) + { /* Button 1 */ + MX51_PIN_GPIO1_8, IOMUX_CONFIG_ALT0 | IOMUX_CONFIG_SION, + (PAD_CTL_HYS_NONE | PAD_CTL_DRV_LOW | PAD_CTL_SRE_FAST), + }, + { /* Button 2 */ + MX51_PIN_GPIO1_1, IOMUX_CONFIG_ALT1 | IOMUX_CONFIG_SION, + (PAD_CTL_HYS_NONE | PAD_CTL_DRV_LOW | PAD_CTL_SRE_FAST), + }, +#endif + /* LEDs */ +#if defined(CONFIG_NEW_LEDS) + { /* LED1 */ + MX51_PIN_NANDF_RB2, IOMUX_CONFIG_ALT3 | IOMUX_CONFIG_SION, + (PAD_CTL_HYS_NONE | PAD_CTL_DRV_LOW | PAD_CTL_SRE_FAST), + }, + { /* LED2 */ + MX51_PIN_NANDF_RB1, IOMUX_CONFIG_ALT3 | IOMUX_CONFIG_SION, + (PAD_CTL_HYS_NONE | PAD_CTL_DRV_LOW | PAD_CTL_SRE_FAST), + }, +#endif }; #if defined(CONFIG_SND_SOC_WM8753) || defined(CONFIG_SND_SOC_WM8753_MODULE) |