aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/tridentfb.c83
-rw-r--r--include/video/trident.h4
2 files changed, 32 insertions, 55 deletions
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c
index 279411523ed9..b6065effc5e0 100644
--- a/drivers/video/tridentfb.c
+++ b/drivers/video/tridentfb.c
@@ -24,8 +24,6 @@
24#include <video/vga.h> 24#include <video/vga.h>
25#include <video/trident.h> 25#include <video/trident.h>
26 26
27#define VERSION "0.7.9-NEWAPI"
28
29struct tridentfb_par { 27struct tridentfb_par {
30 void __iomem *io_virt; /* iospace virtual memory address */ 28 void __iomem *io_virt; /* iospace virtual memory address */
31 u32 pseudo_pal[16]; 29 u32 pseudo_pal[16];
@@ -37,9 +35,9 @@ struct tridentfb_par {
37 (struct tridentfb_par *par, u32, u32, u32, u32, u32, u32); 35 (struct tridentfb_par *par, u32, u32, u32, u32, u32, u32);
38 void (*copy_rect) 36 void (*copy_rect)
39 (struct tridentfb_par *par, u32, u32, u32, u32, u32, u32); 37 (struct tridentfb_par *par, u32, u32, u32, u32, u32, u32);
38 unsigned char eng_oper; /* engine operation... */
40}; 39};
41 40
42static unsigned char eng_oper; /* engine operation... */
43static struct fb_ops tridentfb_ops; 41static struct fb_ops tridentfb_ops;
44 42
45static struct fb_fix_screeninfo tridentfb_fix = { 43static struct fb_fix_screeninfo tridentfb_fix = {
@@ -53,7 +51,7 @@ static struct fb_fix_screeninfo tridentfb_fix = {
53/* defaults which are normally overriden by user values */ 51/* defaults which are normally overriden by user values */
54 52
55/* video mode */ 53/* video mode */
56static char *mode_option __devinitdata = "640x480"; 54static char *mode_option __devinitdata = "640x480-8@60";
57static int bpp __devinitdata = 8; 55static int bpp __devinitdata = 8;
58 56
59static int noaccel __devinitdata; 57static int noaccel __devinitdata;
@@ -84,24 +82,22 @@ MODULE_PARM_DESC(fp, "Define if flatpanel is connected");
84module_param(crt, int, 0); 82module_param(crt, int, 0);
85MODULE_PARM_DESC(crt, "Define if CRT is connected"); 83MODULE_PARM_DESC(crt, "Define if CRT is connected");
86 84
87static int is_oldclock(int id) 85static inline int is_oldclock(int id)
88{ 86{
89 return (id == TGUI9440) || 87 return (id == TGUI9440) ||
90 (id == TGUI9660) || 88 (id == TGUI9660) ||
91 (id == CYBER9320); 89 (id == CYBER9320);
92} 90}
93 91
94static int is_oldprotect(int id) 92static inline int is_oldprotect(int id)
95{ 93{
96 return (id == TGUI9440) || 94 return is_oldclock(id) ||
97 (id == TGUI9660) ||
98 (id == PROVIDIA9685) || 95 (id == PROVIDIA9685) ||
99 (id == CYBER9320) ||
100 (id == CYBER9382) || 96 (id == CYBER9382) ||
101 (id == CYBER9385); 97 (id == CYBER9385);
102} 98}
103 99
104static int is_blade(int id) 100static inline int is_blade(int id)
105{ 101{
106 return (id == BLADE3D) || 102 return (id == BLADE3D) ||
107 (id == CYBERBLADEE4) || 103 (id == CYBERBLADEE4) ||
@@ -113,27 +109,22 @@ static int is_blade(int id)
113 (id == CYBERBLADEAi1D); 109 (id == CYBERBLADEAi1D);
114} 110}
115 111
116static int is_xp(int id) 112static inline int is_xp(int id)
117{ 113{
118 return (id == CYBERBLADEXPAi1) || 114 return (id == CYBERBLADEXPAi1) ||
119 (id == CYBERBLADEXPm8) || 115 (id == CYBERBLADEXPm8) ||
120 (id == CYBERBLADEXPm16); 116 (id == CYBERBLADEXPm16);
121} 117}
122 118
123static int is3Dchip(int id) 119static inline int is3Dchip(int id)
124{ 120{
125 return ((id == BLADE3D) || (id == CYBERBLADEE4) || 121 return is_blade(id) || is_xp(id) ||
126 (id == CYBERBLADEi7) || (id == CYBERBLADEi7D) ||
127 (id == CYBER9397) || (id == CYBER9397DVD) || 122 (id == CYBER9397) || (id == CYBER9397DVD) ||
128 (id == CYBER9520) || (id == CYBER9525DVD) || 123 (id == CYBER9520) || (id == CYBER9525DVD) ||
129 (id == IMAGE975) || (id == IMAGE985) || 124 (id == IMAGE975) || (id == IMAGE985);
130 (id == CYBERBLADEi1) || (id == CYBERBLADEi1D) ||
131 (id == CYBERBLADEAi1) || (id == CYBERBLADEAi1D) ||
132 (id == CYBERBLADEXPm8) || (id == CYBERBLADEXPm16) ||
133 (id == CYBERBLADEXPAi1));
134} 125}
135 126
136static int iscyber(int id) 127static inline int iscyber(int id)
137{ 128{
138 switch (id) { 129 switch (id) {
139 case CYBER9388: 130 case CYBER9388:
@@ -153,13 +144,7 @@ static int iscyber(int id)
153 return 1; 144 return 1;
154 145
155 case CYBER9320: 146 case CYBER9320:
156 case TGUI9660:
157 case PROVIDIA9685:
158 case IMAGE975:
159 case IMAGE985:
160 case BLADE3D:
161 case CYBERBLADEi7: /* VIA MPV4 integrated version */ 147 case CYBERBLADEi7: /* VIA MPV4 integrated version */
162
163 default: 148 default:
164 /* case CYBERBLDAEXPm8: Strange */ 149 /* case CYBERBLDAEXPm8: Strange */
165 /* case CYBERBLDAEXPm16: Strange */ 150 /* case CYBERBLDAEXPm16: Strange */
@@ -275,7 +260,7 @@ static void xp_init_accel(struct tridentfb_par *par, int pitch, int bpp)
275 260
276 t_outb(par, x, 0x2125); 261 t_outb(par, x, 0x2125);
277 262
278 eng_oper = x | 0x40; 263 par->eng_oper = x | 0x40;
279 264
280 writemmr(par, 0x2154, v1); 265 writemmr(par, 0x2154, v1);
281 writemmr(par, 0x2150, v1); 266 writemmr(par, 0x2150, v1);
@@ -284,10 +269,9 @@ static void xp_init_accel(struct tridentfb_par *par, int pitch, int bpp)
284 269
285static void xp_wait_engine(struct tridentfb_par *par) 270static void xp_wait_engine(struct tridentfb_par *par)
286{ 271{
287 int count, timeout; 272 int count = 0;
273 int timeout = 0;
288 274
289 count = 0;
290 timeout = 0;
291 while (t_inb(par, STATUS) & 0x80) { 275 while (t_inb(par, STATUS) & 0x80) {
292 count++; 276 count++;
293 if (count == 10000000) { 277 if (count == 10000000) {
@@ -313,16 +297,14 @@ static void xp_fill_rect(struct tridentfb_par *par,
313 writemmr(par, OLDDIM, point(h, w)); 297 writemmr(par, OLDDIM, point(h, w));
314 writemmr(par, OLDDST, point(y, x)); 298 writemmr(par, OLDDST, point(y, x));
315 t_outb(par, 0x01, OLDCMD); 299 t_outb(par, 0x01, OLDCMD);
316 t_outb(par, eng_oper, 0x2125); 300 t_outb(par, par->eng_oper, 0x2125);
317} 301}
318 302
319static void xp_copy_rect(struct tridentfb_par *par, 303static void xp_copy_rect(struct tridentfb_par *par,
320 u32 x1, u32 y1, u32 x2, u32 y2, u32 w, u32 h) 304 u32 x1, u32 y1, u32 x2, u32 y2, u32 w, u32 h)
321{ 305{
322 int direction;
323 u32 x1_tmp, x2_tmp, y1_tmp, y2_tmp; 306 u32 x1_tmp, x2_tmp, y1_tmp, y2_tmp;
324 307 int direction = 0x0004;
325 direction = 0x0004;
326 308
327 if ((x1 < x2) && (y1 == y2)) { 309 if ((x1 < x2) && (y1 == y2)) {
328 direction |= 0x0200; 310 direction |= 0x0200;
@@ -602,7 +584,7 @@ static void disable_mmio(struct tridentfb_par *par)
602 t_outb(par, t_inb(par, 0x3D5) & ~0x01, 0x3D5); 584 t_outb(par, t_inb(par, 0x3D5) & ~0x01, 0x3D5);
603} 585}
604 586
605static void crtc_unlock(struct tridentfb_par *par) 587static inline void crtc_unlock(struct tridentfb_par *par)
606{ 588{
607 write3X4(par, VGA_CRTC_V_SYNC_END, 589 write3X4(par, VGA_CRTC_V_SYNC_END,
608 read3X4(par, VGA_CRTC_V_SYNC_END) & 0x7F); 590 read3X4(par, VGA_CRTC_V_SYNC_END) & 0x7F);
@@ -642,7 +624,7 @@ static int __devinit get_nativex(struct tridentfb_par *par)
642} 624}
643 625
644/* Set pitch */ 626/* Set pitch */
645static void set_lwidth(struct tridentfb_par *par, int width) 627static inline void set_lwidth(struct tridentfb_par *par, int width)
646{ 628{
647 write3X4(par, VGA_CRTC_OFFSET, width & 0xFF); 629 write3X4(par, VGA_CRTC_OFFSET, width & 0xFF);
648 write3X4(par, AddColReg, 630 write3X4(par, AddColReg,
@@ -661,7 +643,7 @@ static void screen_stretch(struct tridentfb_par *par)
661} 643}
662 644
663/* For resolutions smaller than FP resolution center */ 645/* For resolutions smaller than FP resolution center */
664static void screen_center(struct tridentfb_par *par) 646static inline void screen_center(struct tridentfb_par *par)
665{ 647{
666 write3CE(par, VertStretch, (read3CE(par, VertStretch) & 0x7C) | 0x80); 648 write3CE(par, VertStretch, (read3CE(par, VertStretch) & 0x7C) | 0x80);
667 write3CE(par, HorStretch, (read3CE(par, HorStretch) & 0x7C) | 0x80); 649 write3CE(par, HorStretch, (read3CE(par, HorStretch) & 0x7C) | 0x80);
@@ -967,12 +949,12 @@ static int tridentfb_pan_display(struct fb_var_screeninfo *var,
967 return 0; 949 return 0;
968} 950}
969 951
970static void shadowmode_on(struct tridentfb_par *par) 952static inline void shadowmode_on(struct tridentfb_par *par)
971{ 953{
972 write3CE(par, CyberControl, read3CE(par, CyberControl) | 0x81); 954 write3CE(par, CyberControl, read3CE(par, CyberControl) | 0x81);
973} 955}
974 956
975static void shadowmode_off(struct tridentfb_par *par) 957static inline void shadowmode_off(struct tridentfb_par *par)
976{ 958{
977 write3CE(par, CyberControl, read3CE(par, CyberControl) & 0x7E); 959 write3CE(par, CyberControl, read3CE(par, CyberControl) & 0x7E);
978} 960}
@@ -980,7 +962,7 @@ static void shadowmode_off(struct tridentfb_par *par)
980/* Set the hardware to the requested video mode */ 962/* Set the hardware to the requested video mode */
981static int tridentfb_set_par(struct fb_info *info) 963static int tridentfb_set_par(struct fb_info *info)
982{ 964{
983 struct tridentfb_par *par = (struct tridentfb_par *)(info->par); 965 struct tridentfb_par *par = info->par;
984 u32 htotal, hdispend, hsyncstart, hsyncend, hblankstart, hblankend; 966 u32 htotal, hdispend, hsyncstart, hsyncend, hblankstart, hblankend;
985 u32 vtotal, vdispend, vsyncstart, vsyncend, vblankstart, vblankend; 967 u32 vtotal, vdispend, vsyncstart, vsyncend, vblankstart, vblankend;
986 struct fb_var_screeninfo *var = &info->var; 968 struct fb_var_screeninfo *var = &info->var;
@@ -1159,11 +1141,6 @@ static int tridentfb_set_par(struct fb_info *info)
1159 write3CE(par, 0x6, 0x05); /* graphics mode */ 1141 write3CE(par, 0x6, 0x05); /* graphics mode */
1160 write3CE(par, 0x7, 0x0F); /* planes? */ 1142 write3CE(par, 0x7, 0x0F); /* planes? */
1161 1143
1162 if (par->chip_id == CYBERBLADEXPAi1) {
1163 /* This fixes snow-effect in 32 bpp */
1164 write3X4(par, VGA_CRTC_H_SYNC_START, 0x84);
1165 }
1166
1167 /* graphics mode and support 256 color modes */ 1144 /* graphics mode and support 256 color modes */
1168 writeAttr(par, 0x10, 0x41); 1145 writeAttr(par, 0x10, 0x41);
1169 writeAttr(par, 0x12, 0x0F); /* planes */ 1146 writeAttr(par, 0x12, 0x0F); /* planes */
@@ -1238,7 +1215,7 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green,
1238 col |= col << 16; 1215 col |= col << 16;
1239 ((u32 *)(info->pseudo_palette))[regno] = col; 1216 ((u32 *)(info->pseudo_palette))[regno] = col;
1240 } else if (bpp == 32) /* ARGB 8888 */ 1217 } else if (bpp == 32) /* ARGB 8888 */
1241 ((u32*)info->pseudo_palette)[regno] = 1218 ((u32 *)info->pseudo_palette)[regno] =
1242 ((transp & 0xFF00) << 16) | 1219 ((transp & 0xFF00) << 16) |
1243 ((red & 0xFF00) << 8) | 1220 ((red & 0xFF00) << 8) |
1244 ((green & 0xFF00)) | 1221 ((green & 0xFF00)) |
@@ -1249,7 +1226,7 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green,
1249 return 0; 1226 return 0;
1250} 1227}
1251 1228
1252/* Try blanking the screen.For flat panels it does nothing */ 1229/* Try blanking the screen. For flat panels it does nothing */
1253static int tridentfb_blank(int blank_mode, struct fb_info *info) 1230static int tridentfb_blank(int blank_mode, struct fb_info *info)
1254{ 1231{
1255 unsigned char PMCont, DPMSCont; 1232 unsigned char PMCont, DPMSCont;
@@ -1408,9 +1385,10 @@ static int __devinit trident_pci_probe(struct pci_dev *dev,
1408 1385
1409 /* setup MMIO region */ 1386 /* setup MMIO region */
1410 tridentfb_fix.mmio_start = pci_resource_start(dev, 1); 1387 tridentfb_fix.mmio_start = pci_resource_start(dev, 1);
1411 tridentfb_fix.mmio_len = chip3D ? 0x20000 : 0x10000; 1388 tridentfb_fix.mmio_len = pci_resource_len(dev, 1);
1412 1389
1413 if (!request_mem_region(tridentfb_fix.mmio_start, tridentfb_fix.mmio_len, "tridentfb")) { 1390 if (!request_mem_region(tridentfb_fix.mmio_start,
1391 tridentfb_fix.mmio_len, "tridentfb")) {
1414 debug("request_region failed!\n"); 1392 debug("request_region failed!\n");
1415 framebuffer_release(info); 1393 framebuffer_release(info);
1416 return -1; 1394 return -1;
@@ -1431,7 +1409,8 @@ static int __devinit trident_pci_probe(struct pci_dev *dev,
1431 tridentfb_fix.smem_start = pci_resource_start(dev, 0); 1409 tridentfb_fix.smem_start = pci_resource_start(dev, 0);
1432 tridentfb_fix.smem_len = get_memsize(default_par); 1410 tridentfb_fix.smem_len = get_memsize(default_par);
1433 1411
1434 if (!request_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len, "tridentfb")) { 1412 if (!request_mem_region(tridentfb_fix.smem_start,
1413 tridentfb_fix.smem_len, "tridentfb")) {
1435 debug("request_mem_region failed!\n"); 1414 debug("request_mem_region failed!\n");
1436 disable_mmio(info->par); 1415 disable_mmio(info->par);
1437 err = -1; 1416 err = -1;
@@ -1447,7 +1426,6 @@ static int __devinit trident_pci_probe(struct pci_dev *dev,
1447 goto out_unmap2; 1426 goto out_unmap2;
1448 } 1427 }
1449 1428
1450 output("%s board found\n", pci_name(dev));
1451 default_par->flatpanel = is_flatpanel(default_par); 1429 default_par->flatpanel = is_flatpanel(default_par);
1452 1430
1453 if (default_par->flatpanel) 1431 if (default_par->flatpanel)
@@ -1477,7 +1455,7 @@ static int __devinit trident_pci_probe(struct pci_dev *dev,
1477 info->var.activate |= FB_ACTIVATE_NOW; 1455 info->var.activate |= FB_ACTIVATE_NOW;
1478 info->device = &dev->dev; 1456 info->device = &dev->dev;
1479 if (register_framebuffer(info) < 0) { 1457 if (register_framebuffer(info) < 0) {
1480 printk(KERN_ERR "tridentfb: could not register Trident framebuffer\n"); 1458 printk(KERN_ERR "tridentfb: could not register framebuffer\n");
1481 fb_dealloc_cmap(&info->cmap); 1459 fb_dealloc_cmap(&info->cmap);
1482 err = -EINVAL; 1460 err = -EINVAL;
1483 goto out_unmap2; 1461 goto out_unmap2;
@@ -1599,7 +1577,6 @@ static int __init tridentfb_init(void)
1599 return -ENODEV; 1577 return -ENODEV;
1600 tridentfb_setup(option); 1578 tridentfb_setup(option);
1601#endif 1579#endif
1602 output("Trident framebuffer %s initializing\n", VERSION);
1603 return pci_register_driver(&tridentfb_pci_driver); 1580 return pci_register_driver(&tridentfb_pci_driver);
1604} 1581}
1605 1582
diff --git a/include/video/trident.h b/include/video/trident.h
index 7540501bc040..85ced9d91312 100644
--- a/include/video/trident.h
+++ b/include/video/trident.h
@@ -4,9 +4,9 @@
4#endif 4#endif
5 5
6#if TRIDENTFB_DEBUG 6#if TRIDENTFB_DEBUG
7#define debug(f,a...) printk("%s:" f, __FUNCTION__ , ## a);mdelay(100); 7#define debug(f, a...) printk("%s:" f, __func__ , ## a);
8#else 8#else
9#define debug(f,a...) 9#define debug(f, a...)
10#endif 10#endif
11 11
12#define output(f, a...) pr_info("tridentfb: " f, ## a) 12#define output(f, a...) pr_info("tridentfb: " f, ## a)