1 From 383256474f2ba043bdb57a657f9d786df88780f1 Mon Sep 17 00:00:00 2001
2 From: Rod Whitby <rod@whitby.id.au>
3 Date: Tue, 29 Jan 2008 17:17:29 +1030
4 Subject: 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
10 Signed-off-by: Rod Whitby <rod@whitby.id.au>
13 KernelVersion: v2.6.24-1915-gc9b12e6
15 Index: linux-2.6.24.7/arch/arm/configs/ixp4xx_defconfig
16 ===================================================================
17 --- linux-2.6.24.7.orig/arch/arm/configs/ixp4xx_defconfig
18 +++ linux-2.6.24.7/arch/arm/configs/ixp4xx_defconfig
19 @@ -1330,8 +1330,8 @@ CONFIG_LEDS_CLASS=y
24 -# CONFIG_LEDS_GPIO is not set
25 +# CONFIG_LEDS_IXP4XX is not set
30 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-setup.c
31 ===================================================================
32 --- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/dsmg600-setup.c
33 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/dsmg600-setup.c
35 #include <linux/kernel.h>
36 #include <linux/serial.h>
37 #include <linux/serial_8250.h>
38 +#include <linux/leds.h>
39 #include <linux/i2c.h>
40 #include <linux/i2c-gpio.h>
42 @@ -58,29 +59,28 @@ static struct i2c_board_info __initdata
46 -#ifdef CONFIG_LEDS_CLASS
47 -static struct resource dsmg600_led_resources[] = {
48 +static struct gpio_led dsmg600_led_pins[] = {
51 - .start = DSMG600_LED_PWR_GPIO,
52 - .end = DSMG600_LED_PWR_GPIO,
53 - .flags = IXP4XX_GPIO_HIGH,
55 + .gpio = DSMG600_LED_PWR_GPIO,
59 - .start = DSMG600_LED_WLAN_GPIO,
60 - .end = DSMG600_LED_WLAN_GPIO,
61 - .flags = IXP4XX_GPIO_LOW,
63 + .gpio = DSMG600_LED_WLAN_GPIO,
68 +static struct gpio_led_platform_data dsmg600_led_data = {
69 + .num_leds = ARRAY_SIZE(dsmg600_led_pins),
70 + .leds = dsmg600_led_pins,
73 static struct platform_device dsmg600_leds = {
74 - .name = "IXP4XX-GPIO-LED",
76 - .num_resources = ARRAY_SIZE(dsmg600_led_resources),
77 - .resource = dsmg600_led_resources,
78 + .name = "leds-gpio",
80 + .dev.platform_data = &dsmg600_led_data,
84 static struct resource dsmg600_uart_resources[] = {
86 @@ -128,6 +128,7 @@ static struct platform_device dsmg600_ua
87 static struct platform_device *dsmg600_devices[] __initdata = {
93 static void dsmg600_power_off(void)
94 @@ -175,11 +176,6 @@ static void __init dsmg600_init(void)
95 (void)platform_device_register(&dsmg600_uart);
97 platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
99 -#ifdef CONFIG_LEDS_CLASS
100 - /* We don't care whether or not this works. */
101 - (void)platform_device_register(&dsmg600_leds);
105 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
106 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c
107 ===================================================================
108 --- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c
109 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c
110 @@ -46,35 +46,34 @@ static struct i2c_board_info __initdata
114 -#ifdef CONFIG_LEDS_IXP4XX
115 -static struct resource nas100d_led_resources[] = {
116 +static struct gpio_led nas100d_led_pins[] = {
118 .name = "wlan", /* green led */
119 - .start = NAS100D_LED_WLAN_GPIO,
120 - .end = NAS100D_LED_WLAN_GPIO,
121 - .flags = IXP4XX_GPIO_LOW,
122 + .gpio = NAS100D_LED_WLAN_GPIO,
123 + .active_low = true,
126 .name = "power", /* blue power led (off=flashing) */
127 - .start = NAS100D_LED_PWR_GPIO,
128 - .end = NAS100D_LED_PWR_GPIO,
129 - .flags = IXP4XX_GPIO_LOW,
130 + .gpio = NAS100D_LED_PWR_GPIO,
131 + .active_low = true,
134 .name = "disk", /* yellow led */
135 - .start = NAS100D_LED_DISK_GPIO,
136 - .end = NAS100D_LED_DISK_GPIO,
137 - .flags = IXP4XX_GPIO_LOW,
138 + .gpio = NAS100D_LED_DISK_GPIO,
139 + .active_low = true,
143 +static struct gpio_led_platform_data nas100d_led_data = {
144 + .num_leds = ARRAY_SIZE(nas100d_led_pins),
145 + .leds = nas100d_led_pins,
148 static struct platform_device nas100d_leds = {
149 - .name = "IXP4XX-GPIO-LED",
150 + .name = "leds-gpio",
152 - .num_resources = ARRAY_SIZE(nas100d_led_resources),
153 - .resource = nas100d_led_resources,
154 + .dev.platform_data = &nas100d_led_data,
158 static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = {
159 .sda_pin = NAS100D_SDA_PIN,
160 @@ -135,9 +134,7 @@ static struct platform_device nas100d_ua
161 static struct platform_device *nas100d_devices[] __initdata = {
164 -#ifdef CONFIG_LEDS_IXP4XX
169 static void nas100d_power_off(void)
170 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c
171 ===================================================================
172 --- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c
173 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c
174 @@ -54,41 +54,37 @@ static struct i2c_board_info __initdata
178 -#ifdef CONFIG_LEDS_IXP4XX
179 -static struct resource nslu2_led_resources[] = {
180 +static struct gpio_led nslu2_led_pins[] = {
182 .name = "ready", /* green led */
183 - .start = NSLU2_LED_GRN_GPIO,
184 - .end = NSLU2_LED_GRN_GPIO,
185 - .flags = IXP4XX_GPIO_HIGH,
186 + .gpio = NSLU2_LED_GRN_GPIO,
189 .name = "status", /* red led */
190 - .start = NSLU2_LED_RED_GPIO,
191 - .end = NSLU2_LED_RED_GPIO,
192 - .flags = IXP4XX_GPIO_HIGH,
193 + .gpio = NSLU2_LED_RED_GPIO,
197 - .start = NSLU2_LED_DISK1_GPIO,
198 - .end = NSLU2_LED_DISK1_GPIO,
199 - .flags = IXP4XX_GPIO_LOW,
200 + .gpio = NSLU2_LED_DISK1_GPIO,
201 + .active_low = true,
205 - .start = NSLU2_LED_DISK2_GPIO,
206 - .end = NSLU2_LED_DISK2_GPIO,
207 - .flags = IXP4XX_GPIO_LOW,
208 + .gpio = NSLU2_LED_DISK2_GPIO,
209 + .active_low = true,
213 +static struct gpio_led_platform_data nslu2_led_data = {
214 + .num_leds = ARRAY_SIZE(nslu2_led_pins),
215 + .leds = nslu2_led_pins,
218 static struct platform_device nslu2_leds = {
219 - .name = "IXP4XX-GPIO-LED",
220 + .name = "leds-gpio",
222 - .num_resources = ARRAY_SIZE(nslu2_led_resources),
223 - .resource = nslu2_led_resources,
224 + .dev.platform_data = &nslu2_led_data,
228 static struct platform_device nslu2_i2c_gpio = {
230 @@ -151,9 +147,7 @@ static struct platform_device *nslu2_dev
234 -#ifdef CONFIG_LEDS_IXP4XX
239 static void nslu2_power_off(void)