summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-2.6.27/ts72xx/0010-GPIO-leds.patch
blob: 74c4490666eb2ca39d9e5fdf4ab2bad7848375ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From 11158bb59b2d848f1827d4ed59d4ca20d1f91d11 Mon Sep 17 00:00:00 2001
From: Matthieu Crapet <mcrapet@gmail.com>
Date: Sun, 4 Jan 2009 00:58:03 +0100
Subject: [PATCH] GPIO leds
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 arch/arm/mach-ep93xx/core.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 24b24c7..88afbe6 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -33,6 +33,7 @@
 #include <linux/amba/bus.h>
 #include <linux/amba/serial.h>
 #include <linux/dma-mapping.h>
+#include <linux/leds.h>
 
 #include <asm/types.h>
 #include <asm/setup.h>
@@ -480,6 +481,35 @@ static struct platform_device ep93xx_ohci_device = {
 	.resource	= ep93xx_ohci_resources,
 };
 
+
+static const struct gpio_led ep93xx_led_pins[] = {
+  {
+    .name = "green",
+    .gpio = EP93XX_GPIO_LINE_GRLED,
+    .active_low = 0,
+    .default_trigger = "heartbeat",
+  },
+  {
+    .name = "red",
+    .gpio = EP93XX_GPIO_LINE_RDLED,
+    .active_low = 0,
+  }
+};
+
+static const struct gpio_led_platform_data ep93xx_led_data = {
+  .num_leds = ARRAY_SIZE(ep93xx_led_pins),
+  .leds = (void *)ep93xx_led_pins,
+};
+
+static struct platform_device ep93xx_gpio_leds = {
+  .name = "leds-gpio",
+  .id = -1,
+  .dev = {
+    .platform_data = (void *)&ep93xx_led_data,
+  }
+};
+
+
 extern void ep93xx_gpio_init(void);
 
 void __init ep93xx_init_devices(void)
@@ -500,6 +530,7 @@ void __init ep93xx_init_devices(void)
 	amba_device_register(&uart2_device, &iomem_resource);
 	amba_device_register(&uart3_device, &iomem_resource);
 
+	platform_device_register(&ep93xx_gpio_leds);
 	platform_device_register(&ep93xx_rtc_device);
 	platform_device_register(&ep93xx_ohci_device);
 }
-- 
1.6.0.4