aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorarnaud.patard@rtp-net.org <arnaud.patard@rtp-net.org>2009-11-17 08:54:58 -0500
committerBen Dooks <ben-linux@fluff.org>2009-11-30 20:35:05 -0500
commit22e649ff2e162d3c6ce2a78c377863aab826a8b8 (patch)
treed24465a9687684b302e8608093b74d4f9013cf20 /arch
parent13733d524daadb6127b24b8672a9d47639bf1edf (diff)
ARM: H1940: add lcd/backlight device definition
Add lcd and backlight device definition. The pwm backlight stuff does not allow to really set maximum pwm as with my custom driver but it's better to use standard driver instead of out of tree driver. Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org> [ben-linux@fluff.org: tidy header] Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 02375ca09497..49053254c98d 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -22,6 +22,8 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/pwm_backlight.h>
26#include <video/platform_lcd.h>
25 27
26#include <linux/mmc/host.h> 28#include <linux/mmc/host.h>
27 29
@@ -195,6 +197,73 @@ static struct s3c24xx_mci_pdata h1940_mmc_cfg = {
195 .ocr_avail = MMC_VDD_32_33, 197 .ocr_avail = MMC_VDD_32_33,
196}; 198};
197 199
200static int h1940_backlight_init(struct device *dev)
201{
202 gpio_request(S3C2410_GPB(0), "Backlight");
203
204 s3c2410_gpio_setpin(S3C2410_GPB(0), 0);
205 s3c2410_gpio_pullup(S3C2410_GPB(0), 0);
206 s3c2410_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
207
208 return 0;
209}
210
211static void h1940_backlight_exit(struct device *dev)
212{
213 s3c2410_gpio_cfgpin(S3C2410_GPB(0), 1/*S3C2410_GPB0_OUTP*/);
214}
215
216static struct platform_pwm_backlight_data backlight_data = {
217 .pwm_id = 0,
218 .max_brightness = 100,
219 .dft_brightness = 50,
220 /* tcnt = 0x31 */
221 .pwm_period_ns = 36296,
222 .init = h1940_backlight_init,
223 .exit = h1940_backlight_exit,
224};
225
226static struct platform_device h1940_backlight = {
227 .name = "pwm-backlight",
228 .dev = {
229 .parent = &s3c_device_timer[0].dev,
230 .platform_data = &backlight_data,
231 },
232 .id = -1,
233};
234
235static void h1940_lcd_power_set(struct plat_lcd_data *pd,
236 unsigned int power)
237{
238 int value;
239
240 if (!power) {
241 /* set to 3ec */
242 s3c2410_gpio_setpin(S3C2410_GPC(0), 0);
243 /* wait for 3ac */
244 do {
245 value = s3c2410_gpio_getpin(S3C2410_GPC(6));
246 } while (value);
247 /* set to 38c */
248 s3c2410_gpio_setpin(S3C2410_GPC(5), 0);
249 } else {
250 /* Set to 3ac */
251 s3c2410_gpio_setpin(S3C2410_GPC(5), 1);
252 /* Set to 3ad */
253 s3c2410_gpio_setpin(S3C2410_GPC(0), 1);
254 }
255}
256
257static struct plat_lcd_data h1940_lcd_power_data = {
258 .set_power = h1940_lcd_power_set,
259};
260
261static struct platform_device h1940_lcd_powerdev = {
262 .name = "platform-lcd",
263 .dev.parent = &s3c_device_lcd.dev,
264 .dev.platform_data = &h1940_lcd_power_data,
265};
266
198static struct platform_device *h1940_devices[] __initdata = { 267static struct platform_device *h1940_devices[] __initdata = {
199 &s3c_device_usb, 268 &s3c_device_usb,
200 &s3c_device_lcd, 269 &s3c_device_lcd,
@@ -206,6 +275,9 @@ static struct platform_device *h1940_devices[] __initdata = {
206 &h1940_device_bluetooth, 275 &h1940_device_bluetooth,
207 &s3c_device_sdi, 276 &s3c_device_sdi,
208 &s3c_device_rtc, 277 &s3c_device_rtc,
278 &s3c_device_timer[0],
279 &h1940_backlight,
280 &h1940_lcd_powerdev,
209}; 281};
210 282
211static void __init h1940_map_io(void) 283static void __init h1940_map_io(void)
@@ -249,6 +321,11 @@ static void __init h1940_init(void)
249 | (0x03 << S3C24XX_PLLCON_SDIVSHIFT); 321 | (0x03 << S3C24XX_PLLCON_SDIVSHIFT);
250 writel(tmp, S3C2410_UPLLCON); 322 writel(tmp, S3C2410_UPLLCON);
251 323
324 gpio_request(S3C2410_GPC(0), "LCD power");
325 gpio_request(S3C2410_GPC(5), "LCD power");
326 gpio_request(S3C2410_GPC(6), "LCD power");
327
328
252 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices)); 329 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
253} 330}
254 331