Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Krzysztof Helt and committed by
Linus Torvalds
1b48cb56 48c329e9

+21 -14
+21 -13
drivers/video/cirrusfb.c
··· 660 660 int yres, vdispend, vsyncstart, vsyncend, vtotal; 661 661 long freq; 662 662 int nom, den, div; 663 - unsigned int control, format, threshold; 663 + unsigned int control = 0, format = 0, threshold = 0; 664 664 665 665 dev_dbg(info->device, "Requested mode: %dx%dx%d\n", 666 666 var->xres, var->yres, var->bits_per_pixel); ··· 842 842 threshold = fb_readw(cinfo->laguna_mmio + 0xea); 843 843 control &= ~0x6800; 844 844 format = 0; 845 - threshold &= 0xffe0; 846 - threshold &= 0x3fbf; 845 + threshold &= 0xffe0 & 0x3fbf; 847 846 } 848 847 if (nom) { 849 848 tmp = den << 1; ··· 892 893 tmp |= 0x40; 893 894 if (var->sync & FB_SYNC_VERT_HIGH_ACT) 894 895 tmp |= 0x80; 896 + if (cinfo->btype == BT_LAGUNA) 897 + tmp |= 0xc; 895 898 WGen(cinfo, VGA_MIS_W, tmp); 896 899 897 900 /* Screen A Preset Row-Scan register */ ··· 1229 1228 if (cirrusfb_board_info[cinfo->btype].scrn_start_bit19) 1230 1229 vga_wcrt(regbase, CL_CRT1D, (pitch >> 9) & 1); 1231 1230 1232 - if (cinfo->btype == BT_LAGUNA || 1233 - cinfo->btype == BT_GD5480) { 1234 - 1231 + if (cinfo->btype == BT_LAGUNA) { 1235 1232 tmp = 0; 1236 1233 if ((htotal + 5) & 256) 1237 1234 tmp |= 128; ··· 1359 1360 xpix = (unsigned char) ((xoffset % 4) * 2); 1360 1361 } 1361 1362 1362 - cirrusfb_WaitBLT(cinfo->regbase); /* make sure all the BLT's are done */ 1363 + if (cinfo->btype != BT_LAGUNA) 1364 + cirrusfb_WaitBLT(cinfo->regbase); 1363 1365 1364 1366 /* lower 8 + 8 bits of screen start address */ 1365 1367 vga_wcrt(cinfo->regbase, VGA_CRTC_START_LO, ··· 1394 1394 if (info->var.bits_per_pixel == 1) 1395 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 1400 return 0; 1400 1401 } ··· 1514 1513 vga_wgfx(cinfo->regbase, CL_GR2F, 0x00); 1515 1514 break; 1516 1515 1516 + case BT_LAGUNA: 1517 1517 case BT_ALPINE: 1518 1518 /* Nothing to do to reset the board. */ 1519 1519 break; ··· 1540 1538 WGen(cinfo, CL_VSSM2, 0x01); 1541 1539 1542 1540 /* reset sequencer logic */ 1543 - vga_wseq(cinfo->regbase, CL_SEQR0, 0x03); 1541 + vga_wseq(cinfo->regbase, VGA_SEQ_RESET, 0x03); 1544 1542 1545 1543 /* FullBandwidth (video off) and 8/9 dot clock */ 1546 1544 vga_wseq(cinfo->regbase, VGA_SEQ_CLOCK_MODE, 0x21); ··· 1562 1560 vga_wseq(cinfo->regbase, CL_SEQRF, 0x98); 1563 1561 break; 1564 1562 case BT_ALPINE: 1563 + case BT_LAGUNA: 1565 1564 break; 1566 1565 case BT_SD64: 1567 1566 vga_wseq(cinfo->regbase, CL_SEQRF, 0xb8); ··· 1651 1648 vga_wgfx(cinfo->regbase, VGA_GFX_COMPARE_MASK, 0x0f); 1652 1649 /* Bit Mask: no mask at all */ 1653 1650 vga_wgfx(cinfo->regbase, VGA_GFX_BIT_MASK, 0xff); 1654 - if (cinfo->btype == BT_ALPINE) 1651 + 1652 + if (cinfo->btype == BT_ALPINE || cinfo->btype == BT_LAGUNA) 1655 1653 /* (5434 can't have bit 3 set for bitblt) */ 1656 1654 vga_wgfx(cinfo->regbase, CL_GRB, 0x20); 1657 1655 else ··· 1849 1845 { 1850 1846 struct cirrusfb_info *cinfo = info->par; 1851 1847 1852 - cirrusfb_WaitBLT(cinfo->regbase); 1848 + if (cinfo->btype != BT_LAGUNA) 1849 + cirrusfb_WaitBLT(cinfo->regbase); 1853 1850 cfb_imageblit(info, image); 1854 1851 } 1855 1852 ··· 1997 1992 | FBINFO_HWACCEL_YPAN 1998 1993 | FBINFO_HWACCEL_FILLRECT 1999 1994 | FBINFO_HWACCEL_COPYAREA; 2000 - if (noaccel) 1995 + if (noaccel || cinfo->btype == BT_LAGUNA) 2001 1996 info->flags |= FBINFO_HWACCEL_DISABLED; 2002 1997 info->fbops = &cirrusfb_ops; 2003 1998 if (cinfo->btype == BT_GD5480) { ··· 2486 2481 { 2487 2482 unsigned char dummy; 2488 2483 2484 + if (cinfo->btype == BT_LAGUNA) 2485 + return; 2489 2486 if (cinfo->btype == BT_PICASSO) { 2490 2487 /* Klaus' hint for correct access to HDR on some boards */ 2491 2488 /* first write 0 to pixel mask (3c6) */ ··· 2555 2548 vga_w(cinfo->regbase, VGA_PEL_IW, regnum); 2556 2549 2557 2550 if (cinfo->btype == BT_PICASSO || cinfo->btype == BT_PICASSO4 || 2558 - cinfo->btype == BT_ALPINE || cinfo->btype == BT_GD5480) { 2551 + cinfo->btype == BT_ALPINE || cinfo->btype == BT_GD5480 || 2552 + cinfo->btype == BT_LAGUNA) { 2559 2553 /* but DAC data register IS, at least for Picasso II */ 2560 2554 if (cinfo->btype == BT_PICASSO) 2561 2555 data += 0xfff;
-1
include/video/cirrus.h
··· 32 32 #define CL_VSSM2 0x3c3 /* Motherboard Sleep */ 33 33 34 34 /*** VGA Sequencer Registers ***/ 35 - #define CL_SEQR0 0x0 /* Reset */ 36 35 /* the following are from the "extension registers" group */ 37 36 #define CL_SEQR6 0x6 /* Unlock ALL Extensions */ 38 37 #define CL_SEQR7 0x7 /* Extended Sequencer Mode */