aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBanajit Goswami <banajit.g@samsung.com>2011-02-28 12:32:32 -0500
committerKukjin Kim <kgene.kim@samsung.com>2011-03-02 20:10:10 -0500
commit5cd435b4ab881280fb0b8ce6686cfceb005d98c8 (patch)
treee46a1dce2cad190f215691dea76494f1213bbd25
parentbaa0c0609307e46531e9d5d6f5b9a510ceb8e30c (diff)
ARM: SAMSUNG: Add PWM backlight support on Samsung S5PV210
This patch adds support for LCD backlight control using PWM timer for Samsung's 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/Kconfig1
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkv210.c43
2 files changed, 44 insertions, 0 deletions
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 53aabef1e9ce..d7fd031f6015 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -130,6 +130,7 @@ config MACH_SMDKV210
130 select SAMSUNG_DEV_ADC 130 select SAMSUNG_DEV_ADC
131 select SAMSUNG_DEV_IDE 131 select SAMSUNG_DEV_IDE
132 select SAMSUNG_DEV_KEYPAD 132 select SAMSUNG_DEV_KEYPAD
133 select SAMSUNG_DEV_PWM
133 select SAMSUNG_DEV_TS 134 select SAMSUNG_DEV_TS
134 select S5PV210_SETUP_FB_24BPP 135 select S5PV210_SETUP_FB_24BPP
135 select S5PV210_SETUP_I2C1 136 select S5PV210_SETUP_I2C1
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index bc9fdb52a020..2b5f48806c57 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,7 @@
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>
46 48
47/* Following are default values for UCON, ULCON and UFCON UART registers */ 49/* Following are default values for UCON, ULCON and UFCON UART registers */
48#define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 50#define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -208,6 +210,45 @@ static struct s3c_fb_platdata smdkv210_lcd0_pdata __initdata = {
208 .setup_gpio = s5pv210_fb_gpio_setup_24bpp, 210 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
209}; 211};
210 212
213static 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
229static 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
235static 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
244static 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
211static struct platform_device *smdkv210_devices[] __initdata = { 252static struct platform_device *smdkv210_devices[] __initdata = {
212 &s3c_device_adc, 253 &s3c_device_adc,
213 &s3c_device_cfcon, 254 &s3c_device_cfcon,
@@ -229,6 +270,8 @@ static struct platform_device *smdkv210_devices[] __initdata = {
229 &samsung_device_keypad, 270 &samsung_device_keypad,
230 &smdkv210_dm9000, 271 &smdkv210_dm9000,
231 &smdkv210_lcd_lte480wv, 272 &smdkv210_lcd_lte480wv,
273 &s3c_device_timer[3],
274 &smdkv210_backlight_device,
232}; 275};
233 276
234static void __init smdkv210_dm9000_init(void) 277static void __init smdkv210_dm9000_init(void)