Commit 122e8ad3 authored by Krzysztof Helt's avatar Krzysztof Helt Committed by Linus Torvalds

tridentfb: move global chip_id into structure

This patch moves the chip_id into tridentfb_par structure and removes global
chip_id related constants.

It also bumps version of the driver to 0.7.9
Signed-off-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ea8ee55c
...@@ -24,11 +24,12 @@ ...@@ -24,11 +24,12 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <video/trident.h> #include <video/trident.h>
#define VERSION "0.7.8-NEWAPI" #define VERSION "0.7.9-NEWAPI"
struct tridentfb_par { struct tridentfb_par {
void __iomem *io_virt; /* iospace virtual memory address */ void __iomem *io_virt; /* iospace virtual memory address */
u32 pseudo_pal[16]; u32 pseudo_pal[16];
int chip_id;
}; };
static unsigned char eng_oper; /* engine operation... */ static unsigned char eng_oper; /* engine operation... */
...@@ -42,9 +43,6 @@ static struct fb_fix_screeninfo tridentfb_fix = { ...@@ -42,9 +43,6 @@ static struct fb_fix_screeninfo tridentfb_fix = {
.accel = FB_ACCEL_NONE, .accel = FB_ACCEL_NONE,
}; };
static int chip_id;
static int defaultaccel;
static int displaytype; static int displaytype;
/* defaults which are normally overriden by user values */ /* defaults which are normally overriden by user values */
...@@ -79,9 +77,6 @@ module_param(nativex, int, 0); ...@@ -79,9 +77,6 @@ module_param(nativex, int, 0);
module_param(fp, int, 0); module_param(fp, int, 0);
module_param(crt, int, 0); module_param(crt, int, 0);
static int chip3D;
static int chipcyber;
static int is3Dchip(int id) static int is3Dchip(int id)
{ {
return ((id == BLADE3D) || (id == CYBERBLADEE4) || return ((id == BLADE3D) || (id == CYBERBLADEE4) ||
...@@ -658,7 +653,7 @@ static void set_lwidth(struct tridentfb_par *par, int width) ...@@ -658,7 +653,7 @@ static void set_lwidth(struct tridentfb_par *par, int width)
/* For resolutions smaller than FP resolution stretch */ /* For resolutions smaller than FP resolution stretch */
static void screen_stretch(struct tridentfb_par *par) static void screen_stretch(struct tridentfb_par *par)
{ {
if (chip_id != CYBERBLADEXPAi1) if (par->chip_id != CYBERBLADEXPAi1)
write3CE(par, BiosReg, 0); write3CE(par, BiosReg, 0);
else else
write3CE(par, BiosReg, 8); write3CE(par, BiosReg, 8);
...@@ -706,7 +701,7 @@ static void set_vclk(struct tridentfb_par *par, unsigned long freq) ...@@ -706,7 +701,7 @@ static void set_vclk(struct tridentfb_par *par, unsigned long freq)
if (fi > freq) if (fi > freq)
break; break;
} }
if (chip3D) { if (is3Dchip(par->chip_id)) {
write3C4(par, ClockHigh, hi); write3C4(par, ClockHigh, hi);
write3C4(par, ClockLow, lo); write3C4(par, ClockLow, lo);
} else { } else {
...@@ -739,7 +734,7 @@ static unsigned int __devinit get_displaytype(struct tridentfb_par *par) ...@@ -739,7 +734,7 @@ static unsigned int __devinit get_displaytype(struct tridentfb_par *par)
{ {
if (fp) if (fp)
return DISPLAY_FP; return DISPLAY_FP;
if (crt || !chipcyber) if (crt || !iscyber(par->chip_id))
return DISPLAY_CRT; return DISPLAY_CRT;
return (read3CE(par, FPConfig) & 0x10) ? DISPLAY_FP : DISPLAY_CRT; return (read3CE(par, FPConfig) & 0x10) ? DISPLAY_FP : DISPLAY_CRT;
} }
...@@ -754,7 +749,7 @@ static unsigned int __devinit get_memsize(struct tridentfb_par *par) ...@@ -754,7 +749,7 @@ static unsigned int __devinit get_memsize(struct tridentfb_par *par)
if (memsize) if (memsize)
k = memsize * Kb; k = memsize * Kb;
else else
switch (chip_id) { switch (par->chip_id) {
case CYBER9525DVD: case CYBER9525DVD:
k = 2560 * Kb; k = 2560 * Kb;
break; break;
...@@ -1034,7 +1029,7 @@ static int tridentfb_set_par(struct fb_info *info) ...@@ -1034,7 +1029,7 @@ static int tridentfb_set_par(struct fb_info *info)
write3X4(par, PixelBusReg, tmp); write3X4(par, PixelBusReg, tmp);
tmp = 0x10; tmp = 0x10;
if (chipcyber) if (iscyber(par->chip_id))
tmp |= 0x20; tmp |= 0x20;
write3X4(par, DRAMControl, tmp); /* both IO, linear enable */ write3X4(par, DRAMControl, tmp); /* both IO, linear enable */
...@@ -1062,7 +1057,7 @@ static int tridentfb_set_par(struct fb_info *info) ...@@ -1062,7 +1057,7 @@ static int tridentfb_set_par(struct fb_info *info)
write3CE(par, 0x6, 0x05); /* graphics mode */ write3CE(par, 0x6, 0x05); /* graphics mode */
write3CE(par, 0x7, 0x0F); /* planes? */ write3CE(par, 0x7, 0x0F); /* planes? */
if (chip_id == CYBERBLADEXPAi1) { if (par->chip_id == CYBERBLADEXPAi1) {
/* This fixes snow-effect in 32 bpp */ /* This fixes snow-effect in 32 bpp */
write3X4(par, CRTHSyncStart, 0x84); write3X4(par, CRTHSyncStart, 0x84);
} }
...@@ -1217,6 +1212,9 @@ static int __devinit trident_pci_probe(struct pci_dev *dev, ...@@ -1217,6 +1212,9 @@ static int __devinit trident_pci_probe(struct pci_dev *dev,
unsigned char revision; unsigned char revision;
struct fb_info *info; struct fb_info *info;
struct tridentfb_par *default_par; struct tridentfb_par *default_par;
int defaultaccel;
int chip3D;
int chip_id;
err = pci_enable_device(dev); err = pci_enable_device(dev);
if (err) if (err)
...@@ -1269,7 +1267,6 @@ static int __devinit trident_pci_probe(struct pci_dev *dev, ...@@ -1269,7 +1267,6 @@ static int __devinit trident_pci_probe(struct pci_dev *dev,
} }
chip3D = is3Dchip(chip_id); chip3D = is3Dchip(chip_id);
chipcyber = iscyber(chip_id);
if (is_xp(chip_id)) { if (is_xp(chip_id)) {
acc = &accel_xp; acc = &accel_xp;
...@@ -1279,6 +1276,8 @@ static int __devinit trident_pci_probe(struct pci_dev *dev, ...@@ -1279,6 +1276,8 @@ static int __devinit trident_pci_probe(struct pci_dev *dev,
acc = &accel_image; acc = &accel_image;
} }
default_par->chip_id = chip_id;
/* acceleration is on by default for 3D chips */ /* acceleration is on by default for 3D chips */
defaultaccel = chip3D && !noaccel; defaultaccel = chip3D && !noaccel;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment