diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-08-28 22:00:09 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-08-28 22:00:09 +0000 |
commit | 1a1d77dd589de5a567fa95e36aa6999c704ceca4 (patch) | |
tree | 141e31f89f18b9fe0831f31852e0435ceaccafc5 /drivers/video | |
parent | fb9c690a18b3d66925a65b17441c37fa14d4370b (diff) |
Merge with 2.4.0-test7.
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/acornfb.c | 10 | ||||
-rw-r--r-- | drivers/video/hgafb.c | 224 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_DAC1064.c | 58 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_Ti3026.c | 4 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_accel.c | 4 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_base.c | 54 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_base.h | 4 | ||||
-rw-r--r-- | drivers/video/matrox/matroxfb_misc.c | 4 | ||||
-rw-r--r-- | drivers/video/sa1100fb.c | 204 |
9 files changed, 416 insertions, 150 deletions
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 5eb9970a2..4ac946a3a 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c @@ -22,7 +22,6 @@ #include <linux/malloc.h> #include <linux/init.h> #include <linux/fb.h> -#include <linux/wrapper.h> #include <asm/hardware.h> #include <asm/io.h> @@ -1528,13 +1527,16 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) virtual_end = PAGE_ALIGN(virtual_end); while (virtual_start < virtual_end) { + struct page *page; + /* * Clear page reserved bit, * set count to 1, and free * the page. */ - mem_map_unreserve(virt_to_page(virtual_start)); - atomic_set(&virt_to_page(virtual_start)->count, 1); + page = virt_to_page(virtual_start); + ClearPageReserved(page); + atomic_set(&page->count, 1); free_page(virtual_start); virtual_start += PAGE_SIZE; @@ -1629,7 +1631,7 @@ acornfb_init(void) for (page = current_par.screen_base; page < PAGE_ALIGN(current_par.screen_base + size); page += PAGE_SIZE) - mem_map_reserve(virt_to_page(page)); + SetPageReserved(virt_to_page(page)); /* Hand back any excess pages that we allocated. */ for (page = current_par.screen_base + size; page < top; page += PAGE_SIZE) free_page(page); diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c index d2b09416b..8b389f846 100644 --- a/drivers/video/hgafb.c +++ b/drivers/video/hgafb.c @@ -7,6 +7,8 @@ * * History: * + * - Revision 0.1.6 (17 Aug 2000): new style structs + * documentation * - Revision 0.1.5 (13 Mar 2000): spinlocks instead of saveflags();cli();etc * minor fixes * - Revision 0.1.4 (24 Jan 2000): fixed a bug in hga_card_detect() for @@ -107,19 +109,23 @@ spinlock_t hga_reg_lock = SPIN_LOCK_UNLOCKED; /* Framebuffer driver structures */ static struct fb_var_screeninfo hga_default_var = { - 720, 348, /* xres, yres */ - 720, 348, /* xres_virtual, yres_virtual */ - 0, 0, /* xoffset, yoffset */ - 1, /* bits_per_pixel */ - 0, /* grayscale */ - {0, 1, 0}, /* red */ - {0, 1, 0}, /* green */ - {0, 1, 0}, /* blue */ - {0, 0, 0}, /* transp */ - 0, /* nonstd (FB_NONSTD_HGA ?) */ - 0, /* activate */ - -1, -1, /* height, width */ - 0, /* accel_flags */ + xres: 720, + yres: 348, + xres_virtual: 720, + yres_virtual: 348, + xoffset: 0, + yoffset: 0, + bits_per_pixel: 1, + grayscale: 0, + red: {0, 1, 0}, + green: {0, 1, 0}, + blue: {0, 1, 0}, + transp: {0, 0, 0}, + nonstd: 0, /* (FB_NONSTD_HGA ?) */ + activate: 0, + height: -1, + width: -1, + accel_flags: 0, /* pixclock */ /* left_margin, right_margin */ /* upper_margin, lower_margin */ @@ -129,19 +135,19 @@ static struct fb_var_screeninfo hga_default_var = { }; static struct fb_fix_screeninfo hga_fix = { - "HGA", /* id */ - (unsigned long) NULL, /* smem_start */ - 0, /* smem_len */ - FB_TYPE_PACKED_PIXELS, /* type (not sure) */ - 0, /* type_aux (not sure) */ - FB_VISUAL_MONO10, /* visual */ - 8, /* xpanstep */ - 8, /* ypanstep */ - 0, /* ywrapstep */ - 90, /* line_length */ - 0, /* mmio_start */ - 0, /* mmio_len */ - FB_ACCEL_NONE /* accel */ + id: "HGA", + smem_start: (unsigned long) NULL, + smem_len: 0, + type: FB_TYPE_PACKED_PIXELS, /* (not sure) */ + type_aux: 0, /* (not sure) */ + visual: FB_VISUAL_MONO10, + xpanstep: 8, + ypanstep: 8, + ywrapstep: 0, + line_length: 90, + mmio_start: 0, + mmio_len: 0, + accel: FB_ACCEL_NONE }; static struct fb_info fb_info; @@ -377,9 +383,15 @@ static int __init hga_card_detect(void) * * ------------------------------------------------------------------------- */ - /* - * Get the Fixed Part of the Display - */ +/** + * hga_get_fix - get the fixed part of the display + * @fix:struct fb_fix_screeninfo to fill in + * @con:unused + * @info:pointer to fb_info object containing info for current hga board + * + * This wrapper function copies @info->fix to @fix. + * A zero is returned on success and %-EINVAL for failure. + */ int hga_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info) { @@ -390,10 +402,15 @@ int hga_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info) return 0; } - - /* - * Get the User Defined Part of the Display - */ +/** + * hga_get_var - get the user defined part of the display + * @var:struct fb_var_screeninfo to fill in + * @con:unused + * @info:pointer to fb_info object containing info for current hga board + * + * This wrapper function copies @info->var to @var. + * A zero is returned on success and %-EINVAL for failure. + */ int hga_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) { @@ -404,13 +421,23 @@ int hga_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) return 0; } - /* - * Set the User Defined Part of the Display - * This is the most mystical function (at least for me). - * What is the exact specification of xxx_set_var? - * Should it handle xoffset, yoffset? Should it do pannig? - * What does vmode mean? - */ +/** + * hga_set_var - set the user defined part of the display + * @var:new video mode + * @con:unused + * @info:pointer to fb_info object containing info for current hga board + * + * This function is called for changing video modes. Since HGA cards have + * only one fixed mode we have not much to do. After checking input + * parameters @var is copied to @info->var and @info->changevar is called. + * A zero is returned on success and %-EINVAL for failure. + * + * FIXME: + * This is the most mystical function (at least for me). + * What is the exact specification of xxx_set_var()? + * Should it handle xoffset, yoffset? Should it do panning? + * What does vmode mean? + */ int hga_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) { @@ -431,10 +458,20 @@ int hga_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) return 0; } - - /* - * Get the Colormap - */ +/** + * hga_getcolreg - read color registers + * @regno:register index to read out + * @red:red value + * @green:green value + * @blue:blue value + * @transp:transparency value + * @info:unused + * + * This callback function is used to read the color registers of a HGA + * board. Since we have only two fixed colors, RGB values are 0x0000 + * for register0 and 0xaaaa for register1. + * A zero is returned on success and 1 for failure. + */ static int hga_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue, u_int *transp, struct fb_info *info) @@ -450,6 +487,17 @@ static int hga_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue, return 0; } +/** + * hga_get_cmap - get the colormap + * @cmap:struct fb_cmap to fill in + * @kspc:called from kernel space? + * @con:unused + * @info:pointer to fb_info object containing info for current hga board + * + * This wrapper function passes it's input parameters to fb_get_cmap(). + * Callback function hga_getcolreg() is used to read the color registers. + */ + int hga_get_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info) { @@ -458,9 +506,19 @@ int hga_get_cmap(struct fb_cmap *cmap, int kspc, int con, return fb_get_cmap(cmap, kspc, hga_getcolreg, info); } - /* - * Set the Colormap - */ +/** + * hga_setcolreg - set color registers + * @regno:register index to set + * @red:red value, unused + * @green:green value, unused + * @blue:blue value, unused + * @transp:transparency value, unused + * @info:unused + * + * This callback function is used to set the color registers of a HGA + * board. Since we have only two fixed colors only @regno is checked. + * A zero is returned on success and 1 for failure. + */ static int hga_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) @@ -470,6 +528,17 @@ static int hga_setcolreg(u_int regno, u_int red, u_int green, u_int blue, return 0; } +/** + * hga_set_cmap - set the colormap + * @cmap:struct fb_cmap to set + * @kspc:called from kernel space? + * @con:unused + * @info:pointer to fb_info object containing info for current hga board + * + * This wrapper function passes it's input parameters to fb_set_cmap(). + * Callback function hga_setcolreg() is used to set the color registers. + */ + int hga_set_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info) { @@ -478,11 +547,17 @@ int hga_set_cmap(struct fb_cmap *cmap, int kspc, int con, return fb_set_cmap(cmap, kspc, hga_setcolreg, info); } - /* - * Pan or Wrap the Display - * - * This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag - */ +/** + * hga_pan_display - pan or wrap the display + * @var:contains new xoffset, yoffset and vmode values + * @con:unused + * @info:pointer to fb_info object containing info for current hga board + * + * This function looks only at xoffset, yoffset and the %FB_VMODE_YWRAP + * flag in @var. If input parameters are correct it calls hga_pan() to + * program the hardware. @info->var is updated to the new values. + * A zero is returned on success and %-EINVAL for failure. + */ int hga_pan_display(struct fb_var_screeninfo *var, int con, struct fb_info *info) @@ -531,6 +606,18 @@ static struct fb_ops hgafb_ops = { * * ------------------------------------------------------------------------- */ +/** + * hgafbcon_switch - switch console + * @con:new console to switch to + * @info:pointer to fb_info object containing info for current hga board + * + * This function should install a new colormap and change the video mode. + * Since we have fixed colors and only one video mode we have nothing to + * do. + * Only console administration is done but it should go to fbcon.c IMHO. + * A zero is returned on success and %-EINVAL for failure. + */ + static int hgafbcon_switch(int con, struct fb_info *info) { CHKINFO(-EINVAL); @@ -564,6 +651,17 @@ static int hgafbcon_switch(int con, struct fb_info *info) return 0; } +/** + * hgafbcon_updatevar - update the user defined part of the display + * @con:console to update or -1 when no consoles defined on this fb + * @info:pointer to fb_info object containing info for current hga board + * + * This function is called when @var is changed by fbcon.c without calling + * hga_set_var(). It usually means scrolling. hga_pan_display() is called + * to update the hardware and @info->var. + * A zero is returned on success and %-EINVAL for failure. + */ + static int hgafbcon_updatevar(int con, struct fb_info *info) { CHKINFO(-EINVAL); @@ -571,17 +669,21 @@ static int hgafbcon_updatevar(int con, struct fb_info *info) return (con < 0) ? -EINVAL : hga_pan_display(&fb_display[con].var, con, info); } +/** + * hgafbcon_blank - (un)blank the screen + * @blank_mode:blanking method to use + * @info:unused + * + * Blank the screen if blank_mode != 0, else unblank. + * Implements VESA suspend and powerdown modes on hardware that supports + * disabling hsync/vsync: + * @blank_mode == 2 means suspend vsync, + * @blank_mode == 3 means suspend hsync, + * @blank_mode == 4 means powerdown. + */ + static void hgafbcon_blank(int blank_mode, struct fb_info *info) { - /* - * Blank the screen if blank_mode != 0, else unblank. - * Implements VESA suspend and powerdown modes on hardware - * that supports disabling hsync/vsync: - * blank_mode == 2: suspend vsync - * blank_mode == 3: suspend hsync - * blank_mode == 4: powerdown - */ - CHKINFO( ); DPRINTK("hga_blank: blank_mode:%d, info:%x, fb_info:%x\n", blank_mode, (unsigned)info, (unsigned)&fb_info); diff --git a/drivers/video/matrox/matroxfb_DAC1064.c b/drivers/video/matrox/matroxfb_DAC1064.c index e8a3738f8..1c611ebee 100644 --- a/drivers/video/matrox/matroxfb_DAC1064.c +++ b/drivers/video/matrox/matroxfb_DAC1064.c @@ -4,14 +4,14 @@ * * (c) 1998,1999,2000 Petr Vandrovec <vandrove@vc.cvut.cz> * - * Version: 1.21 1999/01/09 + * Version: 1.50 2000/08/10 * * MTRR stuff: 1998 Tom Rini <trini@kernel.crashing.org> * * Contributors: "menion?" <menion@mindless.com> * Betatesting, fixes, ideas * - * "Kurt Garloff" <garloff@kg1.ping.de> + * "Kurt Garloff" <garloff@suse.de> * Betatesting, fixes, ideas, videomodes, videomodes timmings * * "Tom Rini" <trini@kernel.crashing.org> @@ -63,6 +63,9 @@ * "Mark Vojkovich" <mvojkovi@ucsd.edu> * G400 support * + * "Ken Aaker" <kdaaker@rchland.vnet.ibm.com> + * memtype extension (needed for GXT130P RS/6000 adapter) + * * (following author is not in any relation with this code, but his code * is included in this driver) * @@ -755,7 +758,7 @@ static int MGAG100_preinit(WPMINFO struct matrox_hw_state* hw){ if (ACCESS_FBINFO(devflags.noinit)) return 0; hw->MXoptionReg &= 0xC0000100; - hw->MXoptionReg |= 0x00078020; + hw->MXoptionReg |= 0x00000020; if (ACCESS_FBINFO(devflags.novga)) hw->MXoptionReg &= ~0x00000100; if (ACCESS_FBINFO(devflags.nobios)) @@ -763,13 +766,13 @@ static int MGAG100_preinit(WPMINFO struct matrox_hw_state* hw){ if (ACCESS_FBINFO(devflags.nopciretry)) hw->MXoptionReg |= 0x20000000; pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); - pci_read_config_dword(ACCESS_FBINFO(pcidev), 0x50, ®50); - reg50 &= ~0x3000; - pci_write_config_dword(ACCESS_FBINFO(pcidev), 0x50, reg50); - DAC1064_setmclk(PMINFO hw, DAC1064_OPT_MDIV2 | DAC1064_OPT_GDIV3 | DAC1064_OPT_SCLK_PCI, 133333); if (ACCESS_FBINFO(devflags.accelerator) == FB_ACCEL_MATROX_MGAG100) { + pci_read_config_dword(ACCESS_FBINFO(pcidev), 0x50, ®50); + reg50 &= ~0x3000; + pci_write_config_dword(ACCESS_FBINFO(pcidev), 0x50, reg50); + hw->MXoptionReg |= 0x1080; pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); mga_outl(M_CTLWTST, 0x00000300); @@ -797,20 +800,45 @@ static int MGAG100_preinit(WPMINFO struct matrox_hw_state* hw){ hw->MXoptionReg &= ~0x1000; } #endif + hw->MXoptionReg |= 0x00078020; + } else if (ACCESS_FBINFO(devflags.accelerator) == FB_ACCEL_MATROX_MGAG200) { + pci_read_config_dword(ACCESS_FBINFO(pcidev), 0x50, ®50); + reg50 &= ~0x3000; + pci_write_config_dword(ACCESS_FBINFO(pcidev), 0x50, reg50); + + if (ACCESS_FBINFO(devflags.memtype) == -1) + ACCESS_FBINFO(devflags.memtype) = 3; + hw->MXoptionReg |= (ACCESS_FBINFO(devflags.memtype) & 7) << 10; + if (ACCESS_FBINFO(devflags.sgram)) + hw->MXoptionReg |= 0x4000; + mga_outl(M_CTLWTST, 0x042450A1); + mga_outl(M_MEMRDBK, 0x00000108); + udelay(200); + mga_outl(M_MACCESS, 0x00000000); + mga_outl(M_MACCESS, 0x00008000); + udelay(100); + mga_outw(M_MEMRDBK, 0x00000108); + hw->MXoptionReg |= 0x00078020; } else { - hw->MXoptionReg |= 0x00000C00; + pci_read_config_dword(ACCESS_FBINFO(pcidev), 0x50, ®50); + reg50 &= ~0x00000100; + reg50 |= 0x00000000; + pci_write_config_dword(ACCESS_FBINFO(pcidev), 0x50, reg50); + + if (ACCESS_FBINFO(devflags.memtype) == -1) + ACCESS_FBINFO(devflags.memtype) = 0; + hw->MXoptionReg |= (ACCESS_FBINFO(devflags.memtype) & 7) << 10; if (ACCESS_FBINFO(devflags.sgram)) hw->MXoptionReg |= 0x4000; mga_outl(M_CTLWTST, 0x042450A1); - mga_outb(0x1E47, 0x00); - mga_outb(0x1E46, 0x00); - udelay(10); - mga_outb(0x1C05, 0x00); - mga_outb(0x1C05, 0x80); + mga_outl(M_MEMRDBK, 0x00000108); + udelay(200); + mga_outl(M_MACCESS, 0x00000000); + mga_outl(M_MACCESS, 0x00008000); udelay(100); - mga_outw(0x1E44, 0x0108); + mga_outl(M_MEMRDBK, 0x00000108); + hw->MXoptionReg |= 0x00040020; } - hw->MXoptionReg = (hw->MXoptionReg & ~0x1F8000) | 0x78000; pci_write_config_dword(ACCESS_FBINFO(pcidev), PCI_OPTION_REG, hw->MXoptionReg); return 0; } diff --git a/drivers/video/matrox/matroxfb_Ti3026.c b/drivers/video/matrox/matroxfb_Ti3026.c index 67dc556b0..7c65eaa0f 100644 --- a/drivers/video/matrox/matroxfb_Ti3026.c +++ b/drivers/video/matrox/matroxfb_Ti3026.c @@ -4,14 +4,14 @@ * * (c) 1998,1999,2000 Petr Vandrovec <vandrove@vc.cvut.cz> * - * Version: 1.21 2000/01/09 + * Version: 1.50 2000/08/10 * * MTRR stuff: 1998 Tom Rini <trini@kernel.crashing.org> * * Contributors: "menion?" <menion@mindless.com> * Betatesting, fixes, ideas * - * "Kurt Garloff" <garloff@kg1.ping.de> + * "Kurt Garloff" <garloff@suse.de> * Betatesting, fixes, ideas, videomodes, videomodes timmings * * "Tom Rini" <trini@kernel.crashing.org> diff --git a/drivers/video/matrox/matroxfb_accel.c b/drivers/video/matrox/matroxfb_accel.c index a28388e1e..d79e5e3e4 100644 --- a/drivers/video/matrox/matroxfb_accel.c +++ b/drivers/video/matrox/matroxfb_accel.c @@ -4,14 +4,14 @@ * * (c) 1998,1999,2000 Petr Vandrovec <vandrove@vc.cvut.cz> * - * Version: 1.21 2000/01/09 + * Version: 1.50 2000/08/10 * * MTRR stuff: 1998 Tom Rini <trini@kernel.crashing.org> * * Contributors: "menion?" <menion@mindless.com> * Betatesting, fixes, ideas * - * "Kurt Garloff" <garloff@kg1.ping.de> + * "Kurt Garloff" <garloff@suse.de> * Betatesting, fixes, ideas, videomodes, videomodes timmings * * "Tom Rini" <trini@kernel.crashing.org> diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index 9ddb30140..9a21d5dc7 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c @@ -4,14 +4,14 @@ * * (c) 1998,1999,2000 Petr Vandrovec <vandrove@vc.cvut.cz> * - * Version: 1.21 1999/01/09 + * Version: 1.50 2000/08/10 * * MTRR stuff: 1998 Tom Rini <trini@kernel.crashing.org> * * Contributors: "menion?" <menion@mindless.com> * Betatesting, fixes, ideas * - * "Kurt Garloff" <garloff@kg1.ping.de> + * "Kurt Garloff" <garloff@suse.de> * Betatesting, fixes, ideas, videomodes, videomodes timmings * * "Tom Rini" <trini@kernel.crashing.org> @@ -69,6 +69,9 @@ * "Anton Altaparmakov" <AntonA@bigfoot.com> * G400 MAX/non-MAX distinction * + * "Ken Aaker" <kdaaker@rchland.vnet.ibm.com> + * memtype extension (needed for GXT130P RS/6000 adapter) + * * (following author is not in any relation with this code, but his code * is included in this driver) * @@ -1312,6 +1315,7 @@ static unsigned int fv = 0; /* "matrox:fv:xxxxx" */ static unsigned int fh = 0; /* "matrox:fh:xxxxxk" */ static unsigned int maxclk = 0; /* "matrox:maxclk:xxxxM" */ static int dfp = 0; /* "matrox:dfp */ +static int memtype = -1; /* "matrox:memtype:xxx" */ static char fontname[64]; /* "matrox:font:xxxxx" */ #ifndef MODULE @@ -2037,6 +2041,9 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm memcpy(ACCESS_FBINFO(fbcon.fontname), fontname, sizeof(ACCESS_FBINFO(fbcon.fontname))); /* DEVFLAGS */ ACCESS_FBINFO(devflags.inverse) = inverse; + ACCESS_FBINFO(devflags.memtype) = memtype; + if (memtype != -1) + noinit = 0; if (cmd & PCI_COMMAND_MEMORY) { ACCESS_FBINFO(devflags.novga) = novga; ACCESS_FBINFO(devflags.nobios) = nobios; @@ -2050,6 +2057,7 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm ACCESS_FBINFO(devflags.nobios) = 1; ACCESS_FBINFO(devflags.noinit) = 0; } + ACCESS_FBINFO(devflags.nopciretry) = no_pci_retry; ACCESS_FBINFO(devflags.mga_24bpp_fix) = inv24; ACCESS_FBINFO(devflags.precise_width) = option_precise_width; @@ -2094,10 +2102,42 @@ static void pci_remove_matrox(struct pci_dev* pdev) { matroxfb_remove(PMINFO 1); } +static struct pci_device_id matroxfb_devices[] __devinitdata = { +#ifdef CONFIG_FB_MATROX_MILLENIUM + {PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_MIL, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_MIL_2, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_MIL_2_AGP, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, +#endif +#ifdef CONFIG_FB_MATROX_MYSTIQUE + {PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_MYS, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, +#endif +#ifdef CONFIG_FB_MATROX_G100 + {PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G100, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G100_AGP, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G200_PCI, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G200_AGP, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {PCI_VENDOR_ID_MATROX, PCI_DEVICE_ID_MATROX_G400_AGP, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, +#endif + {0, 0, + 0, 0, 0, 0, 0} +}; + +MODULE_DEVICE_TABLE(pci, matroxfb_devices); + static struct pci_driver matroxfb_driver = { - name: "matroxfb", - probe: matroxfb_probe, - remove: pci_remove_matrox, + name: "matroxfb", + id_table: matroxfb_devices, + probe: matroxfb_probe, + remove: pci_remove_matrox, }; /* **************************** init-time only **************************** */ @@ -2378,6 +2418,8 @@ int __init matroxfb_setup(char *options) { sgram = 1; else if (!strcmp(this_opt, "sdram")) sgram = 0; + else if (!strncmp(this_opt, "memtype:", 8)) + memtype = simple_strtoul(this_opt+8, NULL, 0); else { int value = 1; @@ -2461,6 +2503,8 @@ MODULE_PARM(nobios, "i"); MODULE_PARM_DESC(nobios, "Disables ROM BIOS (0 or 1=disabled) (default=do not change BIOS state)"); MODULE_PARM(noinit, "i"); MODULE_PARM_DESC(noinit, "Disables W/SG/SD-RAM and bus interface initialization (0 or 1=do not initialize) (default=0)"); +MODULE_PARM(memtype, "i"); +MODULE_PARM_DESC(memtype, "Memory type for G200/G400 (see Documentation/fb/matroxfb.txt for explanation) (default=3 for G200, 0 for G400)"); MODULE_PARM(mtrr, "i"); MODULE_PARM_DESC(mtrr, "This speeds up video memory accesses (0=disabled or 1) (default=1)"); MODULE_PARM(sgram, "i"); diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index c8a47fe9e..125f8be4f 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h @@ -2,7 +2,7 @@ * * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200 and G400 * - * (c) 1998,1999 Petr Vandrovec <vandrove@vc.cvut.cz> + * (c) 1998,1999,2000 Petr Vandrovec <vandrove@vc.cvut.cz> * */ #ifndef __MATROXFB_H__ @@ -530,6 +530,7 @@ struct matrox_fb_info { unsigned int textvram; /* character cells */ unsigned int ydstorg; /* offset in bytes from video start to usable memory */ /* 0 except for 6MB Millenium */ + int memtype; } devflags; struct display_switch dispsw; struct { @@ -695,6 +696,7 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv); #define M_VCOUNT 0x1E20 #define M_RESET 0x1E40 +#define M_MEMRDBK 0x1E44 #define M_AGP2PLL 0x1E4C diff --git a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/matrox/matroxfb_misc.c index 126ab9b66..ff9d6fb75 100644 --- a/drivers/video/matrox/matroxfb_misc.c +++ b/drivers/video/matrox/matroxfb_misc.c @@ -4,14 +4,14 @@ * * (c) 1998,1999,2000 Petr Vandrovec <vandrove@vc.cvut.cz> * - * Version: 1.21 2000/01/09 + * Version: 1.50 2000/08/10 * * MTRR stuff: 1998 Tom Rini <trini@kernel.crashing.org> * * Contributors: "menion?" <menion@mindless.com> * Betatesting, fixes, ideas * - * "Kurt Garloff" <garloff@kg1.ping.de> + * "Kurt Garloff" <garloff@suse.de> * Betatesting, fixes, ideas, videomodes, videomodes timmings * * "Tom Rini" <trini@kernel.crashing.org> diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index df86a674e..aa955b41c 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c @@ -12,17 +12,40 @@ /* * Code Status: - * 4/1/99 - Driver appears to be working for Brutus 320x200x8bpp mode. Other - * resolutions are working, but only the 8bpp mode is supported. - * Changes need to be made to the palette encode and decode routines - * to support 4 and 16 bpp modes. - * Driver is not designed to be a module. The FrameBuffer is statically - * allocated since dynamic allocation of a 300k buffer cannot be guaranteed. - * - * 6/17/99 - FrameBuffer memory is now allocated at run-time when the - * driver is initialized. + * 1999/04/01: + * Driver appears to be working for Brutus 320x200x8bpp mode. Other + * resolutions are working, but only the 8bpp mode is supported. + * Changes need to be made to the palette encode and decode routines + * to support 4 and 16 bpp modes. + * Driver is not designed to be a module. The FrameBuffer is statically + * allocated since dynamic allocation of a 300k buffer cannot be + * guaranteed. + * + * 1999/06/17: + * FrameBuffer memory is now allocated at run-time when the + * driver is initialized. * + * 2000/04/10: + * Big cleanup for dynamic selection of machine type at run time. + * Nicolas Pitre <nico@cam.org> + * + * 2000/07/19: + * Support for Bitsy aka Compaq iPAQ H3600 added. + * Jamey Hicks <jamey@crl.dec.com> + * + * 2000/08/07: + * Resolved an issue caused by a change made to the Assabet's PLD + * earlier this year which broke the framebuffer driver for newer + * Phase 4 Assabets. Some other parameters were changed to optimize for + * the Sharp display. + * Tak-Shing Chan <tchan.rd@idthk.com> + * Jeff Sutherland <jsutherland@accelent.com> + * + * 2000/08/09: + * XP860 support added + * Kunihiko IMAI <???> */ + #include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> @@ -41,6 +64,7 @@ #include <asm/hardware.h> #include <asm/io.h> #include <asm/irq.h> +#include <asm/mach-types.h> #include <asm/uaccess.h> #include <asm/proc/pgtable.h> @@ -324,7 +348,7 @@ static int sa1100fb_encode_var(struct fb_var_screeninfo *var, struct sa1100fb_par *par) { - // Don't know if really want to var on entry. + // Don't know if really want to zero var on entry. // Look at set_var to see. If so, may need to add extra params to par // memset(var, 0, sizeof(struct fb_var_screeninfo)); @@ -347,15 +371,26 @@ sa1100fb_encode_var(struct fb_var_screeninfo *var, break; case 12: // This case should differ for Active/Passive mode case 16: - var->red.length = 5; - var->green.length = 6; - var->blue.length = 5; - var->transp.length = 0; - var->red.offset = 11; - var->green.offset = 5; - var->blue.offset = 0; - var->transp.offset = 0; - break; + if (machine_is_bitsy()) { + var->red.length = 4; + var->blue.length = 4; + var->green.length = 4; + var->transp.length = 0; + var->red.offset = 12; + var->green.offset = 7; + var->blue.offset = 1; + var->transp.offset = 0; + } else { + var->red.length = 5; + var->blue.length = 5; + var->green.length = 6; + var->transp.length = 0; + var->red.offset = 11; + var->green.offset = 5; + var->blue.offset = 0; + var->transp.offset = 0; + } + break; } return 0; } @@ -425,10 +460,13 @@ sa1100fb_decode_var(struct fb_var_screeninfo *var, DPRINTK("p_palette_base = 0x%08lx\n",(u_long)par->p_palette_base); DPRINTK("v_palette_base = 0x%08lx\n",(u_long)par->v_palette_base); + DPRINTK("palette_size = 0x%08lx\n",(u_long)par->palette_size); + DPRINTK("palette_mem_size = 0x%08lx\n",(u_long)palette_mem_size); DPRINTK("p_screen_base = 0x%08lx\n",(u_long)par->p_screen_base); DPRINTK("v_screen_base = 0x%08lx\n",(u_long)par->v_screen_base); DPRINTK("VideoMemRegion = 0x%08lx\n",(u_long)VideoMemRegion); DPRINTK("VideoMemRegion_phys = 0x%08lx\n",(u_long)VideoMemRegion_phys); + return 0; } @@ -463,8 +501,6 @@ sa1100fb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) else display = &global_disp; /* Default display settings */ - - DPRINTK("xres = %d, yres = %d\n",var->xres, var->yres); /* Decode var contents into a par structure, adjusting any */ /* out of range values. */ if ((err = sa1100fb_decode_var(var, &par))) @@ -490,7 +526,6 @@ sa1100fb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) (memcmp(&display->var.blue, &var->blue, sizeof(var->blue)))) chgvar = 1; } - DPRINTK("chgvar=%d\n", chgvar); display->var = *var; display->screen_base = par.v_screen_base; @@ -505,8 +540,6 @@ sa1100fb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) display->can_soft_blank = 1; display->inverse = 0; - DPRINTK("display->var.bits_per_pixel=%d xres=%d yres=%d display->dispsw=%p\n", - display->var.bits_per_pixel, var->xres, var->yres, display->dispsw); switch (display->var.bits_per_pixel) { #ifdef FBCON_HAS_CFB4 case 4: @@ -545,7 +578,6 @@ sa1100fb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) cmap = &display->cmap; else cmap = fb_default_cmap(current_par.palette_size); - DPRINTK("visual=%d palette_size=%d cmap=%p\n", current_par.visual, current_par.palette_size, cmap); fb_set_cmap(cmap, 1, sa1100fb_setcolreg, info); } @@ -634,14 +666,18 @@ __init sa1100fb_init_fbinfo(void) init_var.blue.length = 5; init_var.grayscale = 0; init_var.sync = 0; + init_var.pixclock = 171521; } else if (machine_is_bitsy()) { current_par.max_xres = 320; current_par.max_yres = 240; current_par.max_bpp = 16; - init_var.red.length = 5; - init_var.green.length = 6; - init_var.blue.length = 5; - init_var.grayscale = 0; + init_var.red.length = 4; + init_var.green.length = 4; + init_var.blue.length = 4; + init_var.red.offset = 12; + init_var.green.offset = 7; + init_var.blue.offset = 1; + init_var.grayscale = 0; } else if (machine_is_brutus()) { current_par.max_xres = 320; current_par.max_yres = 240; @@ -694,6 +730,23 @@ __init sa1100fb_init_fbinfo(void) init_var.vsync_len = 1; init_var.sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT; init_var.vmode = 0; + } else if (machine_is_xp860()) { + current_par.max_xres = 1024; + current_par.max_yres = 768; + + current_par.max_bpp = 8; + init_var.red.length = 4; + init_var.green = init_var.red; + init_var.blue = init_var.red; + + init_var.hsync_len = 4; + init_var.left_margin = 3; + init_var.right_margin = 2; + + init_var.vsync_len = 3; + init_var.upper_margin = 2; + init_var.lower_margin = 1; + } current_par.p_palette_base = NULL; @@ -769,7 +822,6 @@ __init sa1100fb_map_video_memory(void) L_PTE_YOUNG | L_PTE_DIRTY | L_PTE_WRITE); - memset(VideoMemRegion, 0xAA, ALLOCATED_FB_MEM_SIZE); return (VideoMemRegion == NULL ? -EINVAL : 0); } @@ -804,6 +856,12 @@ static inline int get_pcd(unsigned int pixclock) /* the last multiplication by 1.2 is to handle */ /* sync problems */ } + if (machine_is_assabet()) { + pcd = frequency[PPCR & 0xf] / 1000; + pcd *= pixclock / 1000; + pcd = pcd / 1000000; + pcd++; /* make up for integer math truncations */ + } return pcd; } @@ -844,12 +902,12 @@ sa1100fb_activate_var(struct fb_var_screeninfo *var) LCCR1_DisWdth(var->xres) + LCCR1_HorSnchWdth(6) + LCCR1_BegLnDel(61) + LCCR1_EndLnDel(9); lcd_shadow.lccr2 = - LCCR2_DisHght(var->yres) + LCCR2_VrtSnchWdth(2) + + LCCR2_DisHght(var->yres) + LCCR2_VrtSnchWdth(1) + LCCR2_BegFrmDel(3) + LCCR2_EndFrmDel(0); lcd_shadow.lccr3 = LCCR3_OutEnH + LCCR3_PixFlEdg + LCCR3_VrtSnchH + LCCR3_HorSnchH + LCCR3_ACBsCntOff + - LCCR3_ACBsDiv(2) + LCCR3_PixClkDiv(38); + LCCR3_ACBsDiv(2) + LCCR3_PixClkDiv(pcd); /* Set board control register to handle new color depth */ sa1100fb_assabet_set_truecolor(var->bits_per_pixel >= 16); @@ -860,29 +918,33 @@ sa1100fb_activate_var(struct fb_var_screeninfo *var) LCCR0_DMADel(0); lcd_shadow.lccr1 = LCCR1_DisWdth( var->xres ) + LCCR1_HorSnchWdth( 4 ) + - LCCR1_BegLnDel( 0x1f ) + - LCCR1_EndLnDel( 0x1f ); - lcd_shadow.lccr2 = LCCR2_DisHght( var->yres ) + - LCCR2_VrtSnchWdth( 1 )+ - LCCR2_BegFrmDel( 0 ) + - LCCR2_EndFrmDel( 0 ); - lcd_shadow.lccr3 = 15; + LCCR1_BegLnDel( 0xC ) + + LCCR1_EndLnDel( 0x11 ); + lcd_shadow.lccr2 = LCCR2_DisHght( var->yres + 1 ) + + LCCR2_VrtSnchWdth( 3 )+ + LCCR2_BegFrmDel( 10 ) + + LCCR2_EndFrmDel( 1 ); + lcd_shadow.lccr3 = (/* PCD */ 0x10 + | /* ACB */ 0 + | /* API */ 0 + | LCCR3_VrtSnchL + | LCCR3_HorSnchL); } else if (machine_is_brutus()) { - DPRINTK("Configuring Brutus LCD\n"); - lcd_shadow.lccr0 = - LCCR0_LEN + LCCR0_Color + LCCR0_Sngl + LCCR0_Pas + - LCCR0_LtlEnd + LCCR0_LDM + LCCR0_BAM + LCCR0_ERM + - LCCR0_DMADel(0); - lcd_shadow.lccr1 = - LCCR1_DisWdth(var->xres) + LCCR1_HorSnchWdth(4) + - LCCR1_BegLnDel(41) + LCCR1_EndLnDel(101); - lcd_shadow.lccr2 = - LCCR2_DisHght(var->yres) + LCCR2_VrtSnchWdth(1) + - LCCR2_BegFrmDel(0) + LCCR2_EndFrmDel(0); - lcd_shadow.lccr3 = - LCCR3_OutEnH + LCCR3_PixFlEdg + LCCR3_VrtSnchH + - LCCR3_HorSnchH + LCCR3_ACBsCntOff + - LCCR3_ACBsDiv(2) + LCCR3_PixClkDiv(44); + DPRINTK("Configuring Brutus LCD\n"); + lcd_shadow.lccr0 = + LCCR0_LEN + LCCR0_Color + LCCR0_Sngl + LCCR0_Pas + + LCCR0_LtlEnd + LCCR0_LDM + LCCR0_BAM + LCCR0_ERM + + LCCR0_DMADel(0); + lcd_shadow.lccr1 = + LCCR1_DisWdth(var->xres) + LCCR1_HorSnchWdth(4) + + LCCR1_BegLnDel(41) + LCCR1_EndLnDel(101); + lcd_shadow.lccr2 = + LCCR2_DisHght(var->yres) + LCCR2_VrtSnchWdth(1) + + LCCR2_BegFrmDel(0) + LCCR2_EndFrmDel(0); + lcd_shadow.lccr3 = + LCCR3_OutEnH + LCCR3_PixFlEdg + LCCR3_VrtSnchH + + LCCR3_HorSnchH + LCCR3_ACBsCntOff + + LCCR3_ACBsDiv(2) + LCCR3_PixClkDiv(44); } else if (machine_is_lart()) { DPRINTK("Configuring LART LCD\n"); lcd_shadow.lccr0 = @@ -950,6 +1012,25 @@ sa1100fb_activate_var(struct fb_var_screeninfo *var) ((current_var.sync & FB_SYNC_HOR_HIGH_ACT) ? LCCR3_HorSnchH : LCCR3_HorSnchL) + ((current_var.sync & FB_SYNC_VERT_HIGH_ACT) ? LCCR3_VrtSnchH : LCCR3_VrtSnchL); */ + } else if (machine_is_xp860()) { + DPRINTK("Configuring XP860 LCD\n"); + lcd_shadow.lccr0 = + LCCR0_LEN + LCCR0_Color + LCCR0_Sngl + LCCR0_Act + + LCCR0_LtlEnd + LCCR0_LDM + LCCR0_ERM + + LCCR0_DMADel(0); + lcd_shadow.lccr1 = + LCCR1_DisWdth(var->xres) + + LCCR1_HorSnchWdth(var->hsync_len) + + LCCR1_BegLnDel(var->left_margin) + + LCCR1_EndLnDel(var->right_margin); + lcd_shadow.lccr2 = + LCCR2_DisHght(var->yres) + + LCCR2_VrtSnchWdth(var->vsync_len) + + LCCR2_BegFrmDel(var->upper_margin) + + LCCR2_EndFrmDel(var->lower_margin); + lcd_shadow.lccr3 = + LCCR3_PixClkDiv(6) + + LCCR3_HorSnchL + LCCR3_VrtSnchL; } /* Restore interrupt status */ @@ -976,10 +1057,12 @@ sa1100fb_activate_var(struct fb_var_screeninfo *var) static void sa1100fb_inter_handler(int irq, void *dev_id, struct pt_regs *regs) { if (LCSR & LCSR_LDD) { + int controller_state = current_par.controller_state; /* Disable Done Flag is set */ LCCR0 |= LCCR0_LDM; /* Mask LCD Disable Done Interrupt */ current_par.controller_state = LCD_MODE_DISABLED; - if (current_par.controller_state == LCD_MODE_DISABLE_BEFORE_ENABLE) { + if (controller_state == LCD_MODE_DISABLE_BEFORE_ENABLE) { + DPRINTK("sa1100fb_inter_handler: re-enabling LCD controller\n"); sa1100fb_enable_lcd_controller(); } } @@ -1010,7 +1093,8 @@ static void sa1100fb_disable_lcd_controller(void) #endif } else if (machine_is_bitsy()) { #ifdef CONFIG_SA1100_BITSY - clr_bitsy_egpio(EGPIO_BITSY_LCD_ON | EGPIO_BITSY_LCD_PCI | EGPIO_BITSY_LCD_5V_ON | EGPIO_BITSY_LVDD_ON); + if (current_par.controller_state != LCD_MODE_DISABLE_BEFORE_ENABLE) + clr_bitsy_egpio(EGPIO_BITSY_LCD_ON | EGPIO_BITSY_LCD_PCI | EGPIO_BITSY_LCD_5V_ON | EGPIO_BITSY_LVDD_ON); #endif } else if (machine_is_penny()) { #ifdef CONFIG_SA1100_PENNY @@ -1066,7 +1150,7 @@ static void sa1100fb_enable_lcd_controller(void) #endif } else if (machine_is_bitsy()) { #ifdef CONFIG_SA1100_BITSY - set_bitsy_egpio(EGPIO_BITSY_LCD_ON | EGPIO_BITSY_LCD_PCI | EGPIO_BITSY_LCD_5V_ON | EGPIO_BITSY_LVDD_ON) + set_bitsy_egpio(EGPIO_BITSY_LCD_ON | EGPIO_BITSY_LCD_PCI | EGPIO_BITSY_LCD_5V_ON | EGPIO_BITSY_LVDD_ON); DPRINTK("DBAR1=%p\n", DBAR1); DPRINTK("LCCR0=%x\n", LCCR0); DPRINTK("LCCR1=%x\n", LCCR1); @@ -1115,6 +1199,7 @@ sa1100fb_blank(int blank, struct fb_info *info) current_par.currcon, info); sa1100fb_enable_lcd_controller(); } + /* TODO: Bitsy support for blanking display */ } @@ -1164,7 +1249,7 @@ int __init sa1100fb_init(void) current_par.montype = 1; if (request_irq(IRQ_LCD, sa1100fb_inter_handler, SA_INTERRUPT, "SA1100 LCD", NULL) != 0) { - printk("sa1100fb: failed in request_irq\n"); + printk(KERN_ERR "sa1100fb: failed in request_irq\n"); return -EBUSY; } DPRINTK("sa1100fb: request_irq succeeded\n"); @@ -1185,6 +1270,9 @@ int __init sa1100fb_init(void) #endif } else if (machine_is_tifon()) { GPDR |= GPIO_GPIO(24); /* set GPIO24 to output */ + } else if (machine_is_xp860()) { + GPDR |= 0x3fc; + GAFR |= 0x3fc; } if (sa1100fb_set_var(&init_var, -1, &fb_info)) |