public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Add support for GPIO LEDs on pandora
@ 2008-11-27 10:02 Grazvydas Ignotas
  2008-11-27 10:02 ` [PATCH 2/2] Enable LEDs in pandora defconfig Grazvydas Ignotas
  2009-01-08 14:32 ` [PATCH 1/2] Add support for GPIO LEDs on pandora Tony Lindgren
  0 siblings, 2 replies; 9+ messages in thread
From: Grazvydas Ignotas @ 2008-11-27 10:02 UTC (permalink / raw)
  To: linux-omap; +Cc: Grazvydas Ignotas

Pandora has some LEDs and backlights connected to OMAP
GPIOs and TWL4030/TPS65950 LED/PWM signals. This patch
registers them all with leds-gpio driver. TWL4030/TPS65950
controlled ones will be switched to PWM driver when it's ready.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
 arch/arm/mach-omap2/board-omap3pandora.c |   60 ++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 69517a5..2dfa988 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -28,6 +28,7 @@
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 #include <linux/i2c/twl4030.h>
+#include <linux/leds.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
@@ -166,6 +167,53 @@ static struct omap_uart_config omap3pandora_uart_config __initdata = {
 	.enabled_uarts	= (1 << 2), /* UART3 */
 };
 
+static struct gpio_led omap3pandora_gpio_leds[] = {
+	{
+		.name			= "pandora::keypad_bl",
+		.gpio			= -EINVAL,	/* gets replaced */
+		.active_low		= true,
+	}, {
+		.name			= "pandora::power",
+		.default_trigger	= "default-on",
+		.gpio			= -EINVAL,
+		.active_low		= true,
+	}, {
+		.name			= "pandora::lcd_bl",
+		.default_trigger	= "backlight",
+		.gpio			= -EINVAL,
+	}, {
+		.name			= "pandora::charger",
+		.gpio			= -EINVAL,
+	}, {
+		.name			= "pandora::sd1",
+		.default_trigger	= "mmc0",
+		.gpio			= 128,
+	}, {
+		.name			= "pandora::sd2",
+		.default_trigger	= "mmc1",
+		.gpio			= 129,
+	}, {
+		.name			= "pandora::bluetooth",
+		.gpio			= 158,
+	}, {
+		.name			= "pandora::wifi",
+		.gpio			= 159,
+	},
+};
+
+static struct gpio_led_platform_data omap3pandora_gpio_led_data = {
+	.leds		= omap3pandora_gpio_leds,
+	.num_leds	= ARRAY_SIZE(omap3pandora_gpio_leds),
+};
+
+static struct platform_device omap3pandora_leds_gpio = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &omap3pandora_gpio_led_data,
+	},
+};
+
 static int omap3pandora_twl_gpio_setup(struct device *dev,
 		unsigned gpio, unsigned ngpio)
 {
@@ -174,6 +222,16 @@ static int omap3pandora_twl_gpio_setup(struct device *dev,
 	omap3pandora_mmc[1].gpio_cd = gpio + 1;
 	hsmmc_init(omap3pandora_mmc);
 
+	/* TWL4030_GPIO_MAX + 0 == ledA, KEYPAD_BACKLIGHT (out, active low) */
+	omap3pandora_gpio_leds[0].gpio = gpio + TWL4030_GPIO_MAX + 0;
+
+	/* TWL4030_GPIO_MAX + 1 == ledB, POWER_LED (out, active low) */
+	omap3pandora_gpio_leds[1].gpio = gpio + TWL4030_GPIO_MAX + 1;
+
+	/* gpio + {6,7} is PWM{0,1}, LCD_BACKLIGHT and CHARGER_LED */
+	omap3pandora_gpio_leds[2].gpio = gpio + 6;
+	omap3pandora_gpio_leds[3].gpio = gpio + 7;
+
 	return 0;
 }
 
@@ -181,6 +239,7 @@ static struct twl4030_gpio_platform_data omap3pandora_gpio_data = {
 	.gpio_base	= OMAP_MAX_GPIO_LINES,
 	.irq_base	= TWL4030_GPIO_IRQ_BASE,
 	.irq_end	= TWL4030_GPIO_IRQ_END,
+	.use_leds	= true,
 	.setup		= omap3pandora_twl_gpio_setup,
 };
 
@@ -285,6 +344,7 @@ static struct omap_board_config_kernel omap3pandora_config[] __initdata = {
 
 static struct platform_device *omap3pandora_devices[] __initdata = {
 	&omap3pandora_lcd_device,
+	&omap3pandora_leds_gpio,
 };
 
 static void __init omap3pandora_init(void)
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-01-09 11:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-27 10:02 [PATCH 1/2] Add support for GPIO LEDs on pandora Grazvydas Ignotas
2008-11-27 10:02 ` [PATCH 2/2] Enable LEDs in pandora defconfig Grazvydas Ignotas
2009-01-08 14:32 ` [PATCH 1/2] Add support for GPIO LEDs on pandora Tony Lindgren
2009-01-08 14:56   ` Koen Kooi
2009-01-08 15:12     ` Tony Lindgren
2009-01-08 15:28     ` Mark Brown
2009-01-08 16:29       ` Grazvydas Ignotas
2009-01-08 20:04         ` David Brownell
2009-01-09 11:53           ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox