Added patches from the LEDs maintainer
[nslu2-linux/kernel.git] / patches / 2.6.25 / ixp4xx-use-leds-gpio.patch
blob670d02a5db2b6f382c1b44108af1934907a7d016
1 From 1a98a764ad629f116b00f9d1a3485275b300cb82 Mon Sep 17 00:00:00 2001
2 From: Rod Whitby <rod@whitby.id.au>
3 Date: Fri, 25 Jan 2008 22:41:06 +1030
4 Subject: [PATCH] ixp4xx: Use leds-gpio driver instead of IXP4XX-GPIO-LED driver
6 These are the only three boards to use the IXP4XX-GPIO-LED driver, and
7 they can all use the new leds-gpio driver instead with no change in
8 functionality.
10 Signed-off-by: Rod Whitby <rod@whitby.id.au>
11 ---
12 arch/arm/configs/ixp4xx_defconfig | 4 +-
13 arch/arm/mach-ixp4xx/dsmg600-setup.c | 36 +++++++++++++++------------------
14 arch/arm/mach-ixp4xx/nas100d-setup.c | 31 +++++++++++++----------------
15 arch/arm/mach-ixp4xx/nslu2-setup.c | 34 +++++++++++++------------------
16 4 files changed, 46 insertions(+), 59 deletions(-)
18 diff --git a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig
19 index 2d5ae33..77fe3b0 100644
20 --- a/arch/arm/configs/ixp4xx_defconfig
21 +++ b/arch/arm/configs/ixp4xx_defconfig
22 @@ -1330,8 +1330,8 @@ CONFIG_LEDS_CLASS=y
24 # LED drivers
26 -CONFIG_LEDS_IXP4XX=y
27 -# CONFIG_LEDS_GPIO is not set
28 +# CONFIG_LEDS_IXP4XX is not set
29 +CONFIG_LEDS_GPIO=y
32 # LED Triggers
33 diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
34 index 1e75e10..1909ad5 100644
35 --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
36 +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
37 @@ -14,6 +14,7 @@
38 #include <linux/kernel.h>
39 #include <linux/serial.h>
40 #include <linux/serial_8250.h>
41 +#include <linux/leds.h>
43 #include <asm/mach-types.h>
44 #include <asm/mach/arch.h>
45 @@ -48,29 +49,28 @@ static struct platform_device dsmg600_i2c_controller = {
46 .dev.platform_data = &dsmg600_i2c_gpio_pins,
49 -#ifdef CONFIG_LEDS_CLASS
50 -static struct resource dsmg600_led_resources[] = {
51 +static struct gpio_led dsmg600_led_pins[] = {
53 - .name = "power",
54 - .start = DSMG600_LED_PWR_GPIO,
55 - .end = DSMG600_LED_PWR_GPIO,
56 - .flags = IXP4XX_GPIO_HIGH,
57 + .name = "power",
58 + .gpio = DSMG600_LED_PWR_GPIO,
61 - .name = "wlan",
62 - .start = DSMG600_LED_WLAN_GPIO,
63 - .end = DSMG600_LED_WLAN_GPIO,
64 - .flags = IXP4XX_GPIO_LOW,
65 + .name = "wlan",
66 + .gpio = DSMG600_LED_WLAN_GPIO,
67 + .active_low = true,
71 +static struct gpio_led_platform_data dsmg600_led_data = {
72 + .num_leds = ARRAY_SIZE(dsmg600_led_pins),
73 + .leds = dsmg600_led_pins,
74 +};
76 static struct platform_device dsmg600_leds = {
77 - .name = "IXP4XX-GPIO-LED",
78 - .id = -1,
79 - .num_resources = ARRAY_SIZE(dsmg600_led_resources),
80 - .resource = dsmg600_led_resources,
81 + .name = "leds-gpio",
82 + .id = -1,
83 + .dev.platform_data = &dsmg600_led_data,
85 -#endif
87 static struct resource dsmg600_uart_resources[] = {
89 @@ -118,6 +118,7 @@ static struct platform_device dsmg600_uart = {
90 static struct platform_device *dsmg600_devices[] __initdata = {
91 &dsmg600_i2c_controller,
92 &dsmg600_flash,
93 + &dsmg600_leds,
96 static void dsmg600_power_off(void)
97 @@ -162,11 +163,6 @@ static void __init dsmg600_init(void)
98 (void)platform_device_register(&dsmg600_uart);
100 platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
102 -#ifdef CONFIG_LEDS_CLASS
103 - /* We don't care whether or not this works. */
104 - (void)platform_device_register(&dsmg600_leds);
105 -#endif
108 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
109 diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
110 index ea334f3..68e18cb 100644
111 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c
112 +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
113 @@ -38,35 +38,34 @@ static struct platform_device nas100d_flash = {
114 .resource = &nas100d_flash_resource,
117 -#ifdef CONFIG_LEDS_IXP4XX
118 -static struct resource nas100d_led_resources[] = {
119 +static struct gpio_led nas100d_led_pins[] = {
121 .name = "wlan", /* green led */
122 - .start = NAS100D_LED_WLAN_GPIO,
123 - .end = NAS100D_LED_WLAN_GPIO,
124 - .flags = IXP4XX_GPIO_LOW,
125 + .gpio = NAS100D_LED_WLAN_GPIO,
126 + .active_low = true,
129 .name = "power", /* blue power led (off=flashing) */
130 - .start = NAS100D_LED_PWR_GPIO,
131 - .end = NAS100D_LED_PWR_GPIO,
132 - .flags = IXP4XX_GPIO_LOW,
133 + .gpio = NAS100D_LED_PWR_GPIO,
134 + .active_low = true,
137 .name = "disk", /* yellow led */
138 - .start = NAS100D_LED_DISK_GPIO,
139 - .end = NAS100D_LED_DISK_GPIO,
140 - .flags = IXP4XX_GPIO_LOW,
141 + .gpio = NAS100D_LED_DISK_GPIO,
142 + .active_low = true,
146 +static struct gpio_led_platform_data nas100d_led_data = {
147 + .num_leds = ARRAY_SIZE(nas100d_led_pins),
148 + .leds = nas100d_led_pins,
151 static struct platform_device nas100d_leds = {
152 - .name = "IXP4XX-GPIO-LED",
153 + .name = "leds-gpio",
154 .id = -1,
155 - .num_resources = ARRAY_SIZE(nas100d_led_resources),
156 - .resource = nas100d_led_resources,
157 + .dev.platform_data = &nas100d_led_data,
159 -#endif
161 static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = {
162 .sda_pin = NAS100D_SDA_PIN,
163 @@ -126,9 +125,7 @@ static struct platform_device nas100d_uart = {
164 static struct platform_device *nas100d_devices[] __initdata = {
165 &nas100d_i2c_controller,
166 &nas100d_flash,
167 -#ifdef CONFIG_LEDS_IXP4XX
168 &nas100d_leds,
169 -#endif
172 static void nas100d_power_off(void)
173 diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
174 index 9bf8ccb..6a39862 100644
175 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c
176 +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
177 @@ -46,41 +46,37 @@ static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = {
178 .scl_pin = NSLU2_SCL_PIN,
181 -#ifdef CONFIG_LEDS_IXP4XX
182 -static struct resource nslu2_led_resources[] = {
183 +static struct gpio_led nslu2_led_pins[] = {
185 .name = "ready", /* green led */
186 - .start = NSLU2_LED_GRN_GPIO,
187 - .end = NSLU2_LED_GRN_GPIO,
188 - .flags = IXP4XX_GPIO_HIGH,
189 + .gpio = NSLU2_LED_GRN_GPIO,
192 .name = "status", /* red led */
193 - .start = NSLU2_LED_RED_GPIO,
194 - .end = NSLU2_LED_RED_GPIO,
195 - .flags = IXP4XX_GPIO_HIGH,
196 + .gpio = NSLU2_LED_RED_GPIO,
199 .name = "disk-1",
200 - .start = NSLU2_LED_DISK1_GPIO,
201 - .end = NSLU2_LED_DISK1_GPIO,
202 - .flags = IXP4XX_GPIO_LOW,
203 + .gpio = NSLU2_LED_DISK1_GPIO,
204 + .active_low = true,
207 .name = "disk-2",
208 - .start = NSLU2_LED_DISK2_GPIO,
209 - .end = NSLU2_LED_DISK2_GPIO,
210 - .flags = IXP4XX_GPIO_LOW,
211 + .gpio = NSLU2_LED_DISK2_GPIO,
212 + .active_low = true,
216 +static struct gpio_led_platform_data nslu2_led_data = {
217 + .num_leds = ARRAY_SIZE(nslu2_led_pins),
218 + .leds = nslu2_led_pins,
221 static struct platform_device nslu2_leds = {
222 - .name = "IXP4XX-GPIO-LED",
223 + .name = "leds-gpio",
224 .id = -1,
225 - .num_resources = ARRAY_SIZE(nslu2_led_resources),
226 - .resource = nslu2_led_resources,
227 + .dev.platform_data = &nslu2_led_data,
229 -#endif
231 static struct platform_device nslu2_i2c_controller = {
232 .name = "IXP4XX-I2C",
233 @@ -142,9 +138,7 @@ static struct platform_device *nslu2_devices[] __initdata = {
234 &nslu2_i2c_controller,
235 &nslu2_flash,
236 &nslu2_beeper,
237 -#ifdef CONFIG_LEDS_IXP4XX
238 &nslu2_leds,
239 -#endif
242 static void nslu2_power_off(void)
244 1.5.2.5