diff options
author | Banajit Goswami <banajit.g@samsung.com> | 2011-02-28 10:01:27 -0500 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-03-02 20:10:07 -0500 |
commit | fec524aa05775b1582644f54842c6a30a9b7bbe5 (patch) | |
tree | 1b4bf20e02c278e794a435021063dcc5e7bda536 /arch/arm/mach-s5p64x0 | |
parent | 075d108989f71e6c7c287c258ebc3faf53066458 (diff) |
ARM: SAMSUNG: Add PWM backlight support on Samsung S5P6440
This patch adds support for LCD backlight control using PWM timer
for Samsung SMDK6440 board.
Signed-off-by: Banajit Goswami <banajit.g@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-s5p64x0')
-rw-r--r-- | arch/arm/mach-s5p64x0/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/mach-smdk6440.c | 43 |
2 files changed, 44 insertions, 0 deletions
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig index 164d2783d381..be5888a0e20b 100644 --- a/arch/arm/mach-s5p64x0/Kconfig +++ b/arch/arm/mach-s5p64x0/Kconfig | |||
@@ -34,6 +34,7 @@ config MACH_SMDK6440 | |||
34 | select S3C_DEV_WDT | 34 | select S3C_DEV_WDT |
35 | select S3C64XX_DEV_SPI | 35 | select S3C64XX_DEV_SPI |
36 | select SAMSUNG_DEV_ADC | 36 | select SAMSUNG_DEV_ADC |
37 | select SAMSUNG_DEV_PWM | ||
37 | select SAMSUNG_DEV_TS | 38 | select SAMSUNG_DEV_TS |
38 | select S5P64X0_SETUP_I2C1 | 39 | select S5P64X0_SETUP_I2C1 |
39 | help | 40 | help |
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c index e5beb84e2393..366dca4ec794 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/pwm_backlight.h> | ||
25 | 26 | ||
26 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
27 | #include <asm/mach/map.h> | 28 | #include <asm/mach/map.h> |
@@ -32,6 +33,7 @@ | |||
32 | #include <mach/map.h> | 33 | #include <mach/map.h> |
33 | #include <mach/regs-clock.h> | 34 | #include <mach/regs-clock.h> |
34 | #include <mach/i2c.h> | 35 | #include <mach/i2c.h> |
36 | #include <mach/regs-gpio.h> | ||
35 | 37 | ||
36 | #include <plat/regs-serial.h> | 38 | #include <plat/regs-serial.h> |
37 | #include <plat/gpio-cfg.h> | 39 | #include <plat/gpio-cfg.h> |
@@ -88,6 +90,45 @@ static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = { | |||
88 | }, | 90 | }, |
89 | }; | 91 | }; |
90 | 92 | ||
93 | static int smdk6440_backlight_init(struct device *dev) | ||
94 | { | ||
95 | int ret; | ||
96 | |||
97 | ret = gpio_request(S5P6440_GPF(15), "Backlight"); | ||
98 | if (ret) { | ||
99 | printk(KERN_ERR "failed to request GPF for PWM-OUT1\n"); | ||
100 | return ret; | ||
101 | } | ||
102 | |||
103 | /* Configure GPIO pin with S5P6440_GPF15_PWM_TOUT1 */ | ||
104 | s3c_gpio_cfgpin(S5P6440_GPF(15), S3C_GPIO_SFN(2)); | ||
105 | |||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | static void smdk6440_backlight_exit(struct device *dev) | ||
110 | { | ||
111 | s3c_gpio_cfgpin(S5P6440_GPF(15), S3C_GPIO_OUTPUT); | ||
112 | gpio_free(S5P6440_GPF(15)); | ||
113 | } | ||
114 | |||
115 | static struct platform_pwm_backlight_data smdk6440_backlight_data = { | ||
116 | .pwm_id = 1, | ||
117 | .max_brightness = 255, | ||
118 | .dft_brightness = 255, | ||
119 | .pwm_period_ns = 78770, | ||
120 | .init = smdk6440_backlight_init, | ||
121 | .exit = smdk6440_backlight_exit, | ||
122 | }; | ||
123 | |||
124 | static struct platform_device smdk6440_backlight_device = { | ||
125 | .name = "pwm-backlight", | ||
126 | .dev = { | ||
127 | .parent = &s3c_device_timer[1].dev, | ||
128 | .platform_data = &smdk6440_backlight_data, | ||
129 | }, | ||
130 | }; | ||
131 | |||
91 | static struct platform_device *smdk6440_devices[] __initdata = { | 132 | static struct platform_device *smdk6440_devices[] __initdata = { |
92 | &s3c_device_adc, | 133 | &s3c_device_adc, |
93 | &s3c_device_rtc, | 134 | &s3c_device_rtc, |
@@ -97,6 +138,8 @@ static struct platform_device *smdk6440_devices[] __initdata = { | |||
97 | &s3c_device_wdt, | 138 | &s3c_device_wdt, |
98 | &samsung_asoc_dma, | 139 | &samsung_asoc_dma, |
99 | &s5p6440_device_iis, | 140 | &s5p6440_device_iis, |
141 | &s3c_device_timer[1], | ||
142 | &smdk6440_backlight_device, | ||
100 | }; | 143 | }; |
101 | 144 | ||
102 | static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = { | 145 | static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = { |