]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
OMAP: Add gpio-leds support for Overo
authorSteve Sakoman <steve@sakoman.com>
Thu, 10 Mar 2011 00:08:05 +0000 (18:08 -0600)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 11 Mar 2011 13:48:24 +0000 (15:48 +0200)
This patch adds support for the standard LEDs on the Overo COM and expansion boards

Signed-off-by: Steve Sakoman <steve@sakoman.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
arch/arm/mach-omap2/board-overo.c

index 4278ecb799a2653368d77bd071cac05941268f5e..e694ebd2636cc691131a72a6734c3a7d51df24ff 100644 (file)
@@ -473,6 +473,52 @@ static struct regulator_consumer_supply overo_vmmc1_supply = {
        .supply                 = "vmmc",
 };
 
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
+#include <linux/leds.h>
+
+static struct gpio_led gpio_leds[] = {
+       {
+               .name                   = "overo:red:gpio21",
+               .default_trigger        = "heartbeat",
+               .gpio                   = 21,
+               .active_low             = true,
+       },
+       {
+               .name                   = "overo:blue:gpio22",
+               .default_trigger        = "none",
+               .gpio                   = 22,
+               .active_low             = true,
+       },
+       {
+               .name                   = "overo:blue:COM",
+               .default_trigger        = "mmc0",
+               .gpio                   = -EINVAL,      /* gets replaced */
+               .active_low             = true,
+       },
+};
+
+static struct gpio_led_platform_data gpio_leds_pdata = {
+       .leds           = gpio_leds,
+       .num_leds       = ARRAY_SIZE(gpio_leds),
+};
+
+static struct platform_device gpio_leds_device = {
+       .name   = "leds-gpio",
+       .id     = -1,
+       .dev    = {
+               .platform_data  = &gpio_leds_pdata,
+       },
+};
+
+static void __init overo_init_led(void)
+{
+       platform_device_register(&gpio_leds_device);
+}
+
+#else
+static inline void __init overo_init_led(void) { return; }
+#endif
+
 static int overo_twl_gpio_setup(struct device *dev,
                unsigned gpio, unsigned ngpio)
 {
@@ -480,6 +526,11 @@ static int overo_twl_gpio_setup(struct device *dev,
 
        overo_vmmc1_supply.dev = mmc[0].dev;
 
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
+       /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
+       gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
+#endif
+
        return 0;
 }
 
@@ -487,6 +538,7 @@ static struct twl4030_gpio_platform_data overo_gpio_data = {
        .gpio_base      = OMAP_MAX_GPIO_LINES,
        .irq_base       = TWL4030_GPIO_IRQ_BASE,
        .irq_end        = TWL4030_GPIO_IRQ_END,
+       .use_leds       = true,
        .setup          = overo_twl_gpio_setup,
 };
 
@@ -648,6 +700,7 @@ static void __init overo_init(void)
        overo_spi_init();
        overo_init_smsc911x();
        overo_display_init();
+       overo_init_led();
 
        /* Ensure SDRC pins are mux'd for self-refresh */
        omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);