aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2014-05-28 19:20:05 -0400
committerNicolas Ferre <nicolas.ferre@atmel.com>2014-07-09 09:13:28 -0400
commitc545dcd3a2b9b13c62d040e8e4fd9b490fa522ab (patch)
tree84ac2690cb52d01bdec101a28587f5ab424ab003
parente030427f5138351a1a969f8cbad37e542237fa67 (diff)
ARM: at91: sam9m10g45ek: use generic leds_pwm driver
Switch to the generic leds_pwm driver instead of leds-atmel-pwm. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 1ea61328f30d..b227732b0c83 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -26,6 +26,8 @@
26#include <linux/leds.h> 26#include <linux/leds.h>
27#include <linux/atmel-mci.h> 27#include <linux/atmel-mci.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/pwm.h>
30#include <linux/leds_pwm.h>
29 31
30#include <linux/platform_data/at91_adc.h> 32#include <linux/platform_data/at91_adc.h>
31 33
@@ -416,7 +418,7 @@ static struct gpio_led ek_leds[] = {
416 .active_low = 1, 418 .active_low = 1,
417 .default_trigger = "nand-disk", 419 .default_trigger = "nand-disk",
418 }, 420 },
419#if !(defined(CONFIG_LEDS_ATMEL_PWM) || defined(CONFIG_LEDS_ATMEL_PWM_MODULE)) 421#if !IS_ENABLED(CONFIG_LEDS_PWM)
420 { /* "right" led, green, userled1, pwm1 */ 422 { /* "right" led, green, userled1, pwm1 */
421 .name = "d7", 423 .name = "d7",
422 .gpio = AT91_PIN_PD31, 424 .gpio = AT91_PIN_PD31,
@@ -430,22 +432,41 @@ static struct gpio_led ek_leds[] = {
430/* 432/*
431 * PWM Leds 433 * PWM Leds
432 */ 434 */
433static struct gpio_led ek_pwm_led[] = { 435static struct pwm_lookup pwm_lookup[] = {
434#if defined(CONFIG_LEDS_ATMEL_PWM) || defined(CONFIG_LEDS_ATMEL_PWM_MODULE) 436 PWM_LOOKUP("at91sam9rl-pwm", 1, "leds_pwm", "d7",
437 5000, PWM_POLARITY_INVERSED),
438};
439
440#if IS_ENABLED(CONFIG_LEDS_PWM)
441static struct led_pwm pwm_leds[] = {
435 { /* "right" led, green, userled1, pwm1 */ 442 { /* "right" led, green, userled1, pwm1 */
436 .name = "d7", 443 .name = "d7",
437 .gpio = 1, /* is PWM channel number */ 444 .max_brightness = 255,
438 .active_low = 1,
439 .default_trigger = "none",
440 }, 445 },
441#endif
442}; 446};
443 447
448static struct led_pwm_platform_data pwm_data = {
449 .num_leds = ARRAY_SIZE(pwm_leds),
450 .leds = pwm_leds,
451};
452
453static struct platform_device leds_pwm = {
454 .name = "leds_pwm",
455 .id = -1,
456 .dev = {
457 .platform_data = &pwm_data,
458 },
459};
460#endif
461
444static struct platform_device *devices[] __initdata = { 462static struct platform_device *devices[] __initdata = {
445#if defined(CONFIG_SOC_CAMERA_OV2640) || \ 463#if defined(CONFIG_SOC_CAMERA_OV2640) || \
446 defined(CONFIG_SOC_CAMERA_OV2640_MODULE) 464 defined(CONFIG_SOC_CAMERA_OV2640_MODULE)
447 &isi_ov2640, 465 &isi_ov2640,
448#endif 466#endif
467#if IS_ENABLED(CONFIG_LEDS_PWM)
468 &leds_pwm,
469#endif
449}; 470};
450 471
451static void __init ek_board_init(void) 472static void __init ek_board_init(void)
@@ -486,7 +507,10 @@ static void __init ek_board_init(void)
486 at91_add_device_ac97(&ek_ac97_data); 507 at91_add_device_ac97(&ek_ac97_data);
487 /* LEDs */ 508 /* LEDs */
488 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 509 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
489 at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); 510 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
511#if IS_ENABLED(CONFIG_LEDS_PWM)
512 at91_add_device_pwm(1 << AT91_PWM1);
513#endif
490 /* Other platform devices */ 514 /* Other platform devices */
491 platform_add_devices(devices, ARRAY_SIZE(devices)); 515 platform_add_devices(devices, ARRAY_SIZE(devices));
492} 516}