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

Configure Feed

Select the types of activity you want to include in your feed.

fbdev: tdfxfb: Make the VGA register initialisation a bit more obvious

For a while I was trying to get this working on m68k, for some reason
the card doesn't display anything if it's own video BIOS didn't run..

Anyhow, I spent a long time looking up what each of these offsets
were to work out what the code is configuring and eventually
replaced them with the human readable defines in video/vga.h.

Functionally there is no change but maybe it makes it a bit easier to
look at for the next person that finds themselves in here.

Tested on a real voodoo 3 on x86_64.

Signed-off-by: Daniel Palmer <daniel@thingy.jp>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Daniel Palmer and committed by
Helge Deller
d95beb0a f630c79a

+52 -51
+52 -51
drivers/video/fbdev/tdfxfb.c
··· 77 77 #include <asm/io.h> 78 78 79 79 #include <video/tdfx.h> 80 + #include <video/vga.h> 80 81 81 82 #define DPRINTK(a, b...) pr_debug("fb: %s: " a, __func__ , ## b) 82 83 ··· 592 591 vt = ve + (info->var.upper_margin << 1) - 1; 593 592 reg.screensize = info->var.xres | (info->var.yres << 13); 594 593 reg.vidcfg |= VIDCFG_HALF_MODE; 595 - reg.crt[0x09] = 0x80; 594 + reg.crt[VGA_CRTC_MAX_SCAN] = 0x80; 596 595 } else { 597 596 vd = info->var.yres - 1; 598 597 vs = vd + info->var.lower_margin; ··· 610 609 info->var.xres < 480 ? 0x60 : 611 610 info->var.xres < 768 ? 0xe0 : 0x20); 612 611 613 - reg.gra[0x05] = 0x40; 614 - reg.gra[0x06] = 0x05; 615 - reg.gra[0x07] = 0x0f; 616 - reg.gra[0x08] = 0xff; 612 + reg.gra[VGA_GFX_MODE] = 0x40; 613 + reg.gra[VGA_GFX_MISC] = 0x05; 614 + reg.gra[VGA_GFX_COMPARE_MASK] = 0x0f; 615 + reg.gra[VGA_GFX_BIT_MASK] = 0xff; 617 616 618 - reg.att[0x00] = 0x00; 619 - reg.att[0x01] = 0x01; 620 - reg.att[0x02] = 0x02; 621 - reg.att[0x03] = 0x03; 622 - reg.att[0x04] = 0x04; 623 - reg.att[0x05] = 0x05; 624 - reg.att[0x06] = 0x06; 625 - reg.att[0x07] = 0x07; 626 - reg.att[0x08] = 0x08; 627 - reg.att[0x09] = 0x09; 628 - reg.att[0x0a] = 0x0a; 629 - reg.att[0x0b] = 0x0b; 630 - reg.att[0x0c] = 0x0c; 631 - reg.att[0x0d] = 0x0d; 632 - reg.att[0x0e] = 0x0e; 633 - reg.att[0x0f] = 0x0f; 634 - reg.att[0x10] = 0x41; 635 - reg.att[0x12] = 0x0f; 617 + reg.att[VGA_ATC_PALETTE0] = 0x00; 618 + reg.att[VGA_ATC_PALETTE1] = 0x01; 619 + reg.att[VGA_ATC_PALETTE2] = 0x02; 620 + reg.att[VGA_ATC_PALETTE3] = 0x03; 621 + reg.att[VGA_ATC_PALETTE4] = 0x04; 622 + reg.att[VGA_ATC_PALETTE5] = 0x05; 623 + reg.att[VGA_ATC_PALETTE6] = 0x06; 624 + reg.att[VGA_ATC_PALETTE7] = 0x07; 625 + reg.att[VGA_ATC_PALETTE8] = 0x08; 626 + reg.att[VGA_ATC_PALETTE9] = 0x09; 627 + reg.att[VGA_ATC_PALETTEA] = 0x0a; 628 + reg.att[VGA_ATC_PALETTEB] = 0x0b; 629 + reg.att[VGA_ATC_PALETTEC] = 0x0c; 630 + reg.att[VGA_ATC_PALETTED] = 0x0d; 631 + reg.att[VGA_ATC_PALETTEE] = 0x0e; 632 + reg.att[VGA_ATC_PALETTEF] = 0x0f; 633 + reg.att[VGA_ATC_MODE] = 0x41; 634 + reg.att[VGA_ATC_PLANE_ENABLE] = 0x0f; 636 635 637 - reg.seq[0x00] = 0x03; 638 - reg.seq[0x01] = 0x01; /* fixme: clkdiv2? */ 639 - reg.seq[0x02] = 0x0f; 640 - reg.seq[0x03] = 0x00; 641 - reg.seq[0x04] = 0x0e; 636 + reg.seq[VGA_SEQ_RESET] = 0x03; 637 + reg.seq[VGA_SEQ_CLOCK_MODE] = 0x01; /* fixme: clkdiv2? */ 638 + reg.seq[VGA_SEQ_PLANE_WRITE] = 0x0f; 639 + reg.seq[VGA_SEQ_CHARACTER_MAP] = 0x00; 640 + reg.seq[VGA_SEQ_MEMORY_MODE] = 0x0e; 642 641 643 - reg.crt[0x00] = ht - 4; 644 - reg.crt[0x01] = hd; 645 - reg.crt[0x02] = hbs; 646 - reg.crt[0x03] = 0x80 | (hbe & 0x1f); 647 - reg.crt[0x04] = hs; 648 - reg.crt[0x05] = ((hbe & 0x20) << 2) | (he & 0x1f); 649 - reg.crt[0x06] = vt; 650 - reg.crt[0x07] = ((vs & 0x200) >> 2) | 651 - ((vd & 0x200) >> 3) | 652 - ((vt & 0x200) >> 4) | 0x10 | 653 - ((vbs & 0x100) >> 5) | 654 - ((vs & 0x100) >> 6) | 655 - ((vd & 0x100) >> 7) | 656 - ((vt & 0x100) >> 8); 657 - reg.crt[0x09] |= 0x40 | ((vbs & 0x200) >> 4); 658 - reg.crt[0x10] = vs; 659 - reg.crt[0x11] = (ve & 0x0f) | 0x20; 660 - reg.crt[0x12] = vd; 661 - reg.crt[0x13] = wd; 662 - reg.crt[0x15] = vbs; 663 - reg.crt[0x16] = vbe + 1; 664 - reg.crt[0x17] = 0xc3; 665 - reg.crt[0x18] = 0xff; 642 + reg.crt[VGA_CRTC_H_TOTAL] = ht - 4; 643 + reg.crt[VGA_CRTC_H_DISP] = hd; 644 + reg.crt[VGA_CRTC_H_BLANK_START] = hbs; 645 + reg.crt[VGA_CRTC_H_BLANK_END] = 0x80 | (hbe & 0x1f); 646 + reg.crt[VGA_CRTC_H_SYNC_START] = hs; 647 + reg.crt[VGA_CRTC_H_SYNC_END] = ((hbe & 0x20) << 2) | (he & 0x1f); 648 + reg.crt[VGA_CRTC_V_TOTAL] = vt; 649 + reg.crt[VGA_CRTC_OVERFLOW] = ((vs & 0x200) >> 2) | 650 + ((vd & 0x200) >> 3) | 651 + ((vt & 0x200) >> 4) | 0x10 | 652 + ((vbs & 0x100) >> 5) | 653 + ((vs & 0x100) >> 6) | 654 + ((vd & 0x100) >> 7) | 655 + ((vt & 0x100) >> 8); 656 + reg.crt[VGA_CRTC_MAX_SCAN] |= 0x40 | ((vbs & 0x200) >> 4); 657 + reg.crt[VGA_CRTC_V_SYNC_START] = vs; 658 + reg.crt[VGA_CRTC_V_SYNC_END] = (ve & 0x0f) | 0x20; 659 + reg.crt[VGA_CRTC_V_DISP_END] = vd; 660 + reg.crt[VGA_CRTC_OFFSET] = wd; 661 + reg.crt[VGA_CRTC_V_BLANK_START] = vbs; 662 + reg.crt[VGA_CRTC_V_BLANK_END] = vbe + 1; 663 + reg.crt[VGA_CRTC_MODE] = 0xc3; 664 + reg.crt[VGA_CRTC_LINE_COMPARE] = 0xff; 666 665 667 666 /* Banshee's nonvga stuff */ 668 667 reg.ext[0x00] = (((ht & 0x100) >> 8) |