diff options
| author | Banajit Goswami <banajit.g@samsung.com> | 2011-07-20 10:45:22 -0400 |
|---|---|---|
| committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-07-20 13:10:31 -0400 |
| commit | 84ca326c7c77926ccb501eaa89f50d9230a9543b (patch) | |
| tree | f3844f93f6cceb88bba70cacfb9b110dec553956 | |
| parent | fef469f7c28268a9bfa8b4e440fbd8055ccc68c0 (diff) | |
ARM: S5PV210: Add PWM backlight support on SMDKV210
This patch adds support for LCD backlight using PWM timer for
Samsung SMDKV210 board.
Signed-off-by: Banajit Goswami <banajit.g@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
| -rw-r--r-- | arch/arm/mach-s5pv210/Kconfig | 1 | ||||
| -rw-r--r-- | arch/arm/mach-s5pv210/mach-smdkv210.c | 54 |
2 files changed, 14 insertions, 41 deletions
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig index 37b5a97594a5..79bb3a0314ef 100644 --- a/arch/arm/mach-s5pv210/Kconfig +++ b/arch/arm/mach-s5pv210/Kconfig | |||
| @@ -134,6 +134,7 @@ config MACH_SMDKV210 | |||
| 134 | select S3C_DEV_RTC | 134 | select S3C_DEV_RTC |
| 135 | select S3C_DEV_WDT | 135 | select S3C_DEV_WDT |
| 136 | select SAMSUNG_DEV_ADC | 136 | select SAMSUNG_DEV_ADC |
| 137 | select SAMSUNG_DEV_BACKLIGHT | ||
| 137 | select SAMSUNG_DEV_IDE | 138 | select SAMSUNG_DEV_IDE |
| 138 | select SAMSUNG_DEV_KEYPAD | 139 | select SAMSUNG_DEV_KEYPAD |
| 139 | select SAMSUNG_DEV_PWM | 140 | select SAMSUNG_DEV_PWM |
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c index c6a9e86c2d5c..c4d9b7dd098e 100644 --- a/arch/arm/mach-s5pv210/mach-smdkv210.c +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c | |||
| @@ -45,6 +45,7 @@ | |||
| 45 | #include <plat/pm.h> | 45 | #include <plat/pm.h> |
| 46 | #include <plat/fb.h> | 46 | #include <plat/fb.h> |
| 47 | #include <plat/s5p-time.h> | 47 | #include <plat/s5p-time.h> |
| 48 | #include <plat/backlight.h> | ||
| 48 | 49 | ||
| 49 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | 50 | /* Following are default values for UCON, ULCON and UFCON UART registers */ |
| 50 | #define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | 51 | #define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
| @@ -210,45 +211,6 @@ static struct s3c_fb_platdata smdkv210_lcd0_pdata __initdata = { | |||
| 210 | .setup_gpio = s5pv210_fb_gpio_setup_24bpp, | 211 | .setup_gpio = s5pv210_fb_gpio_setup_24bpp, |
| 211 | }; | 212 | }; |
| 212 | 213 | ||
| 213 | static int smdkv210_backlight_init(struct device *dev) | ||
| 214 | { | ||
| 215 | int ret; | ||
| 216 | |||
| 217 | ret = gpio_request(S5PV210_GPD0(3), "Backlight"); | ||
| 218 | if (ret) { | ||
| 219 | printk(KERN_ERR "failed to request GPD for PWM-OUT 3\n"); | ||
| 220 | return ret; | ||
| 221 | } | ||
| 222 | |||
| 223 | /* Configure GPIO pin with S5PV210_GPD_0_3_TOUT_3 */ | ||
| 224 | s3c_gpio_cfgpin(S5PV210_GPD0(3), S3C_GPIO_SFN(2)); | ||
| 225 | |||
| 226 | return 0; | ||
| 227 | } | ||
| 228 | |||
| 229 | static void smdkv210_backlight_exit(struct device *dev) | ||
| 230 | { | ||
| 231 | s3c_gpio_cfgpin(S5PV210_GPD0(3), S3C_GPIO_OUTPUT); | ||
| 232 | gpio_free(S5PV210_GPD0(3)); | ||
| 233 | } | ||
| 234 | |||
| 235 | static struct platform_pwm_backlight_data smdkv210_backlight_data = { | ||
| 236 | .pwm_id = 3, | ||
| 237 | .max_brightness = 255, | ||
| 238 | .dft_brightness = 255, | ||
| 239 | .pwm_period_ns = 78770, | ||
| 240 | .init = smdkv210_backlight_init, | ||
| 241 | .exit = smdkv210_backlight_exit, | ||
| 242 | }; | ||
| 243 | |||
| 244 | static struct platform_device smdkv210_backlight_device = { | ||
| 245 | .name = "pwm-backlight", | ||
| 246 | .dev = { | ||
| 247 | .parent = &s3c_device_timer[3].dev, | ||
| 248 | .platform_data = &smdkv210_backlight_data, | ||
| 249 | }, | ||
| 250 | }; | ||
| 251 | |||
| 252 | static struct platform_device *smdkv210_devices[] __initdata = { | 214 | static struct platform_device *smdkv210_devices[] __initdata = { |
| 253 | &s3c_device_adc, | 215 | &s3c_device_adc, |
| 254 | &s3c_device_cfcon, | 216 | &s3c_device_cfcon, |
| @@ -270,8 +232,6 @@ static struct platform_device *smdkv210_devices[] __initdata = { | |||
| 270 | &samsung_device_keypad, | 232 | &samsung_device_keypad, |
| 271 | &smdkv210_dm9000, | 233 | &smdkv210_dm9000, |
| 272 | &smdkv210_lcd_lte480wv, | 234 | &smdkv210_lcd_lte480wv, |
| 273 | &s3c_device_timer[3], | ||
| 274 | &smdkv210_backlight_device, | ||
| 275 | }; | 235 | }; |
| 276 | 236 | ||
| 277 | static void __init smdkv210_dm9000_init(void) | 237 | static void __init smdkv210_dm9000_init(void) |
| @@ -310,6 +270,16 @@ static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { | |||
| 310 | .oversampling_shift = 2, | 270 | .oversampling_shift = 2, |
| 311 | }; | 271 | }; |
| 312 | 272 | ||
| 273 | /* LCD Backlight data */ | ||
| 274 | static struct samsung_bl_gpio_info smdkv210_bl_gpio_info = { | ||
| 275 | .no = S5PV210_GPD0(3), | ||
| 276 | .func = S3C_GPIO_SFN(2), | ||
| 277 | }; | ||
| 278 | |||
| 279 | static struct platform_pwm_backlight_data smdkv210_bl_data = { | ||
| 280 | .pwm_id = 3, | ||
| 281 | }; | ||
| 282 | |||
| 313 | static void __init smdkv210_map_io(void) | 283 | static void __init smdkv210_map_io(void) |
| 314 | { | 284 | { |
| 315 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | 285 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); |
| @@ -341,6 +311,8 @@ static void __init smdkv210_machine_init(void) | |||
| 341 | 311 | ||
| 342 | s3c_fb_set_platdata(&smdkv210_lcd0_pdata); | 312 | s3c_fb_set_platdata(&smdkv210_lcd0_pdata); |
| 343 | 313 | ||
| 314 | samsung_bl_set(&smdkv210_bl_gpio_info, &smdkv210_bl_data); | ||
| 315 | |||
| 344 | platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices)); | 316 | platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices)); |
| 345 | } | 317 | } |
| 346 | 318 | ||
