diff options
author | Banajit Goswami <banajit.g@samsung.com> | 2011-02-28 13:01:17 -0500 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-03-02 20:10:08 -0500 |
commit | b0fd644f444c680838140aff4e766389ee6ad9a3 (patch) | |
tree | f8424c374806d3c7b4ddd953652fe6e990fa809b /arch/arm/mach-s5p64x0 | |
parent | fec524aa05775b1582644f54842c6a30a9b7bbe5 (diff) |
ARM: SAMSUNG: Add PWM backlight support on Samsung S5P6450
This patch adds support for LCD backlight control using PWM timer
for Samsung SMDK6450 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-smdk6450.c | 43 |
2 files changed, 44 insertions, 0 deletions
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig index be5888a0e20b..08b0a5bf1d60 100644 --- a/arch/arm/mach-s5p64x0/Kconfig +++ b/arch/arm/mach-s5p64x0/Kconfig | |||
@@ -48,6 +48,7 @@ config MACH_SMDK6450 | |||
48 | select S3C_DEV_WDT | 48 | select S3C_DEV_WDT |
49 | select S3C64XX_DEV_SPI | 49 | select S3C64XX_DEV_SPI |
50 | select SAMSUNG_DEV_ADC | 50 | select SAMSUNG_DEV_ADC |
51 | select SAMSUNG_DEV_PWM | ||
51 | select SAMSUNG_DEV_TS | 52 | select SAMSUNG_DEV_TS |
52 | select S5P64X0_SETUP_I2C1 | 53 | select S5P64X0_SETUP_I2C1 |
53 | help | 54 | help |
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c index 3a20de0a9264..1d8f9fd5af3a 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.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> |
@@ -106,6 +108,45 @@ static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = { | |||
106 | #endif | 108 | #endif |
107 | }; | 109 | }; |
108 | 110 | ||
111 | static int smdk6450_backlight_init(struct device *dev) | ||
112 | { | ||
113 | int ret; | ||
114 | |||
115 | ret = gpio_request(S5P6450_GPF(15), "Backlight"); | ||
116 | if (ret) { | ||
117 | printk(KERN_ERR "failed to request GPF for PWM-OUT1\n"); | ||
118 | return ret; | ||
119 | } | ||
120 | |||
121 | /* Configure GPIO pin with S5P6450_GPF15_PWM_TOUT1 */ | ||
122 | s3c_gpio_cfgpin(S5P6450_GPF(15), S3C_GPIO_SFN(2)); | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static void smdk6450_backlight_exit(struct device *dev) | ||
128 | { | ||
129 | s3c_gpio_cfgpin(S5P6450_GPF(15), S3C_GPIO_OUTPUT); | ||
130 | gpio_free(S5P6450_GPF(15)); | ||
131 | } | ||
132 | |||
133 | static struct platform_pwm_backlight_data smdk6450_backlight_data = { | ||
134 | .pwm_id = 1, | ||
135 | .max_brightness = 255, | ||
136 | .dft_brightness = 255, | ||
137 | .pwm_period_ns = 78770, | ||
138 | .init = smdk6450_backlight_init, | ||
139 | .exit = smdk6450_backlight_exit, | ||
140 | }; | ||
141 | |||
142 | static struct platform_device smdk6450_backlight_device = { | ||
143 | .name = "pwm-backlight", | ||
144 | .dev = { | ||
145 | .parent = &s3c_device_timer[1].dev, | ||
146 | .platform_data = &smdk6450_backlight_data, | ||
147 | }, | ||
148 | }; | ||
149 | |||
109 | static struct platform_device *smdk6450_devices[] __initdata = { | 150 | static struct platform_device *smdk6450_devices[] __initdata = { |
110 | &s3c_device_adc, | 151 | &s3c_device_adc, |
111 | &s3c_device_rtc, | 152 | &s3c_device_rtc, |
@@ -115,6 +156,8 @@ static struct platform_device *smdk6450_devices[] __initdata = { | |||
115 | &s3c_device_wdt, | 156 | &s3c_device_wdt, |
116 | &samsung_asoc_dma, | 157 | &samsung_asoc_dma, |
117 | &s5p6450_device_iis0, | 158 | &s5p6450_device_iis0, |
159 | &s3c_device_timer[1], | ||
160 | &smdk6450_backlight_device, | ||
118 | /* s5p6450_device_spi0 will be added */ | 161 | /* s5p6450_device_spi0 will be added */ |
119 | }; | 162 | }; |
120 | 163 | ||