aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2008-07-24 00:30:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:34 -0400
commit122e8ad3cbf172043ea93f2db8e107fa9f9b0192 (patch)
tree0eebc68bfe19e162bbaa34970fa3715d796deae5 /drivers
parentea8ee55c12f77cbbb6e067f91e0cd794baa692ab (diff)
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: Krzysztof Helt <krzysztof.h1@wp.pl> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/tridentfb.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c
index 0f6e4054c996..dfe52b424c97 100644
--- a/drivers/video/tridentfb.c
+++ b/drivers/video/tridentfb.c
@@ -24,11 +24,12 @@
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <video/trident.h> 25#include <video/trident.h>
26 26
27#define VERSION "0.7.8-NEWAPI" 27#define VERSION "0.7.9-NEWAPI"
28 28
29struct tridentfb_par { 29struct tridentfb_par {
30 void __iomem *io_virt; /* iospace virtual memory address */ 30 void __iomem *io_virt; /* iospace virtual memory address */
31 u32 pseudo_pal[16]; 31 u32 pseudo_pal[16];
32 int chip_id;
32}; 33};
33 34
34static unsigned char eng_oper; /* engine operation... */ 35static unsigned char eng_oper; /* engine operation... */
@@ -42,9 +43,6 @@ static struct fb_fix_screeninfo tridentfb_fix = {
42 .accel = FB_ACCEL_NONE, 43 .accel = FB_ACCEL_NONE,
43}; 44};
44 45
45static int chip_id;
46
47static int defaultaccel;
48static int displaytype; 46static int displaytype;
49 47
50/* defaults which are normally overriden by user values */ 48/* defaults which are normally overriden by user values */
@@ -79,9 +77,6 @@ module_param(nativex, int, 0);
79module_param(fp, int, 0); 77module_param(fp, int, 0);
80module_param(crt, int, 0); 78module_param(crt, int, 0);
81 79
82static int chip3D;
83static int chipcyber;
84
85static int is3Dchip(int id) 80static int is3Dchip(int id)
86{ 81{
87 return ((id == BLADE3D) || (id == CYBERBLADEE4) || 82 return ((id == BLADE3D) || (id == CYBERBLADEE4) ||
@@ -658,7 +653,7 @@ static void set_lwidth(struct tridentfb_par *par, int width)
658/* For resolutions smaller than FP resolution stretch */ 653/* For resolutions smaller than FP resolution stretch */
659static void screen_stretch(struct tridentfb_par *par) 654static void screen_stretch(struct tridentfb_par *par)
660{ 655{
661 if (chip_id != CYBERBLADEXPAi1) 656 if (par->chip_id != CYBERBLADEXPAi1)
662 write3CE(par, BiosReg, 0); 657 write3CE(par, BiosReg, 0);
663 else 658 else
664 write3CE(par, BiosReg, 8); 659 write3CE(par, BiosReg, 8);
@@ -706,7 +701,7 @@ static void set_vclk(struct tridentfb_par *par, unsigned long freq)
706 if (fi > freq) 701 if (fi > freq)
707 break; 702 break;
708 } 703 }
709 if (chip3D) { 704 if (is3Dchip(par->chip_id)) {
710 write3C4(par, ClockHigh, hi); 705 write3C4(par, ClockHigh, hi);
711 write3C4(par, ClockLow, lo); 706 write3C4(par, ClockLow, lo);
712 } else { 707 } else {
@@ -739,7 +734,7 @@ static unsigned int __devinit get_displaytype(struct tridentfb_par *par)
739{ 734{
740 if (fp) 735 if (fp)
741 return DISPLAY_FP; 736 return DISPLAY_FP;
742 if (crt || !chipcyber) 737 if (crt || !iscyber(par->chip_id))
743 return DISPLAY_CRT; 738 return DISPLAY_CRT;
744 return (read3CE(par, FPConfig) & 0x10) ? DISPLAY_FP : DISPLAY_CRT; 739 return (read3CE(par, FPConfig) & 0x10) ? DISPLAY_FP : DISPLAY_CRT;
745} 740}
@@ -754,7 +749,7 @@ static unsigned int __devinit get_memsize(struct tridentfb_par *par)
754 if (memsize) 749 if (memsize)
755 k = memsize * Kb; 750 k = memsize * Kb;
756 else 751 else
757 switch (chip_id) { 752 switch (par->chip_id) {
758 case CYBER9525DVD: 753 case CYBER9525DVD:
759 k = 2560 * Kb; 754 k = 2560 * Kb;
760 break; 755 break;
@@ -1034,7 +1029,7 @@ static int tridentfb_set_par(struct fb_info *info)
1034 write3X4(par, PixelBusReg, tmp); 1029 write3X4(par, PixelBusReg, tmp);
1035 1030
1036 tmp = 0x10; 1031 tmp = 0x10;
1037 if (chipcyber) 1032 if (iscyber(par->chip_id))
1038 tmp |= 0x20; 1033 tmp |= 0x20;
1039 write3X4(par, DRAMControl, tmp); /* both IO, linear enable */ 1034 write3X4(par, DRAMControl, tmp); /* both IO, linear enable */
1040 1035
@@ -1062,7 +1057,7 @@ static int tridentfb_set_par(struct fb_info *info)
1062 write3CE(par, 0x6, 0x05); /* graphics mode */ 1057 write3CE(par, 0x6, 0x05); /* graphics mode */
1063 write3CE(par, 0x7, 0x0F); /* planes? */ 1058 write3CE(par, 0x7, 0x0F); /* planes? */
1064 1059
1065 if (chip_id == CYBERBLADEXPAi1) { 1060 if (par->chip_id == CYBERBLADEXPAi1) {
1066 /* This fixes snow-effect in 32 bpp */ 1061 /* This fixes snow-effect in 32 bpp */
1067 write3X4(par, CRTHSyncStart, 0x84); 1062 write3X4(par, CRTHSyncStart, 0x84);
1068 } 1063 }
@@ -1217,6 +1212,9 @@ static int __devinit trident_pci_probe(struct pci_dev *dev,
1217 unsigned char revision; 1212 unsigned char revision;
1218 struct fb_info *info; 1213 struct fb_info *info;
1219 struct tridentfb_par *default_par; 1214 struct tridentfb_par *default_par;
1215 int defaultaccel;
1216 int chip3D;
1217 int chip_id;
1220 1218
1221 err = pci_enable_device(dev); 1219 err = pci_enable_device(dev);
1222 if (err) 1220 if (err)
@@ -1269,7 +1267,6 @@ static int __devinit trident_pci_probe(struct pci_dev *dev,
1269 } 1267 }
1270 1268
1271 chip3D = is3Dchip(chip_id); 1269 chip3D = is3Dchip(chip_id);
1272 chipcyber = iscyber(chip_id);
1273 1270
1274 if (is_xp(chip_id)) { 1271 if (is_xp(chip_id)) {
1275 acc = &accel_xp; 1272 acc = &accel_xp;
@@ -1279,6 +1276,8 @@ static int __devinit trident_pci_probe(struct pci_dev *dev,
1279 acc = &accel_image; 1276 acc = &accel_image;
1280 } 1277 }
1281 1278
1279 default_par->chip_id = chip_id;
1280
1282 /* acceleration is on by default for 3D chips */ 1281 /* acceleration is on by default for 3D chips */
1283 defaultaccel = chip3D && !noaccel; 1282 defaultaccel = chip3D && !noaccel;
1284 1283