From 5ca6180fa6d7333fb5fabf30420b0e3cc32dd731 Mon Sep 17 00:00:00 2001 From: Janusz Krzysztofik Date: Tue, 20 Dec 2011 00:08:53 +0100 Subject: ARM: OMAP1: ams-delta: supersede custom led device by leds-gpio Now that the Amstrad Delta on-board latches have been converted to GPIO devices, use the generic driver to control on-board LEDs which hang off those latches. Signed-off-by: Janusz Krzysztofik Signed-off-by: Tony Lindgren --- arch/arm/mach-omap1/board-ams-delta.c | 87 +++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 39 deletions(-) (limited to 'arch/arm/mach-omap1/board-ams-delta.c') diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index cff2711..034d009 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -164,18 +164,21 @@ static struct omap_board_config_kernel ams_delta_config[] __initdata = { { OMAP_TAG_LCD, &ams_delta_lcd_config }, }; +#define LATCH1_GPIO_BASE 232 +#define LATCH1_NGPIO 8 + static struct resource latch1_resources[] __initconst = { [0] = { .name = "dat", .start = LATCH1_PHYS, - .end = LATCH1_PHYS + (AMS_DELTA_LATCH1_NGPIO - 1) / 8, + .end = LATCH1_PHYS + (LATCH1_NGPIO - 1) / 8, .flags = IORESOURCE_MEM, }, }; static struct bgpio_pdata latch1_pdata __initconst = { - .base = AMS_DELTA_LATCH1_GPIO_BASE, - .ngpio = AMS_DELTA_LATCH1_NGPIO, + .base = LATCH1_GPIO_BASE, + .ngpio = LATCH1_NGPIO, }; static struct platform_device latch1_gpio_device = { @@ -214,42 +217,12 @@ static struct platform_device latch2_gpio_device = { static struct gpio latch_gpios[] __initconst = { { - .gpio = AMS_DELTA_GPIO_PIN_LED_CAMERA, - .flags = GPIOF_OUT_INIT_LOW, - .label = "led_camera", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_LED_ADVERT, - .flags = GPIOF_OUT_INIT_LOW, - .label = "led_advert", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_LED_EMAIL, - .flags = GPIOF_OUT_INIT_LOW, - .label = "led_email", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_LED_HANDSFREE, - .flags = GPIOF_OUT_INIT_LOW, - .label = "led_handsfree", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_LED_VOICEMAIL, - .flags = GPIOF_OUT_INIT_LOW, - .label = "led_voicemail", - }, - { - .gpio = AMS_DELTA_GPIO_PIN_LED_VOICE, - .flags = GPIOF_OUT_INIT_LOW, - .label = "led_voice", - }, - { - .gpio = AMS_DELTA_LATCH1_GPIO_BASE + 6, + .gpio = LATCH1_GPIO_BASE + 6, .flags = GPIOF_OUT_INIT_LOW, .label = "dockit1", }, { - .gpio = AMS_DELTA_LATCH1_GPIO_BASE + 7, + .gpio = LATCH1_GPIO_BASE + 7, .flags = GPIOF_OUT_INIT_LOW, .label = "dockit2", }, @@ -399,9 +372,45 @@ static struct platform_device ams_delta_lcd_device = { .id = -1, }; -static struct platform_device ams_delta_led_device = { - .name = "ams-delta-led", - .id = -1 +static struct gpio_led gpio_leds[] __initconst = { + { + .name = "camera", + .gpio = LATCH1_GPIO_BASE + 0, + .default_state = LEDS_GPIO_DEFSTATE_OFF, +#ifdef CONFIG_LEDS_TRIGGERS + .default_trigger = "ams_delta_camera", +#endif + }, + { + .name = "advert", + .gpio = LATCH1_GPIO_BASE + 1, + .default_state = LEDS_GPIO_DEFSTATE_OFF, + }, + { + .name = "email", + .gpio = LATCH1_GPIO_BASE + 2, + .default_state = LEDS_GPIO_DEFSTATE_OFF, + }, + { + .name = "handsfree", + .gpio = LATCH1_GPIO_BASE + 3, + .default_state = LEDS_GPIO_DEFSTATE_OFF, + }, + { + .name = "voicemail", + .gpio = LATCH1_GPIO_BASE + 4, + .default_state = LEDS_GPIO_DEFSTATE_OFF, + }, + { + .name = "voice", + .gpio = LATCH1_GPIO_BASE + 5, + .default_state = LEDS_GPIO_DEFSTATE_OFF, + }, +}; + +static struct gpio_led_platform_data leds_pdata __initconst = { + .leds = gpio_leds, + .num_leds = ARRAY_SIZE(gpio_leds), }; static struct i2c_board_info ams_delta_camera_board_info[] = { @@ -459,7 +468,6 @@ static struct platform_device *ams_delta_devices[] __initdata = { static struct platform_device *late_devices[] __initconst = { &ams_delta_nand_device, &ams_delta_lcd_device, - &ams_delta_led_device, }; static void __init ams_delta_init(void) @@ -493,6 +501,7 @@ static void __init ams_delta_init(void) led_trigger_register_simple("ams_delta_camera", &ams_delta_camera_led_trigger); #endif + gpio_led_register_device(-1, &leds_pdata); platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices)); ams_delta_init_fiq(); -- cgit v1.1