aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2008-07-24 00:31:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:41 -0400
commitc6b044d6bab5e2878d408666469362fc200a889a (patch)
treea3602353fa55bcfbce9f28c628ac623029059530 /drivers
parent1ca6b62f8ca668ccfab0da9112c0125ef82343bd (diff)
neofb: drop the xtimings structure
Remove the xtimings structure which only stored some values to be used later (mostly once). Calculate and use these values in places they are needed. 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/neofb.c88
1 files changed, 40 insertions, 48 deletions
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c
index 669b8c196bba..25172b2a2a94 100644
--- a/drivers/video/neofb.c
+++ b/drivers/video/neofb.c
@@ -259,15 +259,20 @@ static void neoCalcVCLK(const struct fb_info *info,
259 */ 259 */
260 260
261static int vgaHWInit(const struct fb_var_screeninfo *var, 261static int vgaHWInit(const struct fb_var_screeninfo *var,
262 const struct fb_info *info, 262 struct neofb_par *par)
263 struct neofb_par *par, struct xtimings *timings)
264{ 263{
264 int hsync_end = var->xres + var->right_margin + var->hsync_len;
265 int htotal = (hsync_end + var->left_margin) >> 3;
266 int vsync_start = var->yres + var->lower_margin;
267 int vsync_end = vsync_start + var->vsync_len;
268 int vtotal = vsync_end + var->upper_margin;
269
265 par->MiscOutReg = 0x23; 270 par->MiscOutReg = 0x23;
266 271
267 if (!(timings->sync & FB_SYNC_HOR_HIGH_ACT)) 272 if (!(var->sync & FB_SYNC_HOR_HIGH_ACT))
268 par->MiscOutReg |= 0x40; 273 par->MiscOutReg |= 0x40;
269 274
270 if (!(timings->sync & FB_SYNC_VERT_HIGH_ACT)) 275 if (!(var->sync & FB_SYNC_VERT_HIGH_ACT))
271 par->MiscOutReg |= 0x80; 276 par->MiscOutReg |= 0x80;
272 277
273 /* 278 /*
@@ -282,25 +287,25 @@ static int vgaHWInit(const struct fb_var_screeninfo *var,
282 /* 287 /*
283 * CRTC Controller 288 * CRTC Controller
284 */ 289 */
285 par->CRTC[0] = (timings->HTotal >> 3) - 5; 290 par->CRTC[0] = htotal - 5;
286 par->CRTC[1] = (timings->HDisplay >> 3) - 1; 291 par->CRTC[1] = (var->xres >> 3) - 1;
287 par->CRTC[2] = (timings->HDisplay >> 3) - 1; 292 par->CRTC[2] = (var->xres >> 3) - 1;
288 par->CRTC[3] = (((timings->HTotal >> 3) - 1) & 0x1F) | 0x80; 293 par->CRTC[3] = ((htotal - 1) & 0x1F) | 0x80;
289 par->CRTC[4] = (timings->HSyncStart >> 3); 294 par->CRTC[4] = ((var->xres + var->right_margin) >> 3);
290 par->CRTC[5] = ((((timings->HTotal >> 3) - 1) & 0x20) << 2) 295 par->CRTC[5] = (((htotal - 1) & 0x20) << 2)
291 | (((timings->HSyncEnd >> 3)) & 0x1F); 296 | (((hsync_end >> 3)) & 0x1F);
292 par->CRTC[6] = (timings->VTotal - 2) & 0xFF; 297 par->CRTC[6] = (vtotal - 2) & 0xFF;
293 par->CRTC[7] = (((timings->VTotal - 2) & 0x100) >> 8) 298 par->CRTC[7] = (((vtotal - 2) & 0x100) >> 8)
294 | (((timings->VDisplay - 1) & 0x100) >> 7) 299 | (((var->yres - 1) & 0x100) >> 7)
295 | ((timings->VSyncStart & 0x100) >> 6) 300 | ((vsync_start & 0x100) >> 6)
296 | (((timings->VDisplay - 1) & 0x100) >> 5) 301 | (((var->yres - 1) & 0x100) >> 5)
297 | 0x10 | (((timings->VTotal - 2) & 0x200) >> 4) 302 | 0x10 | (((vtotal - 2) & 0x200) >> 4)
298 | (((timings->VDisplay - 1) & 0x200) >> 3) 303 | (((var->yres - 1) & 0x200) >> 3)
299 | ((timings->VSyncStart & 0x200) >> 2); 304 | ((vsync_start & 0x200) >> 2);
300 par->CRTC[8] = 0x00; 305 par->CRTC[8] = 0x00;
301 par->CRTC[9] = (((timings->VDisplay - 1) & 0x200) >> 4) | 0x40; 306 par->CRTC[9] = (((var->yres - 1) & 0x200) >> 4) | 0x40;
302 307
303 if (timings->dblscan) 308 if (var->vmode & FB_VMODE_DOUBLE)
304 par->CRTC[9] |= 0x80; 309 par->CRTC[9] |= 0x80;
305 310
306 par->CRTC[10] = 0x00; 311 par->CRTC[10] = 0x00;
@@ -309,13 +314,13 @@ static int vgaHWInit(const struct fb_var_screeninfo *var,
309 par->CRTC[13] = 0x00; 314 par->CRTC[13] = 0x00;
310 par->CRTC[14] = 0x00; 315 par->CRTC[14] = 0x00;
311 par->CRTC[15] = 0x00; 316 par->CRTC[15] = 0x00;
312 par->CRTC[16] = timings->VSyncStart & 0xFF; 317 par->CRTC[16] = vsync_start & 0xFF;
313 par->CRTC[17] = (timings->VSyncEnd & 0x0F) | 0x20; 318 par->CRTC[17] = (vsync_end & 0x0F) | 0x20;
314 par->CRTC[18] = (timings->VDisplay - 1) & 0xFF; 319 par->CRTC[18] = (var->yres - 1) & 0xFF;
315 par->CRTC[19] = var->xres_virtual >> 4; 320 par->CRTC[19] = var->xres_virtual >> 4;
316 par->CRTC[20] = 0x00; 321 par->CRTC[20] = 0x00;
317 par->CRTC[21] = (timings->VDisplay - 1) & 0xFF; 322 par->CRTC[21] = (var->yres - 1) & 0xFF;
318 par->CRTC[22] = (timings->VTotal - 1) & 0xFF; 323 par->CRTC[22] = (vtotal - 1) & 0xFF;
319 par->CRTC[23] = 0xC3; 324 par->CRTC[23] = 0xC3;
320 par->CRTC[24] = 0xFF; 325 par->CRTC[24] = 0xFF;
321 326
@@ -736,11 +741,11 @@ neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
736static int neofb_set_par(struct fb_info *info) 741static int neofb_set_par(struct fb_info *info)
737{ 742{
738 struct neofb_par *par = info->par; 743 struct neofb_par *par = info->par;
739 struct xtimings timings;
740 unsigned char temp; 744 unsigned char temp;
741 int i, clock_hi = 0; 745 int i, clock_hi = 0;
742 int lcd_stretch; 746 int lcd_stretch;
743 int hoffset, voffset; 747 int hoffset, voffset;
748 int vsync_start, vtotal;
744 749
745 DBG("neofb_set_par"); 750 DBG("neofb_set_par");
746 751
@@ -748,28 +753,15 @@ static int neofb_set_par(struct fb_info *info)
748 753
749 vgaHWProtect(1); /* Blank the screen */ 754 vgaHWProtect(1); /* Blank the screen */
750 755
751 timings.dblscan = info->var.vmode & FB_VMODE_DOUBLE; 756 vsync_start = info->var.yres + info->var.lower_margin;
752 timings.interlaced = info->var.vmode & FB_VMODE_INTERLACED; 757 vtotal = vsync_start + info->var.vsync_len + info->var.upper_margin;
753 timings.HDisplay = info->var.xres;
754 timings.HSyncStart = timings.HDisplay + info->var.right_margin;
755 timings.HSyncEnd = timings.HSyncStart + info->var.hsync_len;
756 timings.HTotal = timings.HSyncEnd + info->var.left_margin;
757 timings.VDisplay = info->var.yres;
758 timings.VSyncStart = timings.VDisplay + info->var.lower_margin;
759 timings.VSyncEnd = timings.VSyncStart + info->var.vsync_len;
760 timings.VTotal = timings.VSyncEnd + info->var.upper_margin;
761 timings.sync = info->var.sync;
762 timings.pixclock = PICOS2KHZ(info->var.pixclock);
763
764 if (timings.pixclock < 1)
765 timings.pixclock = 1;
766 758
767 /* 759 /*
768 * This will allocate the datastructure and initialize all of the 760 * This will allocate the datastructure and initialize all of the
769 * generic VGA registers. 761 * generic VGA registers.
770 */ 762 */
771 763
772 if (vgaHWInit(&info->var, info, par, &timings)) 764 if (vgaHWInit(&info->var, par))
773 return -EINVAL; 765 return -EINVAL;
774 766
775 /* 767 /*
@@ -808,10 +800,10 @@ static int neofb_set_par(struct fb_info *info)
808 par->ExtCRTDispAddr = 0x10; 800 par->ExtCRTDispAddr = 0x10;
809 801
810 /* Vertical Extension */ 802 /* Vertical Extension */
811 par->VerticalExt = (((timings.VTotal - 2) & 0x400) >> 10) 803 par->VerticalExt = (((vtotal - 2) & 0x400) >> 10)
812 | (((timings.VDisplay - 1) & 0x400) >> 9) 804 | (((info->var.yres - 1) & 0x400) >> 9)
813 | (((timings.VSyncStart) & 0x400) >> 8) 805 | (((vsync_start) & 0x400) >> 8)
814 | (((timings.VSyncStart) & 0x400) >> 7); 806 | (((vsync_start) & 0x400) >> 7);
815 807
816 /* Fast write bursts on unless disabled. */ 808 /* Fast write bursts on unless disabled. */
817 if (par->pci_burst) 809 if (par->pci_burst)
@@ -972,7 +964,7 @@ static int neofb_set_par(struct fb_info *info)
972 * Calculate the VCLK that most closely matches the requested dot 964 * Calculate the VCLK that most closely matches the requested dot
973 * clock. 965 * clock.
974 */ 966 */
975 neoCalcVCLK(info, par, timings.pixclock); 967 neoCalcVCLK(info, par, PICOS2KHZ(info->var.pixclock));
976 968
977 /* Since we program the clocks ourselves, always use VCLK3. */ 969 /* Since we program the clocks ourselves, always use VCLK3. */
978 par->MiscOutReg |= 0x0C; 970 par->MiscOutReg |= 0x0C;