diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2010-09-03 03:20:27 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-09-14 04:23:26 -0400 |
commit | 1c120deb60edd4c19a2109daa98f65f2ad3b9c06 (patch) | |
tree | 6aa09f9a016d229c512e118ddd0157f77e68af20 /drivers/video/sh_mobile_lcdcfb.c | |
parent | 6de9edd5bde0cdfea12e9948690e53ec669c3018 (diff) |
fbdev: sh_mobile_lcdcfb: separate display variable data from framebuffer data
This is a preparation for a patch, that shall allow displaying of a smaller
framebuffer on a bigger display and of a part of a bigger framebuffer on a
smaller display.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/video/sh_mobile_lcdcfb.c')
-rw-r--r-- | drivers/video/sh_mobile_lcdcfb.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 29d7ce7e7a1c..946a810801af 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -384,8 +384,8 @@ static void sh_mobile_lcdc_start_stop(struct sh_mobile_lcdc_priv *priv, | |||
384 | 384 | ||
385 | static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch) | 385 | static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch) |
386 | { | 386 | { |
387 | struct fb_var_screeninfo *var = &ch->info->var; | 387 | struct fb_var_screeninfo *var = &ch->info->var, *display_var = &ch->display_var; |
388 | unsigned long h_total, hsync_pos; | 388 | unsigned long h_total, hsync_pos, display_h_total; |
389 | u32 tmp; | 389 | u32 tmp; |
390 | 390 | ||
391 | tmp = ch->ldmt1r_value; | 391 | tmp = ch->ldmt1r_value; |
@@ -403,31 +403,33 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch) | |||
403 | lcdc_write_chan(ch, LDMT3R, ch->cfg.sys_bus_cfg.ldmt3r); | 403 | lcdc_write_chan(ch, LDMT3R, ch->cfg.sys_bus_cfg.ldmt3r); |
404 | 404 | ||
405 | /* horizontal configuration */ | 405 | /* horizontal configuration */ |
406 | h_total = var->xres + var->hsync_len + | 406 | h_total = display_var->xres + display_var->hsync_len + |
407 | var->left_margin + var->right_margin; | 407 | display_var->left_margin + display_var->right_margin; |
408 | tmp = h_total / 8; /* HTCN */ | 408 | tmp = h_total / 8; /* HTCN */ |
409 | tmp |= (var->xres / 8) << 16; /* HDCN */ | 409 | tmp |= (min(display_var->xres, var->xres) / 8) << 16; /* HDCN */ |
410 | lcdc_write_chan(ch, LDHCNR, tmp); | 410 | lcdc_write_chan(ch, LDHCNR, tmp); |
411 | 411 | ||
412 | hsync_pos = var->xres + var->right_margin; | 412 | hsync_pos = display_var->xres + display_var->right_margin; |
413 | tmp = hsync_pos / 8; /* HSYNP */ | 413 | tmp = hsync_pos / 8; /* HSYNP */ |
414 | tmp |= (var->hsync_len / 8) << 16; /* HSYNW */ | 414 | tmp |= (display_var->hsync_len / 8) << 16; /* HSYNW */ |
415 | lcdc_write_chan(ch, LDHSYNR, tmp); | 415 | lcdc_write_chan(ch, LDHSYNR, tmp); |
416 | 416 | ||
417 | /* vertical configuration */ | 417 | /* vertical configuration */ |
418 | tmp = var->yres + var->vsync_len + | 418 | tmp = display_var->yres + display_var->vsync_len + |
419 | var->upper_margin + var->lower_margin; /* VTLN */ | 419 | display_var->upper_margin + display_var->lower_margin; /* VTLN */ |
420 | tmp |= var->yres << 16; /* VDLN */ | 420 | tmp |= min(display_var->yres, var->yres) << 16; /* VDLN */ |
421 | lcdc_write_chan(ch, LDVLNR, tmp); | 421 | lcdc_write_chan(ch, LDVLNR, tmp); |
422 | 422 | ||
423 | tmp = var->yres + var->lower_margin; /* VSYNP */ | 423 | tmp = display_var->yres + display_var->lower_margin; /* VSYNP */ |
424 | tmp |= var->vsync_len << 16; /* VSYNW */ | 424 | tmp |= display_var->vsync_len << 16; /* VSYNW */ |
425 | lcdc_write_chan(ch, LDVSYNR, tmp); | 425 | lcdc_write_chan(ch, LDVSYNR, tmp); |
426 | 426 | ||
427 | /* Adjust horizontal synchronisation for HDMI */ | 427 | /* Adjust horizontal synchronisation for HDMI */ |
428 | tmp = ((var->xres & 7) << 24) | | 428 | display_h_total = display_var->xres + display_var->hsync_len + |
429 | ((h_total & 7) << 16) | | 429 | display_var->left_margin + display_var->right_margin; |
430 | ((var->hsync_len & 7) << 8) | | 430 | tmp = ((display_var->xres & 7) << 24) | |
431 | ((display_h_total & 7) << 16) | | ||
432 | ((display_var->hsync_len & 7) << 8) | | ||
431 | hsync_pos; | 433 | hsync_pos; |
432 | lcdc_write_chan(ch, LDHAJR, tmp); | 434 | lcdc_write_chan(ch, LDHAJR, tmp); |
433 | } | 435 | } |
@@ -477,7 +479,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
477 | m = 1 << 6; | 479 | m = 1 << 6; |
478 | tmp |= m << (lcdc_chan_is_sublcd(ch) ? 8 : 0); | 480 | tmp |= m << (lcdc_chan_is_sublcd(ch) ? 8 : 0); |
479 | 481 | ||
480 | lcdc_write_chan(ch, LDDCKPAT1R, 0x00000000); | 482 | lcdc_write_chan(ch, LDDCKPAT1R, 0); |
481 | lcdc_write_chan(ch, LDDCKPAT2R, (1 << (m/2)) - 1); | 483 | lcdc_write_chan(ch, LDDCKPAT2R, (1 << (m/2)) - 1); |
482 | } | 484 | } |
483 | 485 | ||
@@ -520,7 +522,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
520 | 522 | ||
521 | /* set bpp format in PKF[4:0] */ | 523 | /* set bpp format in PKF[4:0] */ |
522 | tmp = lcdc_read_chan(ch, LDDFR); | 524 | tmp = lcdc_read_chan(ch, LDDFR); |
523 | tmp &= ~(0x0001001f); | 525 | tmp &= ~0x0001001f; |
524 | tmp |= (ch->info->var.bits_per_pixel == 16) ? 3 : 0; | 526 | tmp |= (ch->info->var.bits_per_pixel == 16) ? 3 : 0; |
525 | lcdc_write_chan(ch, LDDFR, tmp); | 527 | lcdc_write_chan(ch, LDDFR, tmp); |
526 | 528 | ||
@@ -1153,6 +1155,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
1153 | info->screen_base = buf; | 1155 | info->screen_base = buf; |
1154 | info->device = &pdev->dev; | 1156 | info->device = &pdev->dev; |
1155 | info->par = ch; | 1157 | info->par = ch; |
1158 | ch->display_var = *var; | ||
1156 | } | 1159 | } |
1157 | 1160 | ||
1158 | if (error) | 1161 | if (error) |