aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2014-05-28 19:20:07 -0400
committerNicolas Ferre <nicolas.ferre@atmel.com>2014-07-09 09:13:29 -0400
commitf2e5b269362cd4952a4fa788a8d4dd635ddda804 (patch)
treeba046738694d8db0f7e9293a6c8f4068e4d2ba72
parent3791f7832578dee4729aee818f204074d5ea8f39 (diff)
ARM: at91: sam9263ek: 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-sam9263ek.c55
1 files changed, 47 insertions, 8 deletions
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index cd2726ee5add..fc446097f410 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -32,6 +32,8 @@
32#include <linux/gpio_keys.h> 32#include <linux/gpio_keys.h>
33#include <linux/input.h> 33#include <linux/input.h>
34#include <linux/leds.h> 34#include <linux/leds.h>
35#include <linux/pwm.h>
36#include <linux/leds_pwm.h>
35 37
36#include <video/atmel_lcdc.h> 38#include <video/atmel_lcdc.h>
37 39
@@ -369,21 +371,47 @@ static struct gpio_led ek_leds[] = {
369 .name = "ds3", 371 .name = "ds3",
370 .gpio = AT91_PIN_PB7, 372 .gpio = AT91_PIN_PB7,
371 .default_trigger = "heartbeat", 373 .default_trigger = "heartbeat",
374 },
375#if !IS_ENABLED(CONFIG_LEDS_PWM)
376 {
377 .name = "ds1",
378 .gpio = AT91_PIN_PB8,
379 .active_low = 1,
380 .default_trigger = "none",
372 } 381 }
382#endif
373}; 383};
374 384
375/* 385/*
376 * PWM Leds 386 * PWM Leds
377 */ 387 */
378static struct gpio_led ek_pwm_led[] = { 388static struct pwm_lookup pwm_lookup[] = {
379 /* For now only DS1 is PWM-driven (by pwm1) */ 389 PWM_LOOKUP("at91sam9rl-pwm", 1, "leds_pwm", "ds1",
390 5000, PWM_POLARITY_INVERSED),
391};
392
393#if IS_ENABLED(CONFIG_LEDS_PWM)
394static struct led_pwm pwm_leds[] = {
380 { 395 {
381 .name = "ds1", 396 .name = "ds1",
382 .gpio = 1, /* is PWM channel number */ 397 .max_brightness = 255,
383 .active_low = 1, 398 },
384 .default_trigger = "none", 399};
385 } 400
401static struct led_pwm_platform_data pwm_data = {
402 .num_leds = ARRAY_SIZE(pwm_leds),
403 .leds = pwm_leds,
404};
405
406static struct platform_device leds_pwm = {
407 .name = "leds_pwm",
408 .id = -1,
409 .dev = {
410 .platform_data = &pwm_data,
411 },
386}; 412};
413#endif
414
387 415
388/* 416/*
389 * CAN 417 * CAN
@@ -403,6 +431,12 @@ static struct at91_can_data ek_can_data = {
403 .transceiver_switch = sam9263ek_transceiver_switch, 431 .transceiver_switch = sam9263ek_transceiver_switch,
404}; 432};
405 433
434static struct platform_device *devices[] __initdata = {
435#if IS_ENABLED(CONFIG_LEDS_PWM)
436 &leds_pwm,
437#endif
438};
439
406static void __init ek_board_init(void) 440static void __init ek_board_init(void)
407{ 441{
408 /* Serial */ 442 /* Serial */
@@ -437,9 +471,14 @@ static void __init ek_board_init(void)
437 at91_add_device_ac97(&ek_ac97_data); 471 at91_add_device_ac97(&ek_ac97_data);
438 /* LEDs */ 472 /* LEDs */
439 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 473 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
440 at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); 474 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
475#if IS_ENABLED(CONFIG_LEDS_PWM)
476 at91_add_device_pwm(1 << AT91_PWM1);
477#endif
441 /* CAN */ 478 /* CAN */
442 at91_add_device_can(&ek_can_data); 479 at91_add_device_can(&ek_can_data);
480 /* Other platform devices */
481 platform_add_devices(devices, ARRAY_SIZE(devices));
443} 482}
444 483
445MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK") 484MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK")