diff options
Diffstat (limited to 'arch/arm/mach-s5pv210/mach-smdkv210.c')
-rw-r--r-- | arch/arm/mach-s5pv210/mach-smdkv210.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c index bc9fdb52a020..bc08ac42e7cc 100644 --- a/arch/arm/mach-s5pv210/mach-smdkv210.c +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/fb.h> | 18 | #include <linux/fb.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/pwm_backlight.h> | ||
21 | 22 | ||
22 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
23 | #include <asm/mach/map.h> | 24 | #include <asm/mach/map.h> |
@@ -43,6 +44,8 @@ | |||
43 | #include <plat/keypad.h> | 44 | #include <plat/keypad.h> |
44 | #include <plat/pm.h> | 45 | #include <plat/pm.h> |
45 | #include <plat/fb.h> | 46 | #include <plat/fb.h> |
47 | #include <plat/gpio-cfg.h> | ||
48 | #include <plat/s5p-time.h> | ||
46 | 49 | ||
47 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | 50 | /* Following are default values for UCON, ULCON and UFCON UART registers */ |
48 | #define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | 51 | #define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
@@ -208,6 +211,45 @@ static struct s3c_fb_platdata smdkv210_lcd0_pdata __initdata = { | |||
208 | .setup_gpio = s5pv210_fb_gpio_setup_24bpp, | 211 | .setup_gpio = s5pv210_fb_gpio_setup_24bpp, |
209 | }; | 212 | }; |
210 | 213 | ||
214 | static int smdkv210_backlight_init(struct device *dev) | ||
215 | { | ||
216 | int ret; | ||
217 | |||
218 | ret = gpio_request(S5PV210_GPD0(3), "Backlight"); | ||
219 | if (ret) { | ||
220 | printk(KERN_ERR "failed to request GPD for PWM-OUT 3\n"); | ||
221 | return ret; | ||
222 | } | ||
223 | |||
224 | /* Configure GPIO pin with S5PV210_GPD_0_3_TOUT_3 */ | ||
225 | s3c_gpio_cfgpin(S5PV210_GPD0(3), S3C_GPIO_SFN(2)); | ||
226 | |||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | static void smdkv210_backlight_exit(struct device *dev) | ||
231 | { | ||
232 | s3c_gpio_cfgpin(S5PV210_GPD0(3), S3C_GPIO_OUTPUT); | ||
233 | gpio_free(S5PV210_GPD0(3)); | ||
234 | } | ||
235 | |||
236 | static struct platform_pwm_backlight_data smdkv210_backlight_data = { | ||
237 | .pwm_id = 3, | ||
238 | .max_brightness = 255, | ||
239 | .dft_brightness = 255, | ||
240 | .pwm_period_ns = 78770, | ||
241 | .init = smdkv210_backlight_init, | ||
242 | .exit = smdkv210_backlight_exit, | ||
243 | }; | ||
244 | |||
245 | static struct platform_device smdkv210_backlight_device = { | ||
246 | .name = "pwm-backlight", | ||
247 | .dev = { | ||
248 | .parent = &s3c_device_timer[3].dev, | ||
249 | .platform_data = &smdkv210_backlight_data, | ||
250 | }, | ||
251 | }; | ||
252 | |||
211 | static struct platform_device *smdkv210_devices[] __initdata = { | 253 | static struct platform_device *smdkv210_devices[] __initdata = { |
212 | &s3c_device_adc, | 254 | &s3c_device_adc, |
213 | &s3c_device_cfcon, | 255 | &s3c_device_cfcon, |
@@ -229,6 +271,8 @@ static struct platform_device *smdkv210_devices[] __initdata = { | |||
229 | &samsung_device_keypad, | 271 | &samsung_device_keypad, |
230 | &smdkv210_dm9000, | 272 | &smdkv210_dm9000, |
231 | &smdkv210_lcd_lte480wv, | 273 | &smdkv210_lcd_lte480wv, |
274 | &s3c_device_timer[3], | ||
275 | &smdkv210_backlight_device, | ||
232 | }; | 276 | }; |
233 | 277 | ||
234 | static void __init smdkv210_dm9000_init(void) | 278 | static void __init smdkv210_dm9000_init(void) |
@@ -272,6 +316,7 @@ static void __init smdkv210_map_io(void) | |||
272 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | 316 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); |
273 | s3c24xx_init_clocks(24000000); | 317 | s3c24xx_init_clocks(24000000); |
274 | s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); | 318 | s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); |
319 | s5p_set_timer_source(S5P_PWM2, S5P_PWM4); | ||
275 | } | 320 | } |
276 | 321 | ||
277 | static void __init smdkv210_machine_init(void) | 322 | static void __init smdkv210_machine_init(void) |
@@ -306,5 +351,5 @@ MACHINE_START(SMDKV210, "SMDKV210") | |||
306 | .init_irq = s5pv210_init_irq, | 351 | .init_irq = s5pv210_init_irq, |
307 | .map_io = smdkv210_map_io, | 352 | .map_io = smdkv210_map_io, |
308 | .init_machine = smdkv210_machine_init, | 353 | .init_machine = smdkv210_machine_init, |
309 | .timer = &s3c24xx_timer, | 354 | .timer = &s5p_timer, |
310 | MACHINE_END | 355 | MACHINE_END |