Commit c545dcd3 authored by Alexandre Belloni's avatar Alexandre Belloni Committed by Nicolas Ferre

ARM: at91: sam9m10g45ek: use generic leds_pwm driver

Switch to the generic leds_pwm driver instead of leds-atmel-pwm.
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
parent e030427f
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/atmel-mci.h> #include <linux/atmel-mci.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pwm.h>
#include <linux/leds_pwm.h>
#include <linux/platform_data/at91_adc.h> #include <linux/platform_data/at91_adc.h>
...@@ -416,7 +418,7 @@ static struct gpio_led ek_leds[] = { ...@@ -416,7 +418,7 @@ static struct gpio_led ek_leds[] = {
.active_low = 1, .active_low = 1,
.default_trigger = "nand-disk", .default_trigger = "nand-disk",
}, },
#if !(defined(CONFIG_LEDS_ATMEL_PWM) || defined(CONFIG_LEDS_ATMEL_PWM_MODULE)) #if !IS_ENABLED(CONFIG_LEDS_PWM)
{ /* "right" led, green, userled1, pwm1 */ { /* "right" led, green, userled1, pwm1 */
.name = "d7", .name = "d7",
.gpio = AT91_PIN_PD31, .gpio = AT91_PIN_PD31,
...@@ -430,22 +432,41 @@ static struct gpio_led ek_leds[] = { ...@@ -430,22 +432,41 @@ static struct gpio_led ek_leds[] = {
/* /*
* PWM Leds * PWM Leds
*/ */
static struct gpio_led ek_pwm_led[] = { static struct pwm_lookup pwm_lookup[] = {
#if defined(CONFIG_LEDS_ATMEL_PWM) || defined(CONFIG_LEDS_ATMEL_PWM_MODULE) PWM_LOOKUP("at91sam9rl-pwm", 1, "leds_pwm", "d7",
5000, PWM_POLARITY_INVERSED),
};
#if IS_ENABLED(CONFIG_LEDS_PWM)
static struct led_pwm pwm_leds[] = {
{ /* "right" led, green, userled1, pwm1 */ { /* "right" led, green, userled1, pwm1 */
.name = "d7", .name = "d7",
.gpio = 1, /* is PWM channel number */ .max_brightness = 255,
.active_low = 1, },
.default_trigger = "none", };
static struct led_pwm_platform_data pwm_data = {
.num_leds = ARRAY_SIZE(pwm_leds),
.leds = pwm_leds,
};
static struct platform_device leds_pwm = {
.name = "leds_pwm",
.id = -1,
.dev = {
.platform_data = &pwm_data,
}, },
#endif
}; };
#endif
static struct platform_device *devices[] __initdata = { static struct platform_device *devices[] __initdata = {
#if defined(CONFIG_SOC_CAMERA_OV2640) || \ #if defined(CONFIG_SOC_CAMERA_OV2640) || \
defined(CONFIG_SOC_CAMERA_OV2640_MODULE) defined(CONFIG_SOC_CAMERA_OV2640_MODULE)
&isi_ov2640, &isi_ov2640,
#endif #endif
#if IS_ENABLED(CONFIG_LEDS_PWM)
&leds_pwm,
#endif
}; };
static void __init ek_board_init(void) static void __init ek_board_init(void)
...@@ -486,7 +507,10 @@ static void __init ek_board_init(void) ...@@ -486,7 +507,10 @@ static void __init ek_board_init(void)
at91_add_device_ac97(&ek_ac97_data); at91_add_device_ac97(&ek_ac97_data);
/* LEDs */ /* LEDs */
at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
#if IS_ENABLED(CONFIG_LEDS_PWM)
at91_add_device_pwm(1 << AT91_PWM1);
#endif
/* Other platform devices */ /* Other platform devices */
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment