Commit 93d11f5a authored by Krzysztof Helt's avatar Krzysztof Helt Committed by Linus Torvalds

s3c2410fb: add pulse length fields to s3c2410fb_display

This patch adds synchronization pulse lenght fields to
the s3c2410fb_display structure and makes use of them
in the driver.
Signed-off-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: default avatarAntonino Daplas <adaplas@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3c9ffd05
...@@ -179,6 +179,7 @@ static struct s3c2410fb_display __initdata amlm5900_lcd_info = { ...@@ -179,6 +179,7 @@ static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
.bpp = 4, .bpp = 4,
.left_margin = 1 << (4 + 3), .left_margin = 1 << (4 + 3),
.right_margin = 8 << 3, .right_margin = 8 << 3,
.hsync_len = 48,
.upper_margin = 0, .upper_margin = 0,
.lower_margin = 0, .lower_margin = 0,
......
...@@ -477,8 +477,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = { ...@@ -477,8 +477,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = {
.yres = 240, .yres = 240,
.left_margin = 40, .left_margin = 40,
.right_margin = 20, .right_margin = 20,
.hsync_len = 88,
.upper_margin = 30, .upper_margin = 30,
.lower_margin = 32, .lower_margin = 32,
.vsync_len = 3,
.bpp = 4, .bpp = 4,
...@@ -497,8 +499,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = { ...@@ -497,8 +499,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = {
.bpp = 4, .bpp = 4,
.left_margin = 40, .left_margin = 40,
.right_margin = 20, .right_margin = 20,
.hsync_len = 88,
.upper_margin = 30, .upper_margin = 30,
.lower_margin = 32, .lower_margin = 32,
.vsync_len = 3,
.lcdcon1 = 0x00000176, .lcdcon1 = 0x00000176,
.lcdcon2 = 0x1d77c7c2, .lcdcon2 = 0x1d77c7c2,
...@@ -515,8 +519,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = { ...@@ -515,8 +519,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = {
.bpp = 4, .bpp = 4,
.left_margin = 40, .left_margin = 40,
.right_margin = 20, .right_margin = 20,
.hsync_len = 88,
.upper_margin = 30, .upper_margin = 30,
.lower_margin = 32, .lower_margin = 32,
.vsync_len = 3,
.lcdcon1 = 0x00000176, .lcdcon1 = 0x00000176,
.lcdcon2 = 0x1d77c7c2, .lcdcon2 = 0x1d77c7c2,
...@@ -533,8 +539,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = { ...@@ -533,8 +539,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = {
.bpp = 8, .bpp = 8,
.left_margin = 40, .left_margin = 40,
.right_margin = 20, .right_margin = 20,
.hsync_len = 88,
.upper_margin = 30, .upper_margin = 30,
.lower_margin = 32, .lower_margin = 32,
.vsync_len = 3,
.lcdcon1 = 0x00000176, .lcdcon1 = 0x00000176,
.lcdcon2 = 0x1d77c7c2, .lcdcon2 = 0x1d77c7c2,
...@@ -551,8 +559,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = { ...@@ -551,8 +559,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = {
.bpp = 8, .bpp = 8,
.left_margin = 40, .left_margin = 40,
.right_margin = 20, .right_margin = 20,
.hsync_len = 88,
.upper_margin = 30, .upper_margin = 30,
.lower_margin = 32, .lower_margin = 32,
.vsync_len = 3,
.lcdcon1 = 0x00000176, .lcdcon1 = 0x00000176,
.lcdcon2 = 0x1d77c7c2, .lcdcon2 = 0x1d77c7c2,
...@@ -569,8 +579,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = { ...@@ -569,8 +579,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = {
.bpp = 8, .bpp = 8,
.left_margin = 40, .left_margin = 40,
.right_margin = 20, .right_margin = 20,
.hsync_len = 88,
.upper_margin = 30, .upper_margin = 30,
.lower_margin = 32, .lower_margin = 32,
.vsync_len = 3,
.lcdcon1 = 0x00000176, .lcdcon1 = 0x00000176,
.lcdcon2 = 0x1d77c7c2, .lcdcon2 = 0x1d77c7c2,
...@@ -587,8 +599,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = { ...@@ -587,8 +599,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = {
.bpp = 16, .bpp = 16,
.left_margin = 40, .left_margin = 40,
.right_margin = 20, .right_margin = 20,
.hsync_len = 88,
.upper_margin = 30, .upper_margin = 30,
.lower_margin = 32, .lower_margin = 32,
.vsync_len = 3,
.lcdcon1 = 0x00000176, .lcdcon1 = 0x00000176,
.lcdcon2 = 0x1d77c7c2, .lcdcon2 = 0x1d77c7c2,
...@@ -605,8 +619,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = { ...@@ -605,8 +619,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = {
.bpp = 16, .bpp = 16,
.left_margin = 40, .left_margin = 40,
.right_margin = 20, .right_margin = 20,
.hsync_len = 88,
.upper_margin = 30, .upper_margin = 30,
.lower_margin = 32, .lower_margin = 32,
.vsync_len = 3,
.lcdcon1 = 0x00000176, .lcdcon1 = 0x00000176,
.lcdcon2 = 0x1d77c7c2, .lcdcon2 = 0x1d77c7c2,
...@@ -623,8 +639,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = { ...@@ -623,8 +639,10 @@ static struct s3c2410fb_display __initdata bast_lcd_info[] = {
.bpp = 16, .bpp = 16,
.left_margin = 40, .left_margin = 40,
.right_margin = 20, .right_margin = 20,
.hsync_len = 88,
.upper_margin = 30, .upper_margin = 30,
.lower_margin = 32, .lower_margin = 32,
.vsync_len = 3,
.lcdcon1 = 0x00000176, .lcdcon1 = 0x00000176,
.lcdcon2 = 0x1d77c7c2, .lcdcon2 = 0x1d77c7c2,
......
...@@ -158,8 +158,10 @@ static struct s3c2410fb_display h1940_lcd __initdata = { ...@@ -158,8 +158,10 @@ static struct s3c2410fb_display h1940_lcd __initdata = {
.bpp = 16, .bpp = 16,
.left_margin = 20, .left_margin = 20,
.right_margin = 8, .right_margin = 8,
.hsync_len = 4,
.upper_margin = 8, .upper_margin = 8,
.lower_margin = 7, .lower_margin = 7,
.vsync_len = 1,
}; };
static struct s3c2410fb_mach_info h1940_fb_info __initdata = { static struct s3c2410fb_mach_info h1940_fb_info __initdata = {
......
...@@ -125,8 +125,10 @@ static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = { ...@@ -125,8 +125,10 @@ static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
.bpp = 16, .bpp = 16,
.left_margin = 44, .left_margin = 44,
.right_margin = 116, .right_margin = 116,
.hsync_len = 96,
.upper_margin = 19, .upper_margin = 19,
.lower_margin = 11, .lower_margin = 11,
.vsync_len = 15,
}, },
{ {
/* Configuration for 480x640 toppoly TD028TTEC1 */ /* Configuration for 480x640 toppoly TD028TTEC1 */
...@@ -156,8 +158,10 @@ static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = { ...@@ -156,8 +158,10 @@ static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
.bpp = 16, .bpp = 16,
.left_margin = 8, .left_margin = 8,
.right_margin = 24, .right_margin = 24,
.hsync_len = 8,
.upper_margin = 2, .upper_margin = 2,
.lower_margin = 4, .lower_margin = 4,
.vsync_len = 2,
}, },
{ {
/* Config for 240x320 LCD */ /* Config for 240x320 LCD */
...@@ -187,8 +191,10 @@ static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = { ...@@ -187,8 +191,10 @@ static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
.bpp = 16, .bpp = 16,
.left_margin = 13, .left_margin = 13,
.right_margin = 8, .right_margin = 8,
.hsync_len = 4,
.upper_margin = 2, .upper_margin = 2,
.lower_margin = 7, .lower_margin = 7,
.vsync_len = 4,
}, },
}; };
......
...@@ -136,8 +136,10 @@ static struct s3c2410fb_display rx3715_lcdcfg __initdata = { ...@@ -136,8 +136,10 @@ static struct s3c2410fb_display rx3715_lcdcfg __initdata = {
.bpp = 16, .bpp = 16,
.left_margin = 36, .left_margin = 36,
.right_margin = 36, .right_margin = 36,
.hsync_len = 8,
.upper_margin = 6, .upper_margin = 6,
.lower_margin = 7, .lower_margin = 7,
.vsync_len = 3,
}; };
static struct s3c2410fb_mach_info rx3715_fb_info __initdata = { static struct s3c2410fb_mach_info rx3715_fb_info __initdata = {
......
...@@ -133,8 +133,10 @@ static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = { ...@@ -133,8 +133,10 @@ static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {
.bpp = 16, .bpp = 16,
.left_margin = 20, .left_margin = 20,
.right_margin = 8, .right_margin = 8,
.hsync_len = 4,
.upper_margin = 8, .upper_margin = 8,
.lower_margin = 7, .lower_margin = 7,
.vsync_len = 4,
}; };
static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = { static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
......
...@@ -290,6 +290,7 @@ static void s3c2410fb_calculate_stn_lcd_regs(const struct fb_info *info, ...@@ -290,6 +290,7 @@ static void s3c2410fb_calculate_stn_lcd_regs(const struct fb_info *info,
int type = regs->lcdcon1 & ~S3C2410_LCDCON1_TFT; int type = regs->lcdcon1 & ~S3C2410_LCDCON1_TFT;
int hs = var->xres >> 2; int hs = var->xres >> 2;
unsigned wdly = (var->left_margin >> 4) - 1; unsigned wdly = (var->left_margin >> 4) - 1;
unsigned wlh = (var->hsync_len >> 4) - 1;
dprintk("%s: var->xres = %d\n", __FUNCTION__, var->xres); dprintk("%s: var->xres = %d\n", __FUNCTION__, var->xres);
dprintk("%s: var->yres = %d\n", __FUNCTION__, var->yres); dprintk("%s: var->yres = %d\n", __FUNCTION__, var->yres);
...@@ -333,9 +334,15 @@ static void s3c2410fb_calculate_stn_lcd_regs(const struct fb_info *info, ...@@ -333,9 +334,15 @@ static void s3c2410fb_calculate_stn_lcd_regs(const struct fb_info *info,
if (wdly > 3) if (wdly > 3)
wdly = 3; wdly = 3;
if (wlh > 3)
wlh = 3;
regs->lcdcon3 = S3C2410_LCDCON3_WDLY(wdly) | regs->lcdcon3 = S3C2410_LCDCON3_WDLY(wdly) |
S3C2410_LCDCON3_LINEBLANK(var->right_margin / 8) | S3C2410_LCDCON3_LINEBLANK(var->right_margin / 8) |
S3C2410_LCDCON3_HOZVAL(hs - 1); S3C2410_LCDCON3_HOZVAL(hs - 1);
regs->lcdcon4 &= ~S3C2410_LCDCON4_HSPW(0xff);
regs->lcdcon4 |= S3C2410_LCDCON4_HSPW(wlh);
} }
/* s3c2410fb_calculate_tft_lcd_regs /* s3c2410fb_calculate_tft_lcd_regs
...@@ -383,14 +390,17 @@ static void s3c2410fb_calculate_tft_lcd_regs(const struct fb_info *info, ...@@ -383,14 +390,17 @@ static void s3c2410fb_calculate_tft_lcd_regs(const struct fb_info *info,
dprintk("setting horz: lft=%d, rt=%d, sync=%d\n", dprintk("setting horz: lft=%d, rt=%d, sync=%d\n",
var->left_margin, var->right_margin, var->hsync_len); var->left_margin, var->right_margin, var->hsync_len);
regs->lcdcon2 &= S3C2410_LCDCON2_VSPW(0x3f); regs->lcdcon2 = S3C2410_LCDCON2_LINEVAL(var->yres - 1) |
regs->lcdcon2 |= S3C2410_LCDCON2_LINEVAL(var->yres - 1); S3C2410_LCDCON2_VBPD(var->upper_margin - 1) |
regs->lcdcon2 |= S3C2410_LCDCON2_VBPD(var->upper_margin - 1); S3C2410_LCDCON2_VFPD(var->lower_margin - 1) |
regs->lcdcon2 |= S3C2410_LCDCON2_VFPD(var->lower_margin - 1); S3C2410_LCDCON2_VSPW(var->vsync_len - 1);
regs->lcdcon3 = S3C2410_LCDCON3_HBPD(var->right_margin - 1) | regs->lcdcon3 = S3C2410_LCDCON3_HBPD(var->right_margin - 1) |
S3C2410_LCDCON3_HFPD(var->left_margin - 1) | S3C2410_LCDCON3_HFPD(var->left_margin - 1) |
S3C2410_LCDCON3_HOZVAL(var->xres - 1); S3C2410_LCDCON3_HOZVAL(var->xres - 1);
regs->lcdcon4 &= ~S3C2410_LCDCON4_HSPW(0xff);
regs->lcdcon4 |= S3C2410_LCDCON4_HSPW(var->hsync_len - 1);
} }
/* s3c2410fb_activate_var /* s3c2410fb_activate_var
...@@ -410,16 +420,6 @@ static void s3c2410fb_activate_var(struct fb_info *info) ...@@ -410,16 +420,6 @@ static void s3c2410fb_activate_var(struct fb_info *info)
fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_TFT; fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_TFT;
fbi->regs.lcdcon1 |= display->type; fbi->regs.lcdcon1 |= display->type;
/* check to see if we need to update sync/borders */
if (!mach_info->fixed_syncs) {
fbi->regs.lcdcon2 =
S3C2410_LCDCON2_VSPW(var->vsync_len - 1);
fbi->regs.lcdcon4 &= ~S3C2410_LCDCON4_HSPW(0xff);
fbi->regs.lcdcon4 |= S3C2410_LCDCON4_HSPW(var->hsync_len - 1);
}
if (var->pixclock > 0) { if (var->pixclock > 0) {
int clkdiv = s3c2410fb_calc_pixclk(fbi, var->pixclock); int clkdiv = s3c2410fb_calc_pixclk(fbi, var->pixclock);
...@@ -890,10 +890,8 @@ static int __init s3c2410fb_probe(struct platform_device *pdev) ...@@ -890,10 +890,8 @@ static int __init s3c2410fb_probe(struct platform_device *pdev)
fbinfo->var.upper_margin = display->upper_margin; fbinfo->var.upper_margin = display->upper_margin;
fbinfo->var.lower_margin = display->lower_margin; fbinfo->var.lower_margin = display->lower_margin;
fbinfo->var.vsync_len = fbinfo->var.vsync_len = display->vsync_len;
S3C2410_LCDCON2_GET_VSPW(display->lcdcon2) + 1; fbinfo->var.hsync_len = display->hsync_len;
fbinfo->var.hsync_len =
S3C2410_LCDCON4_GET_HSPW(display->lcdcon4) + 1;
fbinfo->var.red.offset = 11; fbinfo->var.red.offset = 11;
fbinfo->var.green.offset = 5; fbinfo->var.green.offset = 5;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment