aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2009-03-31 18:25:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 11:59:29 -0400
commit8636a9240cc93efa6b36f4cfe6253e0574f832c6 (patch)
tree6da421c57645ac1459bee8011bc42cd228849317
parent4242a23c9e6b8e2462bb49bf78b76bfdf32158b5 (diff)
cirrusfb: fix interlaced modes
Fix calculations of timings for interlaced modes. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/cirrusfb.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index 9bb811d56721..d42e385f091c 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -701,45 +701,52 @@ static int cirrusfb_set_par_foo(struct fb_info *info)
701 701
702 hsyncstart = var->xres + var->right_margin; 702 hsyncstart = var->xres + var->right_margin;
703 hsyncend = hsyncstart + var->hsync_len; 703 hsyncend = hsyncstart + var->hsync_len;
704 htotal = (hsyncend + var->left_margin) / 8 - 5; 704 htotal = (hsyncend + var->left_margin) / 8;
705 hdispend = var->xres / 8 - 1; 705 hdispend = var->xres / 8;
706 hsyncstart = hsyncstart / 8 + 1; 706 hsyncstart = hsyncstart / 8;
707 hsyncend = hsyncend / 8 + 1; 707 hsyncend = hsyncend / 8;
708 708
709 yres = var->yres; 709 vdispend = var->yres;
710 vsyncstart = yres + var->lower_margin; 710 vsyncstart = vdispend + var->lower_margin;
711 vsyncend = vsyncstart + var->vsync_len; 711 vsyncend = vsyncstart + var->vsync_len;
712 vtotal = vsyncend + var->upper_margin; 712 vtotal = vsyncend + var->upper_margin;
713 vdispend = yres - 1;
714 713
715 if (var->vmode & FB_VMODE_DOUBLE) { 714 if (var->vmode & FB_VMODE_DOUBLE) {
716 yres *= 2; 715 vdispend *= 2;
717 vsyncstart *= 2; 716 vsyncstart *= 2;
718 vsyncend *= 2; 717 vsyncend *= 2;
719 vtotal *= 2; 718 vtotal *= 2;
720 } else if (var->vmode & FB_VMODE_INTERLACED) { 719 } else if (var->vmode & FB_VMODE_INTERLACED) {
721 yres = (yres + 1) / 2; 720 vdispend = (vdispend + 1) / 2;
722 vsyncstart = (vsyncstart + 1) / 2; 721 vsyncstart = (vsyncstart + 1) / 2;
723 vsyncend = (vsyncend + 1) / 2; 722 vsyncend = (vsyncend + 1) / 2;
724 vtotal = (vtotal + 1) / 2; 723 vtotal = (vtotal + 1) / 2;
725 } 724 }
726 725 yres = vdispend;
727 vtotal -= 2;
728 vsyncstart -= 1;
729 vsyncend -= 1;
730
731 if (yres >= 1024) { 726 if (yres >= 1024) {
732 vtotal /= 2; 727 vtotal /= 2;
733 vsyncstart /= 2; 728 vsyncstart /= 2;
734 vsyncend /= 2; 729 vsyncend /= 2;
735 vdispend /= 2; 730 vdispend /= 2;
736 } 731 }
732
733 vdispend -= 1;
734 vsyncstart -= 1;
735 vsyncend -= 1;
736 vtotal -= 2;
737
737 if (cinfo->multiplexing) { 738 if (cinfo->multiplexing) {
738 htotal /= 2; 739 htotal /= 2;
739 hsyncstart /= 2; 740 hsyncstart /= 2;
740 hsyncend /= 2; 741 hsyncend /= 2;
741 hdispend /= 2; 742 hdispend /= 2;
742 } 743 }
744
745 htotal -= 5;
746 hdispend -= 1;
747 hsyncstart += 1;
748 hsyncend += 1;
749
743 /* unlock register VGA_CRTC_H_TOTAL..CRT7 */ 750 /* unlock register VGA_CRTC_H_TOTAL..CRT7 */
744 vga_wcrt(regbase, VGA_CRTC_V_SYNC_END, 0x20); /* previously: 0x00) */ 751 vga_wcrt(regbase, VGA_CRTC_V_SYNC_END, 0x20); /* previously: 0x00) */
745 752