aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2009-03-31 18:25:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 11:59:27 -0400
commit1b48cb563d59e03dbf530174f30c0ed3b6fba513 (patch)
treecef000929c4366c6a92b5456981a88a41e461d4f
parent48c329e906f834711906ab4b0986ea0e857aff16 (diff)
cirrusfb: Laguna chipset 8bpp fix
Fix 8bpp mode by adding handling of the Laguna chipsets to various places and stop trashing a HDR register which probably does not exist on the Laguna. Fix compilation warnings about uninitialized variables also. Finally, all 8bpp, 16bpp and 32bpp modes work on the Laguna chipset. 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.c34
-rw-r--r--include/video/cirrus.h1
2 files changed, 21 insertions, 14 deletions
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index 9e52db7d333..12f45520e5d 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -660,7 +660,7 @@ static int cirrusfb_set_par_foo(struct fb_info *info)
660 int yres, vdispend, vsyncstart, vsyncend, vtotal; 660 int yres, vdispend, vsyncstart, vsyncend, vtotal;
661 long freq; 661 long freq;
662 int nom, den, div; 662 int nom, den, div;
663 unsigned int control, format, threshold; 663 unsigned int control = 0, format = 0, threshold = 0;
664 664
665 dev_dbg(info->device, "Requested mode: %dx%dx%d\n", 665 dev_dbg(info->device, "Requested mode: %dx%dx%d\n",
666 var->xres, var->yres, var->bits_per_pixel); 666 var->xres, var->yres, var->bits_per_pixel);
@@ -842,8 +842,7 @@ static int cirrusfb_set_par_foo(struct fb_info *info)
842 threshold = fb_readw(cinfo->laguna_mmio + 0xea); 842 threshold = fb_readw(cinfo->laguna_mmio + 0xea);
843 control &= ~0x6800; 843 control &= ~0x6800;
844 format = 0; 844 format = 0;
845 threshold &= 0xffe0; 845 threshold &= 0xffe0 & 0x3fbf;
846 threshold &= 0x3fbf;
847 } 846 }
848 if (nom) { 847 if (nom) {
849 tmp = den << 1; 848 tmp = den << 1;
@@ -893,6 +892,8 @@ static int cirrusfb_set_par_foo(struct fb_info *info)
893 tmp |= 0x40; 892 tmp |= 0x40;
894 if (var->sync & FB_SYNC_VERT_HIGH_ACT) 893 if (var->sync & FB_SYNC_VERT_HIGH_ACT)
895 tmp |= 0x80; 894 tmp |= 0x80;
895 if (cinfo->btype == BT_LAGUNA)
896 tmp |= 0xc;
896 WGen(cinfo, VGA_MIS_W, tmp); 897 WGen(cinfo, VGA_MIS_W, tmp);
897 898
898 /* Screen A Preset Row-Scan register */ 899 /* Screen A Preset Row-Scan register */
@@ -1228,9 +1229,7 @@ static int cirrusfb_set_par_foo(struct fb_info *info)
1228 if (cirrusfb_board_info[cinfo->btype].scrn_start_bit19) 1229 if (cirrusfb_board_info[cinfo->btype].scrn_start_bit19)
1229 vga_wcrt(regbase, CL_CRT1D, (pitch >> 9) & 1); 1230 vga_wcrt(regbase, CL_CRT1D, (pitch >> 9) & 1);
1230 1231
1231 if (cinfo->btype == BT_LAGUNA || 1232 if (cinfo->btype == BT_LAGUNA) {
1232 cinfo->btype == BT_GD5480) {
1233
1234 tmp = 0; 1233 tmp = 0;
1235 if ((htotal + 5) & 256) 1234 if ((htotal + 5) & 256)
1236 tmp |= 128; 1235 tmp |= 128;
@@ -1360,7 +1359,8 @@ static int cirrusfb_pan_display(struct fb_var_screeninfo *var,
1360 xpix = (unsigned char) ((xoffset % 4) * 2); 1359 xpix = (unsigned char) ((xoffset % 4) * 2);
1361 } 1360 }
1362 1361
1363 cirrusfb_WaitBLT(cinfo->regbase); /* make sure all the BLT's are done */ 1362 if (cinfo->btype != BT_LAGUNA)
1363 cirrusfb_WaitBLT(cinfo->regbase);
1364 1364
1365 /* lower 8 + 8 bits of screen start address */ 1365 /* lower 8 + 8 bits of screen start address */
1366 vga_wcrt(cinfo->regbase, VGA_CRTC_START_LO, 1366 vga_wcrt(cinfo->regbase, VGA_CRTC_START_LO,
@@ -1394,7 +1394,8 @@ static int cirrusfb_pan_display(struct fb_var_screeninfo *var,
1394 if (info->var.bits_per_pixel == 1) 1394 if (info->var.bits_per_pixel == 1)
1395 vga_wattr(cinfo->regbase, CL_AR33, xpix); 1395 vga_wattr(cinfo->regbase, CL_AR33, xpix);
1396 1396
1397 cirrusfb_WaitBLT(cinfo->regbase); 1397 if (cinfo->btype != BT_LAGUNA)
1398 cirrusfb_WaitBLT(cinfo->regbase);
1398 1399
1399 return 0; 1400 return 0;
1400} 1401}
@@ -1513,6 +1514,7 @@ static void init_vgachip(struct fb_info *info)
1513 vga_wgfx(cinfo->regbase, CL_GR2F, 0x00); 1514 vga_wgfx(cinfo->regbase, CL_GR2F, 0x00);
1514 break; 1515 break;
1515 1516
1517 case BT_LAGUNA:
1516 case BT_ALPINE: 1518 case BT_ALPINE:
1517 /* Nothing to do to reset the board. */ 1519 /* Nothing to do to reset the board. */
1518 break; 1520 break;
@@ -1538,7 +1540,7 @@ static void init_vgachip(struct fb_info *info)
1538 WGen(cinfo, CL_VSSM2, 0x01); 1540 WGen(cinfo, CL_VSSM2, 0x01);
1539 1541
1540 /* reset sequencer logic */ 1542 /* reset sequencer logic */
1541 vga_wseq(cinfo->regbase, CL_SEQR0, 0x03); 1543 vga_wseq(cinfo->regbase, VGA_SEQ_RESET, 0x03);
1542 1544
1543 /* FullBandwidth (video off) and 8/9 dot clock */ 1545 /* FullBandwidth (video off) and 8/9 dot clock */
1544 vga_wseq(cinfo->regbase, VGA_SEQ_CLOCK_MODE, 0x21); 1546 vga_wseq(cinfo->regbase, VGA_SEQ_CLOCK_MODE, 0x21);
@@ -1560,6 +1562,7 @@ static void init_vgachip(struct fb_info *info)
1560 vga_wseq(cinfo->regbase, CL_SEQRF, 0x98); 1562 vga_wseq(cinfo->regbase, CL_SEQRF, 0x98);
1561 break; 1563 break;
1562 case BT_ALPINE: 1564 case BT_ALPINE:
1565 case BT_LAGUNA:
1563 break; 1566 break;
1564 case BT_SD64: 1567 case BT_SD64:
1565 vga_wseq(cinfo->regbase, CL_SEQRF, 0xb8); 1568 vga_wseq(cinfo->regbase, CL_SEQRF, 0xb8);
@@ -1648,7 +1651,8 @@ static void init_vgachip(struct fb_info *info)
1648 vga_wgfx(cinfo->regbase, VGA_GFX_COMPARE_MASK, 0x0f); 1651 vga_wgfx(cinfo->regbase, VGA_GFX_COMPARE_MASK, 0x0f);
1649 /* Bit Mask: no mask at all */ 1652 /* Bit Mask: no mask at all */
1650 vga_wgfx(cinfo->regbase, VGA_GFX_BIT_MASK, 0xff); 1653 vga_wgfx(cinfo->regbase, VGA_GFX_BIT_MASK, 0xff);
1651 if (cinfo->btype == BT_ALPINE) 1654
1655 if (cinfo->btype == BT_ALPINE || cinfo->btype == BT_LAGUNA)
1652 /* (5434 can't have bit 3 set for bitblt) */ 1656 /* (5434 can't have bit 3 set for bitblt) */
1653 vga_wgfx(cinfo->regbase, CL_GRB, 0x20); 1657 vga_wgfx(cinfo->regbase, CL_GRB, 0x20);
1654 else 1658 else
@@ -1845,7 +1849,8 @@ static void cirrusfb_imageblit(struct fb_info *info,
1845{ 1849{
1846 struct cirrusfb_info *cinfo = info->par; 1850 struct cirrusfb_info *cinfo = info->par;
1847 1851
1848 cirrusfb_WaitBLT(cinfo->regbase); 1852 if (cinfo->btype != BT_LAGUNA)
1853 cirrusfb_WaitBLT(cinfo->regbase);
1849 cfb_imageblit(info, image); 1854 cfb_imageblit(info, image);
1850} 1855}
1851 1856
@@ -1992,7 +1997,7 @@ static int __devinit cirrusfb_set_fbinfo(struct fb_info *info)
1992 | FBINFO_HWACCEL_YPAN 1997 | FBINFO_HWACCEL_YPAN
1993 | FBINFO_HWACCEL_FILLRECT 1998 | FBINFO_HWACCEL_FILLRECT
1994 | FBINFO_HWACCEL_COPYAREA; 1999 | FBINFO_HWACCEL_COPYAREA;
1995 if (noaccel) 2000 if (noaccel || cinfo->btype == BT_LAGUNA)
1996 info->flags |= FBINFO_HWACCEL_DISABLED; 2001 info->flags |= FBINFO_HWACCEL_DISABLED;
1997 info->fbops = &cirrusfb_ops; 2002 info->fbops = &cirrusfb_ops;
1998 if (cinfo->btype == BT_GD5480) { 2003 if (cinfo->btype == BT_GD5480) {
@@ -2481,6 +2486,8 @@ static void WHDR(const struct cirrusfb_info *cinfo, unsigned char val)
2481{ 2486{
2482 unsigned char dummy; 2487 unsigned char dummy;
2483 2488
2489 if (cinfo->btype == BT_LAGUNA)
2490 return;
2484 if (cinfo->btype == BT_PICASSO) { 2491 if (cinfo->btype == BT_PICASSO) {
2485 /* Klaus' hint for correct access to HDR on some boards */ 2492 /* Klaus' hint for correct access to HDR on some boards */
2486 /* first write 0 to pixel mask (3c6) */ 2493 /* first write 0 to pixel mask (3c6) */
@@ -2548,7 +2555,8 @@ static void WClut(struct cirrusfb_info *cinfo, unsigned char regnum, unsigned ch
2548 vga_w(cinfo->regbase, VGA_PEL_IW, regnum); 2555 vga_w(cinfo->regbase, VGA_PEL_IW, regnum);
2549 2556
2550 if (cinfo->btype == BT_PICASSO || cinfo->btype == BT_PICASSO4 || 2557 if (cinfo->btype == BT_PICASSO || cinfo->btype == BT_PICASSO4 ||
2551 cinfo->btype == BT_ALPINE || cinfo->btype == BT_GD5480) { 2558 cinfo->btype == BT_ALPINE || cinfo->btype == BT_GD5480 ||
2559 cinfo->btype == BT_LAGUNA) {
2552 /* but DAC data register IS, at least for Picasso II */ 2560 /* but DAC data register IS, at least for Picasso II */
2553 if (cinfo->btype == BT_PICASSO) 2561 if (cinfo->btype == BT_PICASSO)
2554 data += 0xfff; 2562 data += 0xfff;
diff --git a/include/video/cirrus.h b/include/video/cirrus.h
index a1b7985b6b2..9a5e9ee3078 100644
--- a/include/video/cirrus.h
+++ b/include/video/cirrus.h
@@ -32,7 +32,6 @@
32#define CL_VSSM2 0x3c3 /* Motherboard Sleep */ 32#define CL_VSSM2 0x3c3 /* Motherboard Sleep */
33 33
34/*** VGA Sequencer Registers ***/ 34/*** VGA Sequencer Registers ***/
35#define CL_SEQR0 0x0 /* Reset */
36/* the following are from the "extension registers" group */ 35/* the following are from the "extension registers" group */
37#define CL_SEQR6 0x6 /* Unlock ALL Extensions */ 36#define CL_SEQR6 0x6 /* Unlock ALL Extensions */
38#define CL_SEQR7 0x7 /* Extended Sequencer Mode */ 37#define CL_SEQR7 0x7 /* Extended Sequencer Mode */