diff options
Diffstat (limited to 'arch/avr32/boards')
-rw-r--r-- | arch/avr32/boards/favr-32/setup.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c index 1f121497b517..234cb071c601 100644 --- a/arch/avr32/boards/favr-32/setup.c +++ b/arch/avr32/boards/favr-32/setup.c | |||
@@ -18,7 +18,10 @@ | |||
18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
19 | #include <linux/leds.h> | 19 | #include <linux/leds.h> |
20 | #include <linux/atmel-mci.h> | 20 | #include <linux/atmel-mci.h> |
21 | #include <linux/atmel-pwm-bl.h> | 21 | #include <linux/pwm.h> |
22 | #include <linux/pwm_backlight.h> | ||
23 | #include <linux/regulator/fixed.h> | ||
24 | #include <linux/regulator/machine.h> | ||
22 | #include <linux/spi/spi.h> | 25 | #include <linux/spi/spi.h> |
23 | #include <linux/spi/ads7846.h> | 26 | #include <linux/spi/ads7846.h> |
24 | 27 | ||
@@ -33,6 +36,8 @@ | |||
33 | #include <mach/board.h> | 36 | #include <mach/board.h> |
34 | #include <mach/portmux.h> | 37 | #include <mach/portmux.h> |
35 | 38 | ||
39 | #define PWM_BL_CH 2 | ||
40 | |||
36 | /* Oscillator frequencies. These are board-specific */ | 41 | /* Oscillator frequencies. These are board-specific */ |
37 | unsigned long at32_board_osc_rates[3] = { | 42 | unsigned long at32_board_osc_rates[3] = { |
38 | [0] = 32768, /* 32.768 kHz on RTC osc */ | 43 | [0] = 32768, /* 32.768 kHz on RTC osc */ |
@@ -227,29 +232,36 @@ void __init favr32_setup_leds(void) | |||
227 | platform_device_register(&favr32_led_dev); | 232 | platform_device_register(&favr32_led_dev); |
228 | } | 233 | } |
229 | 234 | ||
230 | static struct atmel_pwm_bl_platform_data atmel_pwm_bl_pdata = { | 235 | static struct pwm_lookup pwm_lookup[] = { |
231 | .pwm_channel = 2, | 236 | PWM_LOOKUP("at91sam9rl-pwm", PWM_BL_CH, "pwm-backlight.0", NULL, |
232 | .pwm_frequency = 200000, | 237 | 5000, PWM_POLARITY_INVERSED), |
233 | .pwm_compare_max = 345, | ||
234 | .pwm_duty_max = 345, | ||
235 | .pwm_duty_min = 90, | ||
236 | .pwm_active_low = 1, | ||
237 | .gpio_on = GPIO_PIN_PA(28), | ||
238 | .on_active_low = 0, | ||
239 | }; | 238 | }; |
240 | 239 | ||
241 | static struct platform_device atmel_pwm_bl_dev = { | 240 | static struct regulator_consumer_supply fixed_power_consumers[] = { |
242 | .name = "atmel-pwm-bl", | 241 | REGULATOR_SUPPLY("power", "pwm-backlight.0"), |
243 | .id = 0, | 242 | }; |
244 | .dev = { | 243 | |
245 | .platform_data = &atmel_pwm_bl_pdata, | 244 | static struct platform_pwm_backlight_data pwm_bl_data = { |
245 | .enable_gpio = GPIO_PIN_PA(28), | ||
246 | .max_brightness = 255, | ||
247 | .dft_brightness = 255, | ||
248 | .lth_brightness = 50, | ||
249 | }; | ||
250 | |||
251 | static struct platform_device pwm_bl_device = { | ||
252 | .name = "pwm-backlight", | ||
253 | .dev = { | ||
254 | .platform_data = &pwm_bl_data, | ||
246 | }, | 255 | }, |
247 | }; | 256 | }; |
248 | 257 | ||
249 | static void __init favr32_setup_atmel_pwm_bl(void) | 258 | static void __init favr32_setup_atmel_pwm_bl(void) |
250 | { | 259 | { |
251 | platform_device_register(&atmel_pwm_bl_dev); | 260 | pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup)); |
252 | at32_select_gpio(atmel_pwm_bl_pdata.gpio_on, 0); | 261 | regulator_register_always_on(0, "fixed", fixed_power_consumers, |
262 | ARRAY_SIZE(fixed_power_consumers), 3300000); | ||
263 | platform_device_register(&pwm_bl_device); | ||
264 | at32_select_gpio(pwm_bl_data.enable_gpio, 0); | ||
253 | } | 265 | } |
254 | 266 | ||
255 | void __init setup_board(void) | 267 | void __init setup_board(void) |
@@ -339,7 +351,7 @@ static int __init favr32_init(void) | |||
339 | 351 | ||
340 | set_abdac_rate(at32_add_device_abdac(0, &abdac0_data)); | 352 | set_abdac_rate(at32_add_device_abdac(0, &abdac0_data)); |
341 | 353 | ||
342 | at32_add_device_pwm(1 << atmel_pwm_bl_pdata.pwm_channel); | 354 | at32_add_device_pwm(1 << PWM_BL_CH); |
343 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); | 355 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); |
344 | at32_add_device_mci(0, &mci0_data); | 356 | at32_add_device_mci(0, &mci0_data); |
345 | at32_add_device_usba(0, NULL); | 357 | at32_add_device_usba(0, NULL); |