aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2010-09-03 03:20:27 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-09-14 04:23:26 -0400
commit1c120deb60edd4c19a2109daa98f65f2ad3b9c06 (patch)
tree6aa09f9a016d229c512e118ddd0157f77e68af20 /drivers/video
parent6de9edd5bde0cdfea12e9948690e53ec669c3018 (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')
-rw-r--r--drivers/video/sh_mobile_hdmi.c8
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c37
-rw-r--r--drivers/video/sh_mobile_lcdcfb.h1
3 files changed, 27 insertions, 19 deletions
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
index 56e44fd0a3af..51ce34990e24 100644
--- a/drivers/video/sh_mobile_hdmi.c
+++ b/drivers/video/sh_mobile_hdmi.c
@@ -732,6 +732,7 @@ static void hdmi_display_on(void *arg, struct fb_info *info)
732 */ 732 */
733 struct sh_hdmi *hdmi = arg; 733 struct sh_hdmi *hdmi = arg;
734 struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data; 734 struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
735 struct sh_mobile_lcdc_chan *ch = info->par;
735 736
736 pr_debug("%s(%p): state %x\n", __func__, pdata->lcd_dev, info->state); 737 pr_debug("%s(%p): state %x\n", __func__, pdata->lcd_dev, info->state);
737 738
@@ -747,7 +748,7 @@ static void hdmi_display_on(void *arg, struct fb_info *info)
747 case HDMI_HOTPLUG_DISCONNECTED: 748 case HDMI_HOTPLUG_DISCONNECTED:
748 info->state = FBINFO_STATE_SUSPENDED; 749 info->state = FBINFO_STATE_SUSPENDED;
749 default: 750 default:
750 hdmi->var = info->var; 751 hdmi->var = ch->display_var;
751 } 752 }
752} 753}
753 754
@@ -767,6 +768,7 @@ static void edid_work_fn(struct work_struct *work)
767{ 768{
768 struct sh_hdmi *hdmi = container_of(work, struct sh_hdmi, edid_work.work); 769 struct sh_hdmi *hdmi = container_of(work, struct sh_hdmi, edid_work.work);
769 struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data; 770 struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
771 struct sh_mobile_lcdc_chan *ch;
770 772
771 pr_debug("%s(%p): begin, hotplug status %d\n", __func__, 773 pr_debug("%s(%p): begin, hotplug status %d\n", __func__,
772 pdata->lcd_dev, hdmi->hp_state); 774 pdata->lcd_dev, hdmi->hp_state);
@@ -788,10 +790,12 @@ static void edid_work_fn(struct work_struct *work)
788 if (!hdmi->info) 790 if (!hdmi->info)
789 goto out; 791 goto out;
790 792
793 ch = hdmi->info->par;
794
791 acquire_console_sem(); 795 acquire_console_sem();
792 796
793 /* HDMI plug in */ 797 /* HDMI plug in */
794 hdmi->info->var = hdmi->var; 798 ch->display_var = hdmi->var;
795 if (hdmi->info->state != FBINFO_STATE_RUNNING) { 799 if (hdmi->info->state != FBINFO_STATE_RUNNING) {
796 fb_set_suspend(hdmi->info, 0); 800 fb_set_suspend(hdmi->info, 0);
797 } else { 801 } else {
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
385static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch) 385static 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)
diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
index 6fcfc0ffe3f8..dfd3d766a556 100644
--- a/drivers/video/sh_mobile_lcdcfb.h
+++ b/drivers/video/sh_mobile_lcdcfb.h
@@ -32,6 +32,7 @@ struct sh_mobile_lcdc_chan {
32 unsigned long pan_offset; 32 unsigned long pan_offset;
33 wait_queue_head_t frame_end_wait; 33 wait_queue_head_t frame_end_wait;
34 struct completion vsync_completion; 34 struct completion vsync_completion;
35 struct fb_var_screeninfo display_var;
35}; 36};
36 37
37#endif 38#endif