diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-08-13 10:45:48 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-08-13 10:45:48 -0400 |
commit | 19e4ab54e7f5fe46a3c931afa7e786f11d57b558 (patch) | |
tree | aeada0b9d0800b94cb795020a856c625ddc4f41c /arch/arm/mach-at91 | |
parent | 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (diff) | |
parent | fa8bbb13ab49e77c00fa09e5504ec25b7176fb4b (diff) |
Merge branch 'for-arm-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds into next/drivers
From Bryan Wu <bryan.wu@canonical.com>:
Based on Linus Walleij's ARM LED consolidation work, this patchset introduce a
new generic led trigger for CPU not only for ARM but also for others.
For enabling CPU idle event, CPU arch code should call ledtrig_cpu() stub to
trigger idle start or idle end event.
These patches convert old style LED driver in arch/arm to gpio_led or new led
driver interface. Against 3.5 release and build successfully for all the machines.
Test ledtrig-cpu driver on OMAP4 Panda board.
v9 --> v10
* fix compiling issue on versatile_defconfig reported by Russell King
* rebase to 3.5 kernel and move patches to new git tree
v8 --> v9:
* use mutex to replace rw_sema pointed out by Tim Gardner
* add a new struct led_trigger_cpu
* add lock_is_inited to record mutex lock initialization
v6 --> v7:
* add a patch to unify the led-trigger name
* fix some typo pointed
* use BUG_ON to detect CPU numbers during building stage
v5 --> v6:
* replace __get_cpu_var() to per_cpu()
* remove smp_processor_id() which is wrong with for_each_possible_cpu()
* test on real OMAP4 Panda board
* add comments about CPU hotplug in the CPU LED trigger driver
v4 --> v5:
* rebase all the patches on top of latest linux-next
* replace on_each_cpu() with for_each_possible_cpu()
* add some description of ledtrig_cpu() API
* remove old leds code from driver nwflash.c, which should use a new led trigger then
* this trigger driver can be built as module now
v3 --> v4:
* fix a typo pointed by Jochen Friedrich
* fix some building errors
* add Reviewed-by and Tested-by into patch log
v2 --> v3:
* almost rewrote the whole ledtrig-cpu driver, which is more simple
* every CPU will have a per-CPU trigger
* cpu trigger can be assigned to any leds
* fix a lockdep issue in led-trigger common code
* other fix according to review
v1 --> v2:
* remove select operations in Kconfig of every machines
* add back supporting of led in core module of mach-integrator
* solidate name scheme in ledtrig-cpu.c
* add comments of CPU_LED_* cpu led events
* fold patches of RealView and Versatile together
* add machine_is_ check during assabet led driver init
* add some Acked-by in patch logs
* remove code for simpad machine in machine-sa11000, since Jochen Friedrich
introduced gpiolib and gpio-led driver for simpad
* on Assabet and Netwinder machine, LED operations is reversed like:
setting bit means turn off leds
clearing bit means turn on leds
* add a new function to read CM_CTRL register for led driver
* 'for-arm-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds:
ARM: use new LEDS CPU trigger stub to replace old one
ARM: mach-sa1100: retire custom LED code
ARM: mach-omap1: retire custom LED code
ARM: mach-pnx4008: remove including old leds event API header file
ARM: plat-samsung: remove including old leds event API header file
ARM: mach-pxa: retire custom LED code
char: nwflash: remove old led event code
ARM: mach-footbridge: retire custom LED code
ARM: mach-ebsa110: retire custom LED code
ARM: mach-clps711x: retire custom LED code of P720T machine
ARM: mach-integrator: retire custom LED code
ARM: mach-integrator: move CM_CTRL to header file for accessing by other functions
ARM: mach-orion5x: convert custom LED code to gpio_led and LED CPU trigger
ARM: mach-shark: retire custom LED code
ARM: mach-ks8695: remove leds driver, since nobody use it
ARM: mach-realview and mach-versatile: retire custom LED code
ARM: at91: convert old leds drivers to gpio_led and led_trigger drivers
led-triggers: create a trigger for CPU activity
Conflicts:
arch/arm/mach-clps711x/p720t.c
arch/arm/mach-sa1100/leds-cerf.c
arch/arm/mach-sa1100/leds-lart.c
Let's hope this is the last time we pull this and it doesn't cause
more trouble. I have verified that version 10 causes no build
warnings or errors any more, and the patches still look good.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r-- | arch/arm/mach-at91/board-csb337.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-ecbat91.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-eco920.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-kafa.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-kb9202.c | 23 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-rm9200dk.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-rm9200ek.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-rsi-ews.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-sam9-l9260.c | 23 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-sam9261ek.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-yl-9200.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/board.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/leds.c | 105 |
13 files changed, 89 insertions, 137 deletions
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c index 462bc319cbc..32396bb4a4c 100644 --- a/arch/arm/mach-at91/board-csb337.c +++ b/arch/arm/mach-at91/board-csb337.c | |||
@@ -220,8 +220,6 @@ static struct gpio_led csb_leds[] = { | |||
220 | 220 | ||
221 | static void __init csb337_board_init(void) | 221 | static void __init csb337_board_init(void) |
222 | { | 222 | { |
223 | /* Setup the LEDs */ | ||
224 | at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1); | ||
225 | /* Serial */ | 223 | /* Serial */ |
226 | /* DBGU on ttyS0 */ | 224 | /* DBGU on ttyS0 */ |
227 | at91_register_uart(0, 0, 0); | 225 | at91_register_uart(0, 0, 0); |
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c index 9c24cb25707..192ec76579c 100644 --- a/arch/arm/mach-at91/board-ecbat91.c +++ b/arch/arm/mach-at91/board-ecbat91.c | |||
@@ -138,11 +138,20 @@ static struct spi_board_info __initdata ecb_at91spi_devices[] = { | |||
138 | }, | 138 | }, |
139 | }; | 139 | }; |
140 | 140 | ||
141 | /* | ||
142 | * LEDs | ||
143 | */ | ||
144 | static struct gpio_led ecb_leds[] = { | ||
145 | { /* D1 */ | ||
146 | .name = "led1", | ||
147 | .gpio = AT91_PIN_PC7, | ||
148 | .active_low = 1, | ||
149 | .default_trigger = "heartbeat", | ||
150 | } | ||
151 | }; | ||
152 | |||
141 | static void __init ecb_at91board_init(void) | 153 | static void __init ecb_at91board_init(void) |
142 | { | 154 | { |
143 | /* Setup the LEDs */ | ||
144 | at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7); | ||
145 | |||
146 | /* Serial */ | 155 | /* Serial */ |
147 | /* DBGU on ttyS0. (Rx & Tx only) */ | 156 | /* DBGU on ttyS0. (Rx & Tx only) */ |
148 | at91_register_uart(0, 0, 0); | 157 | at91_register_uart(0, 0, 0); |
@@ -165,6 +174,9 @@ static void __init ecb_at91board_init(void) | |||
165 | 174 | ||
166 | /* SPI */ | 175 | /* SPI */ |
167 | at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices)); | 176 | at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices)); |
177 | |||
178 | /* LEDs */ | ||
179 | at91_gpio_leds(ecb_leds, ARRAY_SIZE(ecb_leds)); | ||
168 | } | 180 | } |
169 | 181 | ||
170 | MACHINE_START(ECBAT91, "emQbit's ECB_AT91") | 182 | MACHINE_START(ECBAT91, "emQbit's ECB_AT91") |
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c index 82bdfde3405..d2d4580df48 100644 --- a/arch/arm/mach-at91/board-eco920.c +++ b/arch/arm/mach-at91/board-eco920.c | |||
@@ -93,10 +93,26 @@ static struct spi_board_info eco920_spi_devices[] = { | |||
93 | }, | 93 | }, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | /* | ||
97 | * LEDs | ||
98 | */ | ||
99 | static struct gpio_led eco920_leds[] = { | ||
100 | { /* D1 */ | ||
101 | .name = "led1", | ||
102 | .gpio = AT91_PIN_PB0, | ||
103 | .active_low = 1, | ||
104 | .default_trigger = "heartbeat", | ||
105 | }, | ||
106 | { /* D2 */ | ||
107 | .name = "led2", | ||
108 | .gpio = AT91_PIN_PB1, | ||
109 | .active_low = 1, | ||
110 | .default_trigger = "timer", | ||
111 | } | ||
112 | }; | ||
113 | |||
96 | static void __init eco920_board_init(void) | 114 | static void __init eco920_board_init(void) |
97 | { | 115 | { |
98 | /* Setup the LEDs */ | ||
99 | at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1); | ||
100 | /* DBGU on ttyS0. (Rx & Tx only */ | 116 | /* DBGU on ttyS0. (Rx & Tx only */ |
101 | at91_register_uart(0, 0, 0); | 117 | at91_register_uart(0, 0, 0); |
102 | at91_add_device_serial(); | 118 | at91_add_device_serial(); |
@@ -127,6 +143,8 @@ static void __init eco920_board_init(void) | |||
127 | ); | 143 | ); |
128 | 144 | ||
129 | at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices)); | 145 | at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices)); |
146 | /* LEDs */ | ||
147 | at91_gpio_leds(eco920_leds, ARRAY_SIZE(eco920_leds)); | ||
130 | } | 148 | } |
131 | 149 | ||
132 | MACHINE_START(ECO920, "eco920") | 150 | MACHINE_START(ECO920, "eco920") |
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c index 64c1dbf88a0..86050da3ba5 100644 --- a/arch/arm/mach-at91/board-kafa.c +++ b/arch/arm/mach-at91/board-kafa.c | |||
@@ -66,11 +66,20 @@ static struct at91_udc_data __initdata kafa_udc_data = { | |||
66 | .pullup_pin = AT91_PIN_PB7, | 66 | .pullup_pin = AT91_PIN_PB7, |
67 | }; | 67 | }; |
68 | 68 | ||
69 | /* | ||
70 | * LEDs | ||
71 | */ | ||
72 | static struct gpio_led kafa_leds[] = { | ||
73 | { /* D1 */ | ||
74 | .name = "led1", | ||
75 | .gpio = AT91_PIN_PB4, | ||
76 | .active_low = 1, | ||
77 | .default_trigger = "heartbeat", | ||
78 | }, | ||
79 | }; | ||
80 | |||
69 | static void __init kafa_board_init(void) | 81 | static void __init kafa_board_init(void) |
70 | { | 82 | { |
71 | /* Set up the LEDs */ | ||
72 | at91_init_leds(AT91_PIN_PB4, AT91_PIN_PB4); | ||
73 | |||
74 | /* Serial */ | 83 | /* Serial */ |
75 | /* DBGU on ttyS0. (Rx & Tx only) */ | 84 | /* DBGU on ttyS0. (Rx & Tx only) */ |
76 | at91_register_uart(0, 0, 0); | 85 | at91_register_uart(0, 0, 0); |
@@ -88,6 +97,8 @@ static void __init kafa_board_init(void) | |||
88 | at91_add_device_i2c(NULL, 0); | 97 | at91_add_device_i2c(NULL, 0); |
89 | /* SPI */ | 98 | /* SPI */ |
90 | at91_add_device_spi(NULL, 0); | 99 | at91_add_device_spi(NULL, 0); |
100 | /* LEDs */ | ||
101 | at91_gpio_leds(kafa_leds, ARRAY_SIZE(kafa_leds)); | ||
91 | } | 102 | } |
92 | 103 | ||
93 | MACHINE_START(KAFA, "Sperry-Sun KAFA") | 104 | MACHINE_START(KAFA, "Sperry-Sun KAFA") |
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c index 5d96cb85175..00d60071770 100644 --- a/arch/arm/mach-at91/board-kb9202.c +++ b/arch/arm/mach-at91/board-kb9202.c | |||
@@ -96,11 +96,26 @@ static struct atmel_nand_data __initdata kb9202_nand_data = { | |||
96 | .num_parts = ARRAY_SIZE(kb9202_nand_partition), | 96 | .num_parts = ARRAY_SIZE(kb9202_nand_partition), |
97 | }; | 97 | }; |
98 | 98 | ||
99 | /* | ||
100 | * LEDs | ||
101 | */ | ||
102 | static struct gpio_led kb9202_leds[] = { | ||
103 | { /* D1 */ | ||
104 | .name = "led1", | ||
105 | .gpio = AT91_PIN_PC19, | ||
106 | .active_low = 1, | ||
107 | .default_trigger = "heartbeat", | ||
108 | }, | ||
109 | { /* D2 */ | ||
110 | .name = "led2", | ||
111 | .gpio = AT91_PIN_PC18, | ||
112 | .active_low = 1, | ||
113 | .default_trigger = "timer", | ||
114 | } | ||
115 | }; | ||
116 | |||
99 | static void __init kb9202_board_init(void) | 117 | static void __init kb9202_board_init(void) |
100 | { | 118 | { |
101 | /* Set up the LEDs */ | ||
102 | at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18); | ||
103 | |||
104 | /* Serial */ | 119 | /* Serial */ |
105 | /* DBGU on ttyS0. (Rx & Tx only) */ | 120 | /* DBGU on ttyS0. (Rx & Tx only) */ |
106 | at91_register_uart(0, 0, 0); | 121 | at91_register_uart(0, 0, 0); |
@@ -128,6 +143,8 @@ static void __init kb9202_board_init(void) | |||
128 | at91_add_device_spi(NULL, 0); | 143 | at91_add_device_spi(NULL, 0); |
129 | /* NAND */ | 144 | /* NAND */ |
130 | at91_add_device_nand(&kb9202_nand_data); | 145 | at91_add_device_nand(&kb9202_nand_data); |
146 | /* LEDs */ | ||
147 | at91_gpio_leds(kb9202_leds, ARRAY_SIZE(kb9202_leds)); | ||
131 | } | 148 | } |
132 | 149 | ||
133 | MACHINE_START(KB9200, "KB920x") | 150 | MACHINE_START(KB9200, "KB920x") |
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c index cc2bf979607..2526ad759b5 100644 --- a/arch/arm/mach-at91/board-rm9200dk.c +++ b/arch/arm/mach-at91/board-rm9200dk.c | |||
@@ -177,9 +177,6 @@ static struct gpio_led dk_leds[] = { | |||
177 | 177 | ||
178 | static void __init dk_board_init(void) | 178 | static void __init dk_board_init(void) |
179 | { | 179 | { |
180 | /* Setup the LEDs */ | ||
181 | at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2); | ||
182 | |||
183 | /* Serial */ | 180 | /* Serial */ |
184 | /* DBGU on ttyS0. (Rx & Tx only) */ | 181 | /* DBGU on ttyS0. (Rx & Tx only) */ |
185 | at91_register_uart(0, 0, 0); | 182 | at91_register_uart(0, 0, 0); |
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c index 62e19e64c9d..06f2ce543e2 100644 --- a/arch/arm/mach-at91/board-rm9200ek.c +++ b/arch/arm/mach-at91/board-rm9200ek.c | |||
@@ -148,9 +148,6 @@ static struct gpio_led ek_leds[] = { | |||
148 | 148 | ||
149 | static void __init ek_board_init(void) | 149 | static void __init ek_board_init(void) |
150 | { | 150 | { |
151 | /* Setup the LEDs */ | ||
152 | at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2); | ||
153 | |||
154 | /* Serial */ | 151 | /* Serial */ |
155 | /* DBGU on ttyS0. (Rx & Tx only) */ | 152 | /* DBGU on ttyS0. (Rx & Tx only) */ |
156 | at91_register_uart(0, 0, 0); | 153 | at91_register_uart(0, 0, 0); |
diff --git a/arch/arm/mach-at91/board-rsi-ews.c b/arch/arm/mach-at91/board-rsi-ews.c index c3b43aefdb7..93b8e3a45e2 100644 --- a/arch/arm/mach-at91/board-rsi-ews.c +++ b/arch/arm/mach-at91/board-rsi-ews.c | |||
@@ -185,9 +185,6 @@ static struct platform_device rsiews_nor_flash = { | |||
185 | */ | 185 | */ |
186 | static void __init rsi_ews_board_init(void) | 186 | static void __init rsi_ews_board_init(void) |
187 | { | 187 | { |
188 | /* Setup the LEDs */ | ||
189 | at91_init_leds(AT91_PIN_PB6, AT91_PIN_PB9); | ||
190 | |||
191 | /* Serial */ | 188 | /* Serial */ |
192 | /* DBGU on ttyS0. (Rx & Tx only) */ | 189 | /* DBGU on ttyS0. (Rx & Tx only) */ |
193 | /* This one is for debugging */ | 190 | /* This one is for debugging */ |
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c index 7bf6da70d7d..46e1eb55053 100644 --- a/arch/arm/mach-at91/board-sam9-l9260.c +++ b/arch/arm/mach-at91/board-sam9-l9260.c | |||
@@ -166,11 +166,26 @@ static struct at91_mmc_data __initdata ek_mmc_data = { | |||
166 | .vcc_pin = -EINVAL, | 166 | .vcc_pin = -EINVAL, |
167 | }; | 167 | }; |
168 | 168 | ||
169 | /* | ||
170 | * LEDs | ||
171 | */ | ||
172 | static struct gpio_led ek_leds[] = { | ||
173 | { /* D1 */ | ||
174 | .name = "led1", | ||
175 | .gpio = AT91_PIN_PA9, | ||
176 | .active_low = 1, | ||
177 | .default_trigger = "heartbeat", | ||
178 | }, | ||
179 | { /* D2 */ | ||
180 | .name = "led2", | ||
181 | .gpio = AT91_PIN_PA6, | ||
182 | .active_low = 1, | ||
183 | .default_trigger = "timer", | ||
184 | } | ||
185 | }; | ||
186 | |||
169 | static void __init ek_board_init(void) | 187 | static void __init ek_board_init(void) |
170 | { | 188 | { |
171 | /* Setup the LEDs */ | ||
172 | at91_init_leds(AT91_PIN_PA9, AT91_PIN_PA6); | ||
173 | |||
174 | /* Serial */ | 189 | /* Serial */ |
175 | /* DBGU on ttyS0. (Rx & Tx only) */ | 190 | /* DBGU on ttyS0. (Rx & Tx only) */ |
176 | at91_register_uart(0, 0, 0); | 191 | at91_register_uart(0, 0, 0); |
@@ -197,6 +212,8 @@ static void __init ek_board_init(void) | |||
197 | at91_add_device_mmc(0, &ek_mmc_data); | 212 | at91_add_device_mmc(0, &ek_mmc_data); |
198 | /* I2C */ | 213 | /* I2C */ |
199 | at91_add_device_i2c(NULL, 0); | 214 | at91_add_device_i2c(NULL, 0); |
215 | /* LEDs */ | ||
216 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | ||
200 | } | 217 | } |
201 | 218 | ||
202 | MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260") | 219 | MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260") |
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index 2269be5fa38..802d4946bb3 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
@@ -569,9 +569,6 @@ static struct gpio_led ek_leds[] = { | |||
569 | 569 | ||
570 | static void __init ek_board_init(void) | 570 | static void __init ek_board_init(void) |
571 | { | 571 | { |
572 | /* Setup the LEDs */ | ||
573 | at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14); | ||
574 | |||
575 | /* Serial */ | 572 | /* Serial */ |
576 | /* DBGU on ttyS0. (Rx & Tx only) */ | 573 | /* DBGU on ttyS0. (Rx & Tx only) */ |
577 | at91_register_uart(0, 0, 0); | 574 | at91_register_uart(0, 0, 0); |
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c index 516d340549d..9fd57bcac69 100644 --- a/arch/arm/mach-at91/board-yl-9200.c +++ b/arch/arm/mach-at91/board-yl-9200.c | |||
@@ -541,9 +541,6 @@ void __init yl9200_add_device_video(void) {} | |||
541 | 541 | ||
542 | static void __init yl9200_board_init(void) | 542 | static void __init yl9200_board_init(void) |
543 | { | 543 | { |
544 | /* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */ | ||
545 | at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17); | ||
546 | |||
547 | /* Serial */ | 544 | /* Serial */ |
548 | /* DBGU on ttyS0. (Rx & Tx only) */ | 545 | /* DBGU on ttyS0. (Rx & Tx only) */ |
549 | at91_register_uart(0, 0, 0); | 546 | at91_register_uart(0, 0, 0); |
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h index 369afc2ffc5..c55a4364ffb 100644 --- a/arch/arm/mach-at91/include/mach/board.h +++ b/arch/arm/mach-at91/include/mach/board.h | |||
@@ -187,7 +187,6 @@ struct at91_can_data { | |||
187 | extern void __init at91_add_device_can(struct at91_can_data *data); | 187 | extern void __init at91_add_device_can(struct at91_can_data *data); |
188 | 188 | ||
189 | /* LEDs */ | 189 | /* LEDs */ |
190 | extern void __init at91_init_leds(u8 cpu_led, u8 timer_led); | ||
191 | extern void __init at91_gpio_leds(struct gpio_led *leds, int nr); | 190 | extern void __init at91_gpio_leds(struct gpio_led *leds, int nr); |
192 | extern void __init at91_pwm_leds(struct gpio_led *leds, int nr); | 191 | extern void __init at91_pwm_leds(struct gpio_led *leds, int nr); |
193 | 192 | ||
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c index 8dfafe76ffe..1b1e62b5f41 100644 --- a/arch/arm/mach-at91/leds.c +++ b/arch/arm/mach-at91/leds.c | |||
@@ -90,108 +90,3 @@ void __init at91_pwm_leds(struct gpio_led *leds, int nr) | |||
90 | #else | 90 | #else |
91 | void __init at91_pwm_leds(struct gpio_led *leds, int nr){} | 91 | void __init at91_pwm_leds(struct gpio_led *leds, int nr){} |
92 | #endif | 92 | #endif |
93 | |||
94 | |||
95 | /* ------------------------------------------------------------------------- */ | ||
96 | |||
97 | #if defined(CONFIG_LEDS) | ||
98 | |||
99 | #include <asm/leds.h> | ||
100 | |||
101 | /* | ||
102 | * Old ARM-specific LED framework; not fully functional when generic time is | ||
103 | * in use. | ||
104 | */ | ||
105 | |||
106 | static u8 at91_leds_cpu; | ||
107 | static u8 at91_leds_timer; | ||
108 | |||
109 | static inline void at91_led_on(unsigned int led) | ||
110 | { | ||
111 | at91_set_gpio_value(led, 0); | ||
112 | } | ||
113 | |||
114 | static inline void at91_led_off(unsigned int led) | ||
115 | { | ||
116 | at91_set_gpio_value(led, 1); | ||
117 | } | ||
118 | |||
119 | static inline void at91_led_toggle(unsigned int led) | ||
120 | { | ||
121 | unsigned long is_off = at91_get_gpio_value(led); | ||
122 | if (is_off) | ||
123 | at91_led_on(led); | ||
124 | else | ||
125 | at91_led_off(led); | ||
126 | } | ||
127 | |||
128 | |||
129 | /* | ||
130 | * Handle LED events. | ||
131 | */ | ||
132 | static void at91_leds_event(led_event_t evt) | ||
133 | { | ||
134 | unsigned long flags; | ||
135 | |||
136 | local_irq_save(flags); | ||
137 | |||
138 | switch(evt) { | ||
139 | case led_start: /* System startup */ | ||
140 | at91_led_on(at91_leds_cpu); | ||
141 | break; | ||
142 | |||
143 | case led_stop: /* System stop / suspend */ | ||
144 | at91_led_off(at91_leds_cpu); | ||
145 | break; | ||
146 | |||
147 | #ifdef CONFIG_LEDS_TIMER | ||
148 | case led_timer: /* Every 50 timer ticks */ | ||
149 | at91_led_toggle(at91_leds_timer); | ||
150 | break; | ||
151 | #endif | ||
152 | |||
153 | #ifdef CONFIG_LEDS_CPU | ||
154 | case led_idle_start: /* Entering idle state */ | ||
155 | at91_led_off(at91_leds_cpu); | ||
156 | break; | ||
157 | |||
158 | case led_idle_end: /* Exit idle state */ | ||
159 | at91_led_on(at91_leds_cpu); | ||
160 | break; | ||
161 | #endif | ||
162 | |||
163 | default: | ||
164 | break; | ||
165 | } | ||
166 | |||
167 | local_irq_restore(flags); | ||
168 | } | ||
169 | |||
170 | |||
171 | static int __init leds_init(void) | ||
172 | { | ||
173 | if (!at91_leds_timer || !at91_leds_cpu) | ||
174 | return -ENODEV; | ||
175 | |||
176 | leds_event = at91_leds_event; | ||
177 | |||
178 | leds_event(led_start); | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | __initcall(leds_init); | ||
183 | |||
184 | |||
185 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | ||
186 | { | ||
187 | /* Enable GPIO to access the LEDs */ | ||
188 | at91_set_gpio_output(cpu_led, 1); | ||
189 | at91_set_gpio_output(timer_led, 1); | ||
190 | |||
191 | at91_leds_cpu = cpu_led; | ||
192 | at91_leds_timer = timer_led; | ||
193 | } | ||
194 | |||
195 | #else | ||
196 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | ||
197 | #endif | ||