]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ARM: OMAP1: ams-delta: supersede custom led device by leds-gpio
authorJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Mon, 19 Dec 2011 23:08:53 +0000 (00:08 +0100)
committerTony Lindgren <tony@atomide.com>
Thu, 22 Dec 2011 16:59:49 +0000 (08:59 -0800)
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 <jkrzyszt@tis.icnet.pl>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap1/Kconfig
arch/arm/mach-omap1/board-ams-delta.c
arch/arm/plat-omap/include/plat/board-ams-delta.h

index e14532f236a0279a2ce317887f5d80d7fa229bd4..5b1edbae6893467d2b93952fef1c956ae566728f 100644 (file)
@@ -156,6 +156,7 @@ config MACH_AMS_DELTA
        depends on ARCH_OMAP1 && ARCH_OMAP15XX
        select FIQ
        select GPIO_GENERIC_PLATFORM
+       select LEDS_GPIO_REGISTER
        help
          Support for the Amstrad E3 (codename Delta) videophone. Say Y here
          if you have such a device.
index cff2711dc259f02bbff3166ecdec2500d80f11c8..034d0094e93a2f5dc8d8a08ade256937e8a4b35c 100644 (file)
@@ -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();
index 68ffe328a777e85dc6b5bb2c778440aeaac610e6..a0f86ca75ddca67a4b24294db49386193d73cd9c 100644 (file)
 
 #if defined (CONFIG_MACH_AMS_DELTA)
 
-#define AMS_DELTA_LATCH1_LED_CAMERA    0x01
-#define AMS_DELTA_LATCH1_LED_ADVERT    0x02
-#define AMS_DELTA_LATCH1_LED_EMAIL     0x04
-#define AMS_DELTA_LATCH1_LED_HANDSFREE 0x08
-#define AMS_DELTA_LATCH1_LED_VOICEMAIL 0x10
-#define AMS_DELTA_LATCH1_LED_VOICE     0x20
-
 #define AMS_DELTA_LATCH2_LCD_VBLEN     0x0001
 #define AMS_DELTA_LATCH2_LCD_NDISP     0x0002
 #define AMS_DELTA_LATCH2_NAND_NCE      0x0004
 #define AMS_DELTA_GPIO_PIN_CONFIG      11
 #define AMS_DELTA_GPIO_PIN_NAND_RB     12
 
-#define AMS_DELTA_GPIO_PIN_LED_CAMERA          232
-#define AMS_DELTA_GPIO_PIN_LED_ADVERT          233
-#define AMS_DELTA_GPIO_PIN_LED_EMAIL           234
-#define AMS_DELTA_GPIO_PIN_LED_HANDSFREE       235
-#define AMS_DELTA_GPIO_PIN_LED_VOICEMAIL       236
-#define AMS_DELTA_GPIO_PIN_LED_VOICE           237
-
 #define AMS_DELTA_GPIO_PIN_LCD_VBLEN           240
 #define AMS_DELTA_GPIO_PIN_LCD_NDISP           241
 #define AMS_DELTA_GPIO_PIN_NAND_NCE            242
 #define AMS_DELTA_GPIO_PIN_MODEM_NRESET                252
 #define AMS_DELTA_GPIO_PIN_MODEM_CODEC         253
 
-#define AMS_DELTA_LATCH1_GPIO_BASE     AMS_DELTA_GPIO_PIN_LED_CAMERA
-#define AMS_DELTA_LATCH1_NGPIO         8
 #define AMS_DELTA_LATCH2_GPIO_BASE     AMS_DELTA_GPIO_PIN_LCD_VBLEN
 #define AMS_DELTA_LATCH2_NGPIO         16
 
 #ifndef __ASSEMBLY__
 void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value);
-#define ams_delta_latch1_write(mask, value) \
-       ams_delta_latch_write(AMS_DELTA_LATCH1_GPIO_BASE, \
-                       AMS_DELTA_LATCH1_NGPIO, (mask), (value))
 #define ams_delta_latch2_write(mask, value) \
        ams_delta_latch_write(AMS_DELTA_LATCH2_GPIO_BASE, \
                        AMS_DELTA_LATCH2_NGPIO, (mask), (value))