X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=arch%2Farm%2Fmach-at91%2Fleds.c;h=0415a839e1ad9319944a662b409799015f9fde3d;hb=791ccf2e4deeea8426b389fd0f5bb0e9167bb75d;hp=fec03c59ff94f382a9026bf699a95b00bd7804e0;hpb=56831a1a883bb8376ea56ce8f3b1d5844c94d257;p=linux-2.6-omap-h63xx.git diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c index fec03c59ff9..0415a839e1a 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,15 +22,13 @@ #if defined(CONFIG_NEW_LEDS) -#include - /* * New cross-platform LED support. */ 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, @@ -47,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 @@ -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_device = { + .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_device); +} +#else +void __init at91_pwm_leds(struct gpio_led *leds, int nr){} +#endif + + /* ------------------------------------------------------------------------- */ #if defined(CONFIG_LEDS)