[PATCH] ARM: gta02: Add LED support

Lars-Peter Clausen lars at metafoo.de
Thu Sep 24 19:41:53 CEST 2009


The gta02 has three leds which are connected though gpio pins and thus can get
supported by using the generic leds-gpio driver.

Signed-off-by: Lars-Peter Clausen <lars at metafoo.de>
---
 arch/arm/mach-s3c2442/mach-gta02.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c
index 0f0c619..7629371 100644
--- a/arch/arm/mach-s3c2442/mach-gta02.c
+++ b/arch/arm/mach-s3c2442/mach-gta02.c
@@ -60,6 +60,8 @@
 
 #include <linux/gpio_keys.h>
 
+#include <linux/leds.h>
+
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
@@ -583,6 +585,35 @@ static struct platform_device gta02_buttons_device = {
 	},
 };
 
+/* LEDs */
+static struct gpio_led gta02_gpio_leds[] = {
+	{
+		.name	= "gta02-power:orange",
+		.gpio	= GTA02_GPIO_PWR_LED1,
+	},
+	{
+		.name	= "gta02-power:blue",
+		.gpio	= GTA02_GPIO_PWR_LED2,
+	},
+	{
+		.name	= "gta02-aux:red",
+		.gpio	= GTA02_GPIO_AUX_LED,
+	},
+};
+
+static struct gpio_led_platform_data gta02_gpio_leds_pdata = {
+	.leds = gta02_gpio_leds,
+	.num_leds = ARRAY_SIZE(gta02_gpio_leds),
+};
+
+static struct platform_device gta02_leds_device = {
+	.name = "leds-gpio",
+	.id   = -1,
+	.dev = {
+		.platform_data = &gta02_gpio_leds_pdata,
+	},
+};
+
 static void __init gta02_map_io(void)
 {
 	s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
@@ -604,6 +635,7 @@ static struct platform_device *gta02_devices[] __initdata = {
 	&s3c_device_iis,
 	&s3c_device_i2c0,
 	&gta02_buttons_device,
+	&gta02_leds_device,
 };
 
 /* These guys DO need to be children of PMU. */
-- 
1.5.6.5




More information about the openmoko-kernel mailing list