diff options
author | Andrew Victor <linux@maxim.org.za> | 2008-09-21 16:31:16 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-09-21 17:58:38 -0400 |
commit | a7307bf22557e1e029df0ea6f2a2973de4d9c135 (patch) | |
tree | c1db7709cc089b3494ed6a0e97ca0dd5dbeece88 /arch/arm/mach-at91/leds.c | |
parent | bb1ad68b96a68e577a87ad62fe1aa26d052a52b5 (diff) |
[ARM] 5259/2: [AT91] PWM LEDs on AT91SAM9263-EK
Use the PWM controller and leds-atmel-pwm.c driver to drive a LED on
the Atmel AT91SAM9263-EK board.
Signed-off-by: Sedji Gaouaou <sedji.gaouaou@atmel.com>
Signed-off-by: Andrew Victor <linux@maxim.org.za>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-at91/leds.c')
-rw-r--r-- | arch/arm/mach-at91/leds.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c index fec03c59ff94..ff76d59392cc 100644 --- a/arch/arm/mach-at91/leds.c +++ b/arch/arm/mach-at91/leds.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/platform_device.h> | ||
15 | 16 | ||
16 | #include <mach/board.h> | 17 | #include <mach/board.h> |
17 | #include <mach/gpio.h> | 18 | #include <mach/gpio.h> |
@@ -21,8 +22,6 @@ | |||
21 | 22 | ||
22 | #if defined(CONFIG_NEW_LEDS) | 23 | #if defined(CONFIG_NEW_LEDS) |
23 | 24 | ||
24 | #include <linux/platform_device.h> | ||
25 | |||
26 | /* | 25 | /* |
27 | * New cross-platform LED support. | 26 | * New cross-platform LED support. |
28 | */ | 27 | */ |
@@ -57,6 +56,44 @@ void __init at91_gpio_leds(struct gpio_led *leds, int nr) {} | |||
57 | 56 | ||
58 | /* ------------------------------------------------------------------------- */ | 57 | /* ------------------------------------------------------------------------- */ |
59 | 58 | ||
59 | #if defined (CONFIG_LEDS_ATMEL_PWM) | ||
60 | |||
61 | /* | ||
62 | * PWM Leds | ||
63 | */ | ||
64 | |||
65 | static struct gpio_led_platform_data pwm_led_data; | ||
66 | |||
67 | static struct platform_device at91_pwm_leds = { | ||
68 | .name = "leds-atmel-pwm", | ||
69 | .id = -1, | ||
70 | .dev.platform_data = &pwm_led_data, | ||
71 | }; | ||
72 | |||
73 | void __init at91_pwm_leds(struct gpio_led *leds, int nr) | ||
74 | { | ||
75 | int i; | ||
76 | u32 pwm_mask = 0; | ||
77 | |||
78 | if (!nr) | ||
79 | return; | ||
80 | |||
81 | for (i = 0; i < nr; i++) | ||
82 | pwm_mask |= (1 << leds[i].gpio); | ||
83 | |||
84 | pwm_led_data.leds = leds; | ||
85 | pwm_led_data.num_leds = nr; | ||
86 | |||
87 | at91_add_device_pwm(pwm_mask); | ||
88 | platform_device_register(&at91_pwm_leds); | ||
89 | } | ||
90 | #else | ||
91 | void __init at91_pwm_leds(struct gpio_led *leds, int nr){} | ||
92 | #endif | ||
93 | |||
94 | |||
95 | /* ------------------------------------------------------------------------- */ | ||
96 | |||
60 | #if defined(CONFIG_LEDS) | 97 | #if defined(CONFIG_LEDS) |
61 | 98 | ||
62 | #include <asm/leds.h> | 99 | #include <asm/leds.h> |