Commit 7f762d23 authored by Krzysztof Helt's avatar Krzysztof Helt Committed by Linus Torvalds

tridentfb: fix timing calculations

Fix broken timings calculations. This patch helps with following
problems:
 - no left part of screen visible (up to half of the screen)
 - monitor's frequencies are not the ones intended for selected modes
 - if mode with resoultion y > 1024 is selected at least once then
   all modes with y < 1024 are "out of sync" (no display)
Signed-off-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 10172ed6
...@@ -886,20 +886,19 @@ static int tridentfb_set_par(struct fb_info *info) ...@@ -886,20 +886,19 @@ static int tridentfb_set_par(struct fb_info *info)
debug("enter\n"); debug("enter\n");
hdispend = var->xres / 8 - 1; hdispend = var->xres / 8 - 1;
hsyncstart = (var->xres + var->right_margin) / 8; hsyncstart = (var->xres + var->right_margin) / 8 - 1;
hsyncend = var->hsync_len / 8; hsyncend = (var->xres + var->right_margin + var->hsync_len) / 8 - 1;
htotal = htotal = (var->xres + var->left_margin + var->right_margin +
(var->xres + var->left_margin + var->right_margin + var->hsync_len) / 8 - 5;
var->hsync_len) / 8 - 10; hblankstart = hdispend + 2;
hblankstart = hdispend + 1; hblankend = htotal + 3;
hblankend = htotal + 5;
vdispend = var->yres - 1; vdispend = var->yres - 1;
vsyncstart = var->yres + var->lower_margin; vsyncstart = var->yres + var->lower_margin;
vsyncend = var->vsync_len; vsyncend = vsyncstart + var->vsync_len;
vtotal = var->upper_margin + vsyncstart + vsyncend - 2; vtotal = var->upper_margin + vsyncend - 2;
vblankstart = var->yres; vblankstart = vdispend + 2;
vblankend = vtotal + 2; vblankend = vtotal;
crtc_unlock(par); crtc_unlock(par);
write3CE(par, CyberControl, 8); write3CE(par, CyberControl, 8);
...@@ -930,7 +929,7 @@ static int tridentfb_set_par(struct fb_info *info) ...@@ -930,7 +929,7 @@ static int tridentfb_set_par(struct fb_info *info)
write3X4(par, VGA_CRTC_V_SYNC_START, vsyncstart & 0xFF); write3X4(par, VGA_CRTC_V_SYNC_START, vsyncstart & 0xFF);
write3X4(par, VGA_CRTC_V_SYNC_END, (vsyncend & 0x0F)); write3X4(par, VGA_CRTC_V_SYNC_END, (vsyncend & 0x0F));
write3X4(par, VGA_CRTC_V_BLANK_START, vblankstart & 0xFF); write3X4(par, VGA_CRTC_V_BLANK_START, vblankstart & 0xFF);
write3X4(par, VGA_CRTC_V_BLANK_END, 0 /* p->vblankend & 0xFF */); write3X4(par, VGA_CRTC_V_BLANK_END, vblankend & 0xFF);
/* horizontal timing values */ /* horizontal timing values */
write3X4(par, VGA_CRTC_H_TOTAL, htotal & 0xFF); write3X4(par, VGA_CRTC_H_TOTAL, htotal & 0xFF);
...@@ -939,7 +938,7 @@ static int tridentfb_set_par(struct fb_info *info) ...@@ -939,7 +938,7 @@ static int tridentfb_set_par(struct fb_info *info)
write3X4(par, VGA_CRTC_H_SYNC_END, write3X4(par, VGA_CRTC_H_SYNC_END,
(hsyncend & 0x1F) | ((hblankend & 0x20) << 2)); (hsyncend & 0x1F) | ((hblankend & 0x20) << 2));
write3X4(par, VGA_CRTC_H_BLANK_START, hblankstart & 0xFF); write3X4(par, VGA_CRTC_H_BLANK_START, hblankstart & 0xFF);
write3X4(par, VGA_CRTC_H_BLANK_END, 0 /* (p->hblankend & 0x1F) */); write3X4(par, VGA_CRTC_H_BLANK_END, hblankend & 0x1F);
/* higher bits of vertical timing values */ /* higher bits of vertical timing values */
tmp = 0x10; tmp = 0x10;
...@@ -953,16 +952,18 @@ static int tridentfb_set_par(struct fb_info *info) ...@@ -953,16 +952,18 @@ static int tridentfb_set_par(struct fb_info *info)
if (vsyncstart & 0x200) tmp |= 0x80; if (vsyncstart & 0x200) tmp |= 0x80;
write3X4(par, VGA_CRTC_OVERFLOW, tmp); write3X4(par, VGA_CRTC_OVERFLOW, tmp);
tmp = read3X4(par, CRTHiOrd) | 0x08; /* line compare bit 10 */ tmp = read3X4(par, CRTHiOrd) & 0x07;
tmp |= 0x08; /* line compare bit 10 */
if (vtotal & 0x400) tmp |= 0x80; if (vtotal & 0x400) tmp |= 0x80;
if (vblankstart & 0x400) tmp |= 0x40; if (vblankstart & 0x400) tmp |= 0x40;
if (vsyncstart & 0x400) tmp |= 0x20; if (vsyncstart & 0x400) tmp |= 0x20;
if (vdispend & 0x400) tmp |= 0x10; if (vdispend & 0x400) tmp |= 0x10;
write3X4(par, CRTHiOrd, tmp); write3X4(par, CRTHiOrd, tmp);
tmp = 0; tmp = (htotal >> 8) & 0x01;
if (htotal & 0x800) tmp |= 0x800 >> 11; tmp |= (hdispend >> 7) & 0x02;
if (hblankstart & 0x800) tmp |= 0x800 >> 7; tmp |= (hsyncstart >> 5) & 0x08;
tmp |= (hblankstart >> 4) & 0x10;
write3X4(par, HorizOverflow, tmp); write3X4(par, HorizOverflow, tmp);
tmp = 0x40; tmp = 0x40;
......
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