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:35 -0400 |
commit | 1cad6766ef113a8054a9cd36fdde3f1bbd50138a (patch) | |
tree | bf1b5558ec099c4a434fa640d9212cd61b2d07e5 /arch/arm/mach-s5pc100 | |
parent | 84ca326c7c77926ccb501eaa89f50d9230a9543b (diff) |
ARM: S5PC100: Add PWM backlight support on SMDKC100
This patch adds support for LCD backlight using PWM timer for
Samsung SMDKC100 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-s5pc100')
-rw-r--r-- | arch/arm/mach-s5pc100/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-s5pc100/mach-smdkc100.c | 55 |
2 files changed, 15 insertions, 41 deletions
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig index 608722ff4f28..e8a33c4b054c 100644 --- a/arch/arm/mach-s5pc100/Kconfig +++ b/arch/arm/mach-s5pc100/Kconfig | |||
@@ -56,6 +56,7 @@ config MACH_SMDKC100 | |||
56 | select S3C_DEV_RTC | 56 | select S3C_DEV_RTC |
57 | select S3C_DEV_WDT | 57 | select S3C_DEV_WDT |
58 | select SAMSUNG_DEV_ADC | 58 | select SAMSUNG_DEV_ADC |
59 | select SAMSUNG_DEV_BACKLIGHT | ||
59 | select SAMSUNG_DEV_IDE | 60 | select SAMSUNG_DEV_IDE |
60 | select SAMSUNG_DEV_KEYPAD | 61 | select SAMSUNG_DEV_KEYPAD |
61 | select SAMSUNG_DEV_PWM | 62 | select SAMSUNG_DEV_PWM |
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c index 0525cb3ef406..c89d6ecb450d 100644 --- a/arch/arm/mach-s5pc100/mach-smdkc100.c +++ b/arch/arm/mach-s5pc100/mach-smdkc100.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <plat/keypad.h> | 51 | #include <plat/keypad.h> |
52 | #include <plat/ts.h> | 52 | #include <plat/ts.h> |
53 | #include <plat/audio.h> | 53 | #include <plat/audio.h> |
54 | #include <plat/backlight.h> | ||
54 | 55 | ||
55 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | 56 | /* Following are default values for UCON, ULCON and UFCON UART registers */ |
56 | #define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | 57 | #define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
@@ -179,45 +180,6 @@ static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = { | |||
179 | .cols = 8, | 180 | .cols = 8, |
180 | }; | 181 | }; |
181 | 182 | ||
182 | static int smdkc100_backlight_init(struct device *dev) | ||
183 | { | ||
184 | int ret; | ||
185 | |||
186 | ret = gpio_request(S5PC100_GPD(0), "Backlight"); | ||
187 | if (ret) { | ||
188 | printk(KERN_ERR "failed to request GPF for PWM-OUT0\n"); | ||
189 | return ret; | ||
190 | } | ||
191 | |||
192 | /* Configure GPIO pin with S5PC100_GPD_TOUT_0 */ | ||
193 | s3c_gpio_cfgpin(S5PC100_GPD(0), S3C_GPIO_SFN(2)); | ||
194 | |||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | static void smdkc100_backlight_exit(struct device *dev) | ||
199 | { | ||
200 | s3c_gpio_cfgpin(S5PC100_GPD(0), S3C_GPIO_OUTPUT); | ||
201 | gpio_free(S5PC100_GPD(0)); | ||
202 | } | ||
203 | |||
204 | static struct platform_pwm_backlight_data smdkc100_backlight_data = { | ||
205 | .pwm_id = 0, | ||
206 | .max_brightness = 255, | ||
207 | .dft_brightness = 255, | ||
208 | .pwm_period_ns = 78770, | ||
209 | .init = smdkc100_backlight_init, | ||
210 | .exit = smdkc100_backlight_exit, | ||
211 | }; | ||
212 | |||
213 | static struct platform_device smdkc100_backlight_device = { | ||
214 | .name = "pwm-backlight", | ||
215 | .dev = { | ||
216 | .parent = &s3c_device_timer[0].dev, | ||
217 | .platform_data = &smdkc100_backlight_data, | ||
218 | }, | ||
219 | }; | ||
220 | |||
221 | static struct platform_device *smdkc100_devices[] __initdata = { | 183 | static struct platform_device *smdkc100_devices[] __initdata = { |
222 | &s3c_device_adc, | 184 | &s3c_device_adc, |
223 | &s3c_device_cfcon, | 185 | &s3c_device_cfcon, |
@@ -239,8 +201,6 @@ static struct platform_device *smdkc100_devices[] __initdata = { | |||
239 | &s5p_device_fimc1, | 201 | &s5p_device_fimc1, |
240 | &s5p_device_fimc2, | 202 | &s5p_device_fimc2, |
241 | &s5pc100_device_spdif, | 203 | &s5pc100_device_spdif, |
242 | &s3c_device_timer[0], | ||
243 | &smdkc100_backlight_device, | ||
244 | }; | 204 | }; |
245 | 205 | ||
246 | static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { | 206 | static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { |
@@ -249,6 +209,16 @@ static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { | |||
249 | .oversampling_shift = 2, | 209 | .oversampling_shift = 2, |
250 | }; | 210 | }; |
251 | 211 | ||
212 | /* LCD Backlight data */ | ||
213 | static struct samsung_bl_gpio_info smdkc100_bl_gpio_info = { | ||
214 | .no = S5PC100_GPD(0), | ||
215 | .func = S3C_GPIO_SFN(2), | ||
216 | }; | ||
217 | |||
218 | static struct platform_pwm_backlight_data smdkc100_bl_data = { | ||
219 | .pwm_id = 0, | ||
220 | }; | ||
221 | |||
252 | static void __init smdkc100_map_io(void) | 222 | static void __init smdkc100_map_io(void) |
253 | { | 223 | { |
254 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | 224 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); |
@@ -276,6 +246,9 @@ static void __init smdkc100_machine_init(void) | |||
276 | /* LCD init */ | 246 | /* LCD init */ |
277 | gpio_request(S5PC100_GPH0(6), "GPH0"); | 247 | gpio_request(S5PC100_GPH0(6), "GPH0"); |
278 | smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0); | 248 | smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0); |
249 | |||
250 | samsung_bl_set(&smdkc100_bl_gpio_info, &smdkc100_bl_data); | ||
251 | |||
279 | platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices)); | 252 | platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices)); |
280 | } | 253 | } |
281 | 254 | ||