diff options
author | Andy Green <andy@openmoko.com> | 2008-11-21 11:56:56 +0000 |
---|---|---|
committer | Andy Green <agreen@pads.home.warmcat.com> | 2008-11-21 11:56:56 +0000 |
commit | b6181861b49f18e69a068d060e0832b3c0062a12 (patch) | |
tree | c2fdf7eae7182e738a5da9703c22b07b116d6c60 | |
parent | caec62fed51eb73445fd7965f6bba09086ae52a7 (diff) |
add-gta03-framebuffer-init.patch
Signed-off-by: Andy Green <andy@openmoko.com>
-rw-r--r-- | arch/arm/mach-s3c6410/mach-om-gta03.c | 78 |
1 files changed, 76 insertions, 2 deletions
diff --git a/arch/arm/mach-s3c6410/mach-om-gta03.c b/arch/arm/mach-s3c6410/mach-om-gta03.c index 79f72635c08..a9aca2aab2a 100644 --- a/arch/arm/mach-s3c6410/mach-om-gta03.c +++ b/arch/arm/mach-s3c6410/mach-om-gta03.c @@ -1,9 +1,9 @@ -/* linux/arch/arm/mach-s3c6410/mach-smdk6410.c +/* linux/arch/arm/mach-s3c6410/mach-om_gta03.c * * Copyright 2008 Openmoko, Inc. * Andy Green <andy@openmoko.org> * - * based on mach_smdk6410.c which is + * based on mach_om_gta03.c which is * * Copyright 2008 Openmoko, Inc. * Copyright 2008 Simtec Electronics @@ -25,6 +25,11 @@ #include <linux/serial_core.h> #include <linux/platform_device.h> #include <linux/io.h> +#include <linux/i2c.h> +#include <linux/fb.h> +#include <linux/delay.h> + +#include <video/platform_lcd.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> @@ -32,12 +37,15 @@ #include <mach/hardware.h> #include <mach/map.h> +#include <mach/regs-fb.h> #include <asm/irq.h> #include <asm/mach-types.h> #include <plat/regs-serial.h> #include <plat/iic.h> +#include <plat/fb.h> + #include <plat/s3c6410.h> #include <plat/clock.h> @@ -88,6 +96,68 @@ static struct s3c2410_uartcfg om_gta03_uartcfgs[] __initdata = { }, }; +/* framebuffer and LCD setup. */ + +/* GPF15 = LCD backlight control + * GPF13 => Panel power + * GPN5 = LCD nRESET signal + * PWM_TOUT1 => backlight brightness + */ + +static void om_gta03_lcd_power_set(struct plat_lcd_data *pd, + unsigned int power) +{ + if (power) { + gpio_direction_output(S3C64XX_GPF(13), 1); + gpio_direction_output(S3C64XX_GPF(15), 1); + + /* fire nRESET on power up */ + gpio_direction_output(S3C64XX_GPN(5), 0); + msleep(10); + gpio_direction_output(S3C64XX_GPN(5), 1); + msleep(1); + } else { + gpio_direction_output(S3C64XX_GPF(15), 0); + gpio_direction_output(S3C64XX_GPF(13), 0); + } +} + +static struct plat_lcd_data om_gta03_lcd_power_data = { + .set_power = om_gta03_lcd_power_set, +}; + +static struct platform_device om_gta03_lcd_powerdev = { + .name = "platform-lcd", + .dev.parent = &s3c_device_fb.dev, + .dev.platform_data = &om_gta03_lcd_power_data, +}; + +static struct s3c_fb_pd_win om_gta03_fb_win0 = { + /* this is to ensure we use win0 */ + .win_mode = { + .pixclock = 41094, + .left_margin = 8, + .right_margin = 13, + .upper_margin = 7, + .lower_margin = 5, + .hsync_len = 3, + .vsync_len = 1, + .xres = 800, + .yres = 480, + }, + .max_bpp = 32, + .default_bpp = 16, +}; + +/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */ +static struct s3c_fb_platdata om_gta03_lcd_pdata __initdata = { + .setup_gpio = s3c64xx_fb_gpio_setup_24bpp, + .win[0] = &om_gta03_fb_win0, + .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, + .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, +}; + + struct map_desc om_gta03_6410_iodesc[] = {}; static struct resource om_gta03_button_resources[] = { @@ -381,6 +451,8 @@ static struct platform_device *om_gta03_devices[] __initdata = { &s3c_device_hsmmc0, &s3c_device_hsmmc1, &s3c_device_i2c0, + &s3c_device_fb, + &om_gta03_lcd_powerdev, &om_gta03_button_dev, }; @@ -396,6 +468,8 @@ static void __init om_gta03_map_io(void) static void __init om_gta03_machine_init(void) { s3c_i2c0_set_platdata(NULL); + s3c_fb_set_platdata(&om_gta03_lcd_pdata); + i2c_register_board_info(0, om_gta03_i2c_devs, ARRAY_SIZE(om_gta03_i2c_devs)); |