diff options
author | Andrew Victor <linux@maxim.org.za> | 2008-01-23 03:27:06 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-26 10:00:32 -0500 |
commit | a04ff1af9723607f5901b79c559357e37cee6823 (patch) | |
tree | d0937006f8f80916f3a78236523953222a9a312e | |
parent | c8f385a631ef1f49d67a3798ca40dec36ccdf07d (diff) |
[ARM] 4758/1: [AT91] LEDs
Move the LED initialization code out of the various *_devices.c files,
and into leds.c.
Also add support for NEW_LEDs.
Patch from David Brownell.
Signed-off-by: Andrew Victor <linux@maxim.org.za>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-at91/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91rm9200_devices.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9261_devices.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9rl_devices.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-at91/leds.c | 68 | ||||
-rw-r--r-- | include/asm-arm/arch-at91/board.h | 4 |
8 files changed, 70 insertions, 114 deletions
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index a8a009c2cf7..529ffb5f3f1 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile | |||
@@ -45,7 +45,7 @@ obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o | |||
45 | obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o | 45 | obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o |
46 | 46 | ||
47 | # Drivers | 47 | # Drivers |
48 | obj-$(CONFIG_LEDS) += leds.o | 48 | obj-y += leds.o |
49 | 49 | ||
50 | # Power Management | 50 | # Power Management |
51 | obj-$(CONFIG_PM) += pm.o | 51 | obj-$(CONFIG_PM) += pm.o |
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index 23966229ea9..ea9a952fb87 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c | |||
@@ -614,28 +614,6 @@ static void __init at91_add_device_watchdog(void) {} | |||
614 | 614 | ||
615 | 615 | ||
616 | /* -------------------------------------------------------------------- | 616 | /* -------------------------------------------------------------------- |
617 | * LEDs | ||
618 | * -------------------------------------------------------------------- */ | ||
619 | |||
620 | #if defined(CONFIG_LEDS) | ||
621 | u8 at91_leds_cpu; | ||
622 | u8 at91_leds_timer; | ||
623 | |||
624 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | ||
625 | { | ||
626 | /* Enable GPIO to access the LEDs */ | ||
627 | at91_set_gpio_output(cpu_led, 1); | ||
628 | at91_set_gpio_output(timer_led, 1); | ||
629 | |||
630 | at91_leds_cpu = cpu_led; | ||
631 | at91_leds_timer = timer_led; | ||
632 | } | ||
633 | #else | ||
634 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | ||
635 | #endif | ||
636 | |||
637 | |||
638 | /* -------------------------------------------------------------------- | ||
639 | * SSC -- Synchronous Serial Controller | 617 | * SSC -- Synchronous Serial Controller |
640 | * -------------------------------------------------------------------- */ | 618 | * -------------------------------------------------------------------- */ |
641 | 619 | ||
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 5dd06bdccb0..105f8403860 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -585,28 +585,6 @@ static void __init at91_add_device_watchdog(void) {} | |||
585 | 585 | ||
586 | 586 | ||
587 | /* -------------------------------------------------------------------- | 587 | /* -------------------------------------------------------------------- |
588 | * LEDs | ||
589 | * -------------------------------------------------------------------- */ | ||
590 | |||
591 | #if defined(CONFIG_LEDS) | ||
592 | u8 at91_leds_cpu; | ||
593 | u8 at91_leds_timer; | ||
594 | |||
595 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | ||
596 | { | ||
597 | /* Enable GPIO to access the LEDs */ | ||
598 | at91_set_gpio_output(cpu_led, 1); | ||
599 | at91_set_gpio_output(timer_led, 1); | ||
600 | |||
601 | at91_leds_cpu = cpu_led; | ||
602 | at91_leds_timer = timer_led; | ||
603 | } | ||
604 | #else | ||
605 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | ||
606 | #endif | ||
607 | |||
608 | |||
609 | /* -------------------------------------------------------------------- | ||
610 | * SSC -- Synchronous Serial Controller | 588 | * SSC -- Synchronous Serial Controller |
611 | * -------------------------------------------------------------------- */ | 589 | * -------------------------------------------------------------------- */ |
612 | 590 | ||
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index 467a6431d71..57d7e3bd05d 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -597,28 +597,6 @@ static void __init at91_add_device_watchdog(void) {} | |||
597 | 597 | ||
598 | 598 | ||
599 | /* -------------------------------------------------------------------- | 599 | /* -------------------------------------------------------------------- |
600 | * LEDs | ||
601 | * -------------------------------------------------------------------- */ | ||
602 | |||
603 | #if defined(CONFIG_LEDS) | ||
604 | u8 at91_leds_cpu; | ||
605 | u8 at91_leds_timer; | ||
606 | |||
607 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | ||
608 | { | ||
609 | /* Enable GPIO to access the LEDs */ | ||
610 | at91_set_gpio_output(cpu_led, 1); | ||
611 | at91_set_gpio_output(timer_led, 1); | ||
612 | |||
613 | at91_leds_cpu = cpu_led; | ||
614 | at91_leds_timer = timer_led; | ||
615 | } | ||
616 | #else | ||
617 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | ||
618 | #endif | ||
619 | |||
620 | |||
621 | /* -------------------------------------------------------------------- | ||
622 | * SSC -- Synchronous Serial Controller | 600 | * SSC -- Synchronous Serial Controller |
623 | * -------------------------------------------------------------------- */ | 601 | * -------------------------------------------------------------------- */ |
624 | 602 | ||
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index a9f35d0c1cb..0b12e1adcc8 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -844,28 +844,6 @@ static void __init at91_add_device_watchdog(void) {} | |||
844 | 844 | ||
845 | 845 | ||
846 | /* -------------------------------------------------------------------- | 846 | /* -------------------------------------------------------------------- |
847 | * LEDs | ||
848 | * -------------------------------------------------------------------- */ | ||
849 | |||
850 | #if defined(CONFIG_LEDS) | ||
851 | u8 at91_leds_cpu; | ||
852 | u8 at91_leds_timer; | ||
853 | |||
854 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | ||
855 | { | ||
856 | /* Enable GPIO to access the LEDs */ | ||
857 | at91_set_gpio_output(cpu_led, 1); | ||
858 | at91_set_gpio_output(timer_led, 1); | ||
859 | |||
860 | at91_leds_cpu = cpu_led; | ||
861 | at91_leds_timer = timer_led; | ||
862 | } | ||
863 | #else | ||
864 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | ||
865 | #endif | ||
866 | |||
867 | |||
868 | /* -------------------------------------------------------------------- | ||
869 | * SSC -- Synchronous Serial Controller | 847 | * SSC -- Synchronous Serial Controller |
870 | * -------------------------------------------------------------------- */ | 848 | * -------------------------------------------------------------------- */ |
871 | 849 | ||
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index a942b9e3556..f43b5c33e45 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -450,28 +450,6 @@ static void __init at91_add_device_watchdog(void) {} | |||
450 | 450 | ||
451 | 451 | ||
452 | /* -------------------------------------------------------------------- | 452 | /* -------------------------------------------------------------------- |
453 | * LEDs | ||
454 | * -------------------------------------------------------------------- */ | ||
455 | |||
456 | #if defined(CONFIG_LEDS) | ||
457 | u8 at91_leds_cpu; | ||
458 | u8 at91_leds_timer; | ||
459 | |||
460 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | ||
461 | { | ||
462 | /* Enable GPIO to access the LEDs */ | ||
463 | at91_set_gpio_output(cpu_led, 1); | ||
464 | at91_set_gpio_output(timer_led, 1); | ||
465 | |||
466 | at91_leds_cpu = cpu_led; | ||
467 | at91_leds_timer = timer_led; | ||
468 | } | ||
469 | #else | ||
470 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | ||
471 | #endif | ||
472 | |||
473 | |||
474 | /* -------------------------------------------------------------------- | ||
475 | * SSC -- Synchronous Serial Controller | 453 | * SSC -- Synchronous Serial Controller |
476 | * -------------------------------------------------------------------- */ | 454 | * -------------------------------------------------------------------- */ |
477 | 455 | ||
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c index 0d514497398..9cdcda500fe 100644 --- a/arch/arm/mach-at91/leds.c +++ b/arch/arm/mach-at91/leds.c | |||
@@ -14,11 +14,62 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | 15 | ||
16 | #include <asm/mach-types.h> | 16 | #include <asm/mach-types.h> |
17 | #include <asm/leds.h> | ||
18 | #include <asm/arch/board.h> | 17 | #include <asm/arch/board.h> |
19 | #include <asm/arch/gpio.h> | 18 | #include <asm/arch/gpio.h> |
20 | 19 | ||
21 | 20 | ||
21 | /* ------------------------------------------------------------------------- */ | ||
22 | |||
23 | #if defined(CONFIG_NEW_LEDS) | ||
24 | |||
25 | #include <linux/platform_device.h> | ||
26 | |||
27 | /* | ||
28 | * New cross-platform LED support. | ||
29 | */ | ||
30 | |||
31 | static struct gpio_led_platform_data led_data; | ||
32 | |||
33 | static struct platform_device at91_leds = { | ||
34 | .name = "leds-gpio", | ||
35 | .id = -1, | ||
36 | .dev.platform_data = &led_data, | ||
37 | }; | ||
38 | |||
39 | void __init at91_gpio_leds(struct gpio_led *leds, int nr) | ||
40 | { | ||
41 | int i; | ||
42 | |||
43 | if (!nr) | ||
44 | return; | ||
45 | |||
46 | for (i = 0; i < nr; i++) | ||
47 | at91_set_gpio_output(leds[i].gpio, leds[i].active_low); | ||
48 | |||
49 | led_data.leds = leds; | ||
50 | led_data.num_leds = nr; | ||
51 | platform_device_register(&at91_leds); | ||
52 | } | ||
53 | |||
54 | #else | ||
55 | void __init at91_gpio_leds(struct gpio_led *leds, int nr) {} | ||
56 | #endif | ||
57 | |||
58 | |||
59 | /* ------------------------------------------------------------------------- */ | ||
60 | |||
61 | #if defined(CONFIG_LEDS) | ||
62 | |||
63 | #include <asm/leds.h> | ||
64 | |||
65 | /* | ||
66 | * Old ARM-specific LED framework; not fully functional when generic time is | ||
67 | * in use. | ||
68 | */ | ||
69 | |||
70 | static u8 at91_leds_cpu; | ||
71 | static u8 at91_leds_timer; | ||
72 | |||
22 | static inline void at91_led_on(unsigned int led) | 73 | static inline void at91_led_on(unsigned int led) |
23 | { | 74 | { |
24 | at91_set_gpio_value(led, 0); | 75 | at91_set_gpio_value(led, 0); |
@@ -93,3 +144,18 @@ static int __init leds_init(void) | |||
93 | } | 144 | } |
94 | 145 | ||
95 | __initcall(leds_init); | 146 | __initcall(leds_init); |
147 | |||
148 | |||
149 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | ||
150 | { | ||
151 | /* Enable GPIO to access the LEDs */ | ||
152 | at91_set_gpio_output(cpu_led, 1); | ||
153 | at91_set_gpio_output(timer_led, 1); | ||
154 | |||
155 | at91_leds_cpu = cpu_led; | ||
156 | at91_leds_timer = timer_led; | ||
157 | } | ||
158 | |||
159 | #else | ||
160 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | ||
161 | #endif | ||
diff --git a/include/asm-arm/arch-at91/board.h b/include/asm-arm/arch-at91/board.h index 3f41ab28b37..e88ad8621c1 100644 --- a/include/asm-arm/arch-at91/board.h +++ b/include/asm-arm/arch-at91/board.h | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/mtd/partitions.h> | 34 | #include <linux/mtd/partitions.h> |
35 | #include <linux/device.h> | 35 | #include <linux/device.h> |
36 | #include <linux/i2c.h> | 36 | #include <linux/i2c.h> |
37 | #include <linux/leds.h> | ||
37 | #include <linux/spi/spi.h> | 38 | #include <linux/spi/spi.h> |
38 | 39 | ||
39 | /* USB Device */ | 40 | /* USB Device */ |
@@ -157,9 +158,8 @@ extern void __init at91_add_device_ac97(struct atmel_ac97_data *data); | |||
157 | extern void __init at91_add_device_isi(void); | 158 | extern void __init at91_add_device_isi(void); |
158 | 159 | ||
159 | /* LEDs */ | 160 | /* LEDs */ |
160 | extern u8 at91_leds_cpu; | ||
161 | extern u8 at91_leds_timer; | ||
162 | extern void __init at91_init_leds(u8 cpu_led, u8 timer_led); | 161 | extern void __init at91_init_leds(u8 cpu_led, u8 timer_led); |
162 | extern void __init at91_gpio_leds(struct gpio_led *leds, int nr); | ||
163 | 163 | ||
164 | /* FIXME: this needs a better location, but gets stuff building again */ | 164 | /* FIXME: this needs a better location, but gets stuff building again */ |
165 | extern int at91_suspend_entering_slow_clock(void); | 165 | extern int at91_suspend_entering_slow_clock(void); |