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

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

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
 arch/arm/configs/omap3_pandora_defconfig |   51 +++++++++++++++++++++---------
 1 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/arch/arm/configs/omap3_pandora_defconfig b/arch/arm/configs/omap3_pandora_defconfig
index 1c2b7a2..e8cfbe9 100644
--- a/arch/arm/configs/omap3_pandora_defconfig
+++ b/arch/arm/configs/omap3_pandora_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28-rc3-omap1
-# Wed Nov  5 22:02:43 2008
+# Linux kernel version: 2.6.28-rc6-omap1
+# Thu Nov 27 00:25:13 2008
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -418,7 +418,9 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
-# CONFIG_FW_LOADER is not set
+CONFIG_FW_LOADER=y
+# CONFIG_FIRMWARE_IN_KERNEL is not set
+CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_DEBUG_DRIVER is not set
 # CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
@@ -777,6 +779,10 @@ CONFIG_GPIOLIB=y
 # CONFIG_GPIO_SYSFS is not set
 
 #
+# Memory mapped GPIO expanders:
+#
+
+#
 # I2C GPIO expanders:
 #
 # CONFIG_GPIO_MAX732X is not set
@@ -799,11 +805,11 @@ CONFIG_GPIO_TWL4030=y
 # CONFIG_THERMAL is not set
 # CONFIG_THERMAL_HWMON is not set
 # CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
 
 #
 # Sonics Silicon Backplane
 #
-CONFIG_SSB_POSSIBLE=y
 # CONFIG_SSB is not set
 
 #
@@ -871,6 +877,7 @@ CONFIG_FB_CFB_IMAGEBLIT=y
 # CONFIG_FB_S1D13XXX is not set
 # CONFIG_FB_VIRTUAL is not set
 # CONFIG_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
 CONFIG_FB_OMAP=y
 # CONFIG_FB_OMAP_LCDC_EXTERNAL is not set
 # CONFIG_FB_OMAP_BOOTLOADER_INIT is not set
@@ -967,7 +974,6 @@ CONFIG_USB_MON=y
 # CONFIG_USB_C67X00_HCD is not set
 # CONFIG_USB_EHCI_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
-# CONFIG_USB_ISP1760_HCD is not set
 # CONFIG_USB_OHCI_HCD is not set
 # CONFIG_USB_SL811_HCD is not set
 # CONFIG_USB_R8A66597_HCD is not set
@@ -997,11 +1003,11 @@ CONFIG_USB_INVENTRA_DMA=y
 # CONFIG_USB_TMC is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
 #
 
 #
-# may also be needed; see USB_STORAGE Help for more information
+# see USB_STORAGE Help for more information
 #
 # CONFIG_USB_STORAGE is not set
 # CONFIG_USB_LIBUSUAL is not set
@@ -1090,7 +1096,27 @@ CONFIG_MMC_OMAP_HS=y
 # CONFIG_MMC_SPI is not set
 # CONFIG_MEMSTICK is not set
 # CONFIG_ACCESSIBILITY is not set
-# CONFIG_NEW_LEDS is not set
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+
+#
+# LED drivers
+#
+# CONFIG_LEDS_OMAP_DEBUG is not set
+# CONFIG_LEDS_OMAP is not set
+# CONFIG_LEDS_OMAP_PWM is not set
+# CONFIG_LEDS_PCA9532 is not set
+CONFIG_LEDS_GPIO=y
+# CONFIG_LEDS_PCA955X is not set
+
+#
+# LED Triggers
+#
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+CONFIG_LEDS_TRIGGER_BACKLIGHT=y
+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_HCTOSYS=y
@@ -1122,12 +1148,14 @@ CONFIG_RTC_INTF_DEV=y
 CONFIG_RTC_DRV_TWL4030=y
 # CONFIG_RTC_DRV_S35390A is not set
 # CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
 
 #
 # SPI RTC drivers
 #
 # CONFIG_RTC_DRV_M41T94 is not set
 # CONFIG_RTC_DRV_DS1305 is not set
+# CONFIG_RTC_DRV_DS1390 is not set
 # CONFIG_RTC_DRV_MAX6902 is not set
 # CONFIG_RTC_DRV_R9701 is not set
 # CONFIG_RTC_DRV_RS5C348 is not set
@@ -1152,14 +1180,7 @@ CONFIG_RTC_DRV_TWL4030=y
 # on-CPU RTC drivers
 #
 # CONFIG_DMADEVICES is not set
-
-#
-# Voltage and Current regulators
-#
 # CONFIG_REGULATOR is not set
-# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
-# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
-# CONFIG_REGULATOR_BQ24022 is not set
 # CONFIG_UIO is not set
 
 #
-- 
1.5.4.3


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

* Re: [PATCH 1/2] Add support for GPIO LEDs on pandora
  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 ` Tony Lindgren
  2009-01-08 14:56   ` Koen Kooi
  1 sibling, 1 reply; 9+ messages in thread
From: Tony Lindgren @ 2009-01-08 14:32 UTC (permalink / raw)
  To: Grazvydas Ignotas; +Cc: linux-omap

* Grazvydas Ignotas <notasas@gmail.com> [081127 12:04]:
> 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.

Pushing to l-o tree and adding to omap3-upstream queue for next
merge window. Not adding the defconfig changes to upstream queue
right now as the patch does not apply.

Tony

> 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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/2] Add support for GPIO LEDs on pandora
  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
  0 siblings, 2 replies; 9+ messages in thread
From: Koen Kooi @ 2009-01-08 14:56 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Grazvydas Ignotas, linux-omap@vger.kernel.org List,
	Richard Purdie

[-- Attachment #1: Type: text/plain, Size: 906 bytes --]


Op 8 jan 2009, om 15:32 heeft Tony Lindgren het volgende geschreven:

> * Grazvydas Ignotas <notasas@gmail.com> [081127 12:04]:
>> 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.
>
> Pushing to l-o tree and adding to omap3-upstream queue for next
> merge window. Not adding the defconfig changes to upstream queue
> right now as the patch does not apply.
>>
>> +		.name			= "pandora::lcd_bl",
>> +		.default_trigger	= "backlight",
>> +		.gpio			= -EINVAL,
>>

That's a wrong usage of the 'backlight' trigger, which shouldn't get  
into mainline since it sets a bad example. The backlight trigger is  
meant to sync leds with the backlight (e.g. dim keypad leds), not to  
make leds a backlight.

regards,

Koen

[-- Attachment #2: Dit deel van het bericht is digitaal ondertekend --]
[-- Type: application/pgp-signature, Size: 186 bytes --]

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

* Re: [PATCH 1/2] Add support for GPIO LEDs on pandora
  2009-01-08 14:56   ` Koen Kooi
@ 2009-01-08 15:12     ` Tony Lindgren
  2009-01-08 15:28     ` Mark Brown
  1 sibling, 0 replies; 9+ messages in thread
From: Tony Lindgren @ 2009-01-08 15:12 UTC (permalink / raw)
  To: Koen Kooi
  Cc: Grazvydas Ignotas, linux-omap@vger.kernel.org List,
	Richard Purdie

* Koen Kooi <k.kooi@student.utwente.nl> [090108 16:56]:
>
> Op 8 jan 2009, om 15:32 heeft Tony Lindgren het volgende geschreven:
>
>> * Grazvydas Ignotas <notasas@gmail.com> [081127 12:04]:
>>> 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.
>>
>> Pushing to l-o tree and adding to omap3-upstream queue for next
>> merge window. Not adding the defconfig changes to upstream queue
>> right now as the patch does not apply.
>>>
>>> +		.name			= "pandora::lcd_bl",
>>> +		.default_trigger	= "backlight",
>>> +		.gpio			= -EINVAL,
>>>
>
> That's a wrong usage of the 'backlight' trigger, which shouldn't get  
> into mainline since it sets a bad example. The backlight trigger is  
> meant to sync leds with the backlight (e.g. dim keypad leds), not to  
> make leds a backlight.

OK, thanks, dropping from l-o and omap3-upstream.

Tony

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

* Re: [PATCH 1/2] Add support for GPIO LEDs on pandora
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Mark Brown @ 2009-01-08 15:28 UTC (permalink / raw)
  To: Koen Kooi
  Cc: Tony Lindgren, Grazvydas Ignotas, linux-omap@vger.kernel.org List,
	Richard Purdie

On Thu, Jan 08, 2009 at 03:56:07PM +0100, Koen Kooi wrote:

> That's a wrong usage of the 'backlight' trigger, which shouldn't get  
> into mainline since it sets a bad example. The backlight trigger is  

Too late, it's already there.

> meant to sync leds with the backlight (e.g. dim keypad leds), not to  
> make leds a backlight.

Indeed, though it does get the job done (modulo setting the brightness
via the backlight interface).  I'm not sure if it's better to make the
existing trigger to do what we want or to come up with some other way of
using LEDs as a backlight.

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

* Re: [PATCH 1/2] Add support for GPIO LEDs on pandora
  2009-01-08 15:28     ` Mark Brown
@ 2009-01-08 16:29       ` Grazvydas Ignotas
  2009-01-08 20:04         ` David Brownell
  0 siblings, 1 reply; 9+ messages in thread
From: Grazvydas Ignotas @ 2009-01-08 16:29 UTC (permalink / raw)
  To: Mark Brown
  Cc: Koen Kooi, Tony Lindgren, linux-omap@vger.kernel.org List,
	Richard Purdie

[-- Attachment #1: Type: text/plain, Size: 866 bytes --]

On Thu, Jan 8, 2009 at 5:28 PM, Mark Brown <broonie@sirena.org.uk> wrote:
> On Thu, Jan 08, 2009 at 03:56:07PM +0100, Koen Kooi wrote:
>
>> That's a wrong usage of the 'backlight' trigger, which shouldn't get
>> into mainline since it sets a bad example. The backlight trigger is
>
> Too late, it's already there.
>
>> meant to sync leds with the backlight (e.g. dim keypad leds), not to
>> make leds a backlight.
>
> Indeed, though it does get the job done (modulo setting the brightness
> via the backlight interface).  I'm not sure if it's better to make the
> existing trigger to do what we want or to come up with some other way of
> using LEDs as a backlight.

Well this was only temporary solution until we have proper code to
control BL using TWL4030's PWM capability. Attached is a patch which
uses "always on" trigger instead, if that is still of any use.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-support-for-GPIO-LEDs-on-pandora.patch --]
[-- Type: text/x-diff; name=0001-Add-support-for-GPIO-LEDs-on-pandora.patch, Size: 3488 bytes --]

From ada0defe08eb8f3dcddbcb0b885791edfce82744 Mon Sep 17 00:00:00 2001
From: Grazvydas Ignotas <notasas@gmail.com>
Date: Thu, 27 Nov 2008 00:10:35 +0200
Subject: [PATCH] Add support for GPIO LEDs on pandora

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 b319610..64477aa 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -24,6 +24,7 @@
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 #include <linux/i2c/twl4030.h>
+#include <linux/leds.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -61,6 +62,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	= "default-on",
+		.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)
 {
@@ -69,6 +117,16 @@ static int omap3pandora_twl_gpio_setup(struct device *dev,
 	omap3pandora_mmc[1].gpio_cd = gpio + 1;
 	twl4030_mmc_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;
 }
 
@@ -76,6 +134,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,
 };
 
@@ -180,6 +239,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

* Re: [PATCH 1/2] Add support for GPIO LEDs on pandora
  2009-01-08 16:29       ` Grazvydas Ignotas
@ 2009-01-08 20:04         ` David Brownell
  2009-01-09 11:53           ` Tony Lindgren
  0 siblings, 1 reply; 9+ messages in thread
From: David Brownell @ 2009-01-08 20:04 UTC (permalink / raw)
  To: Grazvydas Ignotas
  Cc: Mark Brown, Koen Kooi, Tony Lindgren,
	linux-omap@vger.kernel.org List, Richard Purdie

On Thursday 08 January 2009, Grazvydas Ignotas wrote:
> Well this was only temporary solution until we have proper code to
> control BL using TWL4030's PWM capability.

I have code to support the PWM0/PWM1 signals that needs testing,
so that's not far away.  The LEDA/LEDB PWMs can control brightness
of those two signals, as part of that same patch.

- Dave


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

* Re: [PATCH 1/2] Add support for GPIO LEDs on pandora
  2009-01-08 20:04         ` David Brownell
@ 2009-01-09 11:53           ` Tony Lindgren
  0 siblings, 0 replies; 9+ messages in thread
From: Tony Lindgren @ 2009-01-09 11:53 UTC (permalink / raw)
  To: David Brownell
  Cc: Grazvydas Ignotas, Mark Brown, Koen Kooi,
	linux-omap@vger.kernel.org List, Richard Purdie

* David Brownell <david-b@pacbell.net> [090108 22:04]:
> On Thursday 08 January 2009, Grazvydas Ignotas wrote:
> > Well this was only temporary solution until we have proper code to
> > control BL using TWL4030's PWM capability.
> 
> I have code to support the PWM0/PWM1 signals that needs testing,
> so that's not far away.  The LEDA/LEDB PWMs can control brightness
> of those two signals, as part of that same patch.

OK, let's wait a bit then so these patches can be done directly
against the mainline tree. So not pushing Grazvydas' patch to
l-o at this point.

Regards,

Tony

^ permalink raw reply	[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