From a7307bf22557e1e029df0ea6f2a2973de4d9c135 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Sun, 21 Sep 2008 21:31:16 +0100 Subject: [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 Signed-off-by: Andrew Victor Signed-off-by: Russell King --- arch/arm/mach-at91/leds.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'arch/arm/mach-at91/leds.c') 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 @@ #include #include #include +#include #include #include @@ -21,8 +22,6 @@ #if defined(CONFIG_NEW_LEDS) -#include - /* * New cross-platform LED support. */ @@ -55,6 +54,44 @@ void __init at91_gpio_leds(struct gpio_led *leds, int nr) {} #endif +/* ------------------------------------------------------------------------- */ + +#if defined (CONFIG_LEDS_ATMEL_PWM) + +/* + * PWM Leds + */ + +static struct gpio_led_platform_data pwm_led_data; + +static struct platform_device at91_pwm_leds = { + .name = "leds-atmel-pwm", + .id = -1, + .dev.platform_data = &pwm_led_data, +}; + +void __init at91_pwm_leds(struct gpio_led *leds, int nr) +{ + int i; + u32 pwm_mask = 0; + + if (!nr) + return; + + for (i = 0; i < nr; i++) + pwm_mask |= (1 << leds[i].gpio); + + pwm_led_data.leds = leds; + pwm_led_data.num_leds = nr; + + at91_add_device_pwm(pwm_mask); + platform_device_register(&at91_pwm_leds); +} +#else +void __init at91_pwm_leds(struct gpio_led *leds, int nr){} +#endif + + /* ------------------------------------------------------------------------- */ #if defined(CONFIG_LEDS) -- cgit v1.2.3 From 791ccf2e4deeea8426b389fd0f5bb0e9167bb75d Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Wed, 24 Sep 2008 22:03:52 +0100 Subject: [ARM] 5267/1: [AT91] Name conflict in mach-at91/leds.c The name of the platform device 'at91_pwm_leds' conflicts with the function at91_pwm_leds(). So rename the device 'at91_pwm_leds_device' to be more specific. Similarly rename 'at91_gpio_leds_device' for consistency. Signed-off-by: Andrew Victor Signed-off-by: Russell King --- arch/arm/mach-at91/leds.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'arch/arm/mach-at91/leds.c') diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c index ff76d59392cc..0415a839e1ad 100644 --- a/arch/arm/mach-at91/leds.c +++ b/arch/arm/mach-at91/leds.c @@ -28,7 +28,7 @@ static struct gpio_led_platform_data led_data; -static struct platform_device at91_leds = { +static struct platform_device at91_gpio_leds_device = { .name = "leds-gpio", .id = -1, .dev.platform_data = &led_data, @@ -46,7 +46,7 @@ void __init at91_gpio_leds(struct gpio_led *leds, int nr) led_data.leds = leds; led_data.num_leds = nr; - platform_device_register(&at91_leds); + platform_device_register(&at91_gpio_leds_device); } #else @@ -64,7 +64,7 @@ void __init at91_gpio_leds(struct gpio_led *leds, int nr) {} static struct gpio_led_platform_data pwm_led_data; -static struct platform_device at91_pwm_leds = { +static struct platform_device at91_pwm_leds_device = { .name = "leds-atmel-pwm", .id = -1, .dev.platform_data = &pwm_led_data, @@ -85,7 +85,7 @@ void __init at91_pwm_leds(struct gpio_led *leds, int nr) pwm_led_data.num_leds = nr; at91_add_device_pwm(pwm_mask); - platform_device_register(&at91_pwm_leds); + platform_device_register(&at91_pwm_leds_device); } #else void __init at91_pwm_leds(struct gpio_led *leds, int nr){} -- cgit v1.2.3