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

avr32: favr-32: use generic pwm_bl driver

Switch to the generic pwm_bl driver instead of atmel-pwm-bl.
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: default avatarHans-Christian Egtvedt <egtvedt@samfundet.no>
Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
parent b2f10803
...@@ -18,7 +18,10 @@ ...@@ -18,7 +18,10 @@
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/atmel-mci.h> #include <linux/atmel-mci.h>
#include <linux/atmel-pwm-bl.h> #include <linux/pwm.h>
#include <linux/pwm_backlight.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/ads7846.h> #include <linux/spi/ads7846.h>
...@@ -33,6 +36,8 @@ ...@@ -33,6 +36,8 @@
#include <mach/board.h> #include <mach/board.h>
#include <mach/portmux.h> #include <mach/portmux.h>
#define PWM_BL_CH 2
/* Oscillator frequencies. These are board-specific */ /* Oscillator frequencies. These are board-specific */
unsigned long at32_board_osc_rates[3] = { unsigned long at32_board_osc_rates[3] = {
[0] = 32768, /* 32.768 kHz on RTC osc */ [0] = 32768, /* 32.768 kHz on RTC osc */
...@@ -227,29 +232,36 @@ void __init favr32_setup_leds(void) ...@@ -227,29 +232,36 @@ void __init favr32_setup_leds(void)
platform_device_register(&favr32_led_dev); platform_device_register(&favr32_led_dev);
} }
static struct atmel_pwm_bl_platform_data atmel_pwm_bl_pdata = { static struct pwm_lookup pwm_lookup[] = {
.pwm_channel = 2, PWM_LOOKUP("at91sam9rl-pwm", PWM_BL_CH, "pwm-backlight.0", NULL,
.pwm_frequency = 200000, 5000, PWM_POLARITY_INVERSED),
.pwm_compare_max = 345,
.pwm_duty_max = 345,
.pwm_duty_min = 90,
.pwm_active_low = 1,
.gpio_on = GPIO_PIN_PA(28),
.on_active_low = 0,
}; };
static struct platform_device atmel_pwm_bl_dev = { static struct regulator_consumer_supply fixed_power_consumers[] = {
.name = "atmel-pwm-bl", REGULATOR_SUPPLY("power", "pwm-backlight.0"),
.id = 0, };
.dev = {
.platform_data = &atmel_pwm_bl_pdata, static struct platform_pwm_backlight_data pwm_bl_data = {
.enable_gpio = GPIO_PIN_PA(28),
.max_brightness = 255,
.dft_brightness = 255,
.lth_brightness = 50,
};
static struct platform_device pwm_bl_device = {
.name = "pwm-backlight",
.dev = {
.platform_data = &pwm_bl_data,
}, },
}; };
static void __init favr32_setup_atmel_pwm_bl(void) static void __init favr32_setup_atmel_pwm_bl(void)
{ {
platform_device_register(&atmel_pwm_bl_dev); pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
at32_select_gpio(atmel_pwm_bl_pdata.gpio_on, 0); regulator_register_always_on(0, "fixed", fixed_power_consumers,
ARRAY_SIZE(fixed_power_consumers), 3300000);
platform_device_register(&pwm_bl_device);
at32_select_gpio(pwm_bl_data.enable_gpio, 0);
} }
void __init setup_board(void) void __init setup_board(void)
...@@ -339,7 +351,7 @@ static int __init favr32_init(void) ...@@ -339,7 +351,7 @@ static int __init favr32_init(void)
set_abdac_rate(at32_add_device_abdac(0, &abdac0_data)); set_abdac_rate(at32_add_device_abdac(0, &abdac0_data));
at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel); at32_add_device_pwm(1 << PWM_BL_CH);
at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
at32_add_device_mci(0, &mci0_data); at32_add_device_mci(0, &mci0_data);
at32_add_device_usba(0, NULL); at32_add_device_usba(0, NULL);
......
...@@ -67,7 +67,6 @@ CONFIG_MTD_PHYSMAP=y ...@@ -67,7 +67,6 @@ CONFIG_MTD_PHYSMAP=y
CONFIG_BLK_DEV_LOOP=m CONFIG_BLK_DEV_LOOP=m
CONFIG_BLK_DEV_NBD=m CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_RAM=m CONFIG_BLK_DEV_RAM=m
CONFIG_ATMEL_PWM=m
CONFIG_ATMEL_TCLIB=y CONFIG_ATMEL_TCLIB=y
CONFIG_ATMEL_SSC=m CONFIG_ATMEL_SSC=m
CONFIG_NETDEVICES=y CONFIG_NETDEVICES=y
...@@ -108,7 +107,7 @@ CONFIG_FB=y ...@@ -108,7 +107,7 @@ CONFIG_FB=y
CONFIG_FB_ATMEL=y CONFIG_FB_ATMEL=y
CONFIG_BACKLIGHT_LCD_SUPPORT=y CONFIG_BACKLIGHT_LCD_SUPPORT=y
# CONFIG_LCD_CLASS_DEVICE is not set # CONFIG_LCD_CLASS_DEVICE is not set
CONFIG_BACKLIGHT_ATMEL_PWM=m CONFIG_BACKLIGHT_PWM=m
CONFIG_SOUND=m CONFIG_SOUND=m
CONFIG_SOUND_PRIME=m CONFIG_SOUND_PRIME=m
# CONFIG_HID_SUPPORT is not set # CONFIG_HID_SUPPORT is not set
...@@ -123,7 +122,6 @@ CONFIG_MMC=y ...@@ -123,7 +122,6 @@ CONFIG_MMC=y
CONFIG_MMC_ATMELMCI=y CONFIG_MMC_ATMELMCI=y
CONFIG_NEW_LEDS=y CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y CONFIG_LEDS_CLASS=y
CONFIG_LEDS_ATMEL_PWM=m
CONFIG_LEDS_GPIO=y CONFIG_LEDS_GPIO=y
CONFIG_LEDS_TRIGGERS=y CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y CONFIG_LEDS_TRIGGER_TIMER=y
...@@ -132,6 +130,8 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y ...@@ -132,6 +130,8 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_RTC_CLASS=y CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_AT32AP700X=y CONFIG_RTC_DRV_AT32AP700X=y
CONFIG_DMADEVICES=y CONFIG_DMADEVICES=y
CONFIG_PWM=y
CONFIG_PWM_ATMEL=y
CONFIG_EXT2_FS=y CONFIG_EXT2_FS=y
CONFIG_EXT3_FS=y CONFIG_EXT3_FS=y
# CONFIG_EXT3_FS_XATTR is not set # CONFIG_EXT3_FS_XATTR is not set
......
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