2 * linux/drivers/video/riva/fbdev.c - nVidia RIVA 128/TNT/TNT2 fb driver
4 * Maintained by Ani Joshi <ajoshi@shell.unixbox.com>
6 * Copyright 1999-2000 Jeff Garzik
10 * Ani Joshi: Lots of debugging and cleanup work, really helped
11 * get the driver going
13 * Ferenc Bakonyi: Bug fixes, cleanup, modularization
15 * Jindrich Makovicka: Accel code help, hw cursor, mtrr
17 * Paul Richards: Bug fixes, updates
19 * Initial template from skeletonfb.c, created 28 Dec 1997 by Geert Uytterhoeven
20 * Includes riva_hw.c from nVidia, see copyright below.
21 * KGI code provided the basis for state storage, init, and mode switching.
23 * This file is subject to the terms and conditions of the GNU General Public
24 * License. See the file COPYING in the main directory of this archive
27 * Known bugs and issues:
28 * restoring text mode fails
29 * doublescan modes are broken
32 #include <linux/module.h>
33 #include <linux/kernel.h>
34 #include <linux/errno.h>
35 #include <linux/string.h>
37 #include <linux/slab.h>
38 #include <linux/delay.h>
40 #include <linux/init.h>
41 #include <linux/pci.h>
42 #include <linux/backlight.h>
43 #include <linux/bitrev.h>
49 #include <asm/pci-bridge.h>
51 #ifdef CONFIG_PMAC_BACKLIGHT
52 #include <asm/machdep.h>
53 #include <asm/backlight.h>
59 #ifndef CONFIG_PCI /* sanity check */
60 #error This driver requires PCI support.
63 /* version number of this driver */
64 #define RIVAFB_VERSION "0.9.5b"
66 /* ------------------------------------------------------------------------- *
68 * various helpful macros and constants
70 * ------------------------------------------------------------------------- */
71 #ifdef CONFIG_FB_RIVA_DEBUG
72 #define NVTRACE printk
74 #define NVTRACE if(0) printk
77 #define NVTRACE_ENTER(...) NVTRACE("%s START\n", __FUNCTION__)
78 #define NVTRACE_LEAVE(...) NVTRACE("%s END\n", __FUNCTION__)
80 #ifdef CONFIG_FB_RIVA_DEBUG
81 #define assert(expr) \
83 printk( "Assertion failed! %s,%s,%s,line=%d\n",\
84 #expr,__FILE__,__FUNCTION__,__LINE__); \
91 #define PFX "rivafb: "
93 /* macro that allows you to set overflow bits */
94 #define SetBitField(value,from,to) SetBF(to,GetBF(value,from))
95 #define SetBit(n) (1<<(n))
96 #define Set8Bits(value) ((value)&0xff)
98 /* HW cursor parameters */
101 /* ------------------------------------------------------------------------- *
105 * ------------------------------------------------------------------------- */
107 static int rivafb_blank(int blank, struct fb_info *info);
109 /* ------------------------------------------------------------------------- *
111 * card identification
113 * ------------------------------------------------------------------------- */
115 static struct pci_device_id rivafb_pci_tbl[] = {
116 { PCI_VENDOR_ID_NVIDIA_SGS, PCI_DEVICE_ID_NVIDIA_SGS_RIVA128,
117 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
118 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_TNT,
119 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
120 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_TNT2,
121 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
122 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_UTNT2,
123 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
124 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_VTNT2,
125 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
126 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_UVTNT2,
127 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
128 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_ITNT2,
129 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
130 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR,
131 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
132 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR,
133 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
134 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO,
135 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
136 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX,
137 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
138 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX2,
139 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
140 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE2_GO,
141 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
142 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO2_MXR,
143 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
144 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS,
145 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
146 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS2,
147 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
148 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE2_ULTRA,
149 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
150 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO2_PRO,
151 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
152 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_460,
153 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
154 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440,
155 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
156 // NF2/IGP version, GeForce 4 MX, NV18
157 { PCI_VENDOR_ID_NVIDIA, 0x01f0,
158 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
159 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420,
160 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
161 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO,
162 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
163 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_420_GO,
164 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
165 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_420_GO_M32,
166 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
167 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_500XGL,
168 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
169 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO_M64,
170 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
171 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_200,
172 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
173 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_550XGL,
174 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
175 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_500_GOGL,
176 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
177 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_IGEFORCE2,
178 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
179 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE3,
180 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
181 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE3_1,
182 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
183 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE3_2,
184 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
185 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO_DDC,
186 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
187 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4600,
188 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
189 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4400,
190 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
191 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4200,
192 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
193 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL,
194 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
195 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL,
196 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
197 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL,
198 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
199 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO_5200,
200 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
201 { 0, } /* terminate list */
203 MODULE_DEVICE_TABLE(pci, rivafb_pci_tbl);
205 /* ------------------------------------------------------------------------- *
209 * ------------------------------------------------------------------------- */
211 /* command line data, set in rivafb_setup() */
212 static int flatpanel __devinitdata = -1; /* Autodetect later */
213 static int forceCRTC __devinitdata = -1;
214 static int noaccel __devinitdata = 0;
216 static int nomtrr __devinitdata = 0;
219 static char *mode_option __devinitdata = NULL;
220 static int strictmode = 0;
222 static struct fb_fix_screeninfo __devinitdata rivafb_fix = {
223 .type = FB_TYPE_PACKED_PIXELS,
228 static struct fb_var_screeninfo __devinitdata rivafb_default_var = {
238 .activate = FB_ACTIVATE_NOW,
248 .vmode = FB_VMODE_NONINTERLACED
252 static const struct riva_regs reg_template = {
253 {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* ATTR */
254 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
255 0x41, 0x01, 0x0F, 0x00, 0x00},
256 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* CRT */
257 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
258 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, /* 0x10 */
259 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
260 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20 */
261 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
262 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30 */
263 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
266 {0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0F, /* GRA */
268 {0x03, 0x01, 0x0F, 0x00, 0x0E}, /* SEQ */
275 #ifdef CONFIG_FB_RIVA_BACKLIGHT
276 /* We do not have any information about which values are allowed, thus
277 * we used safe values.
279 #define MIN_LEVEL 0x158
280 #define MAX_LEVEL 0x534
281 #define LEVEL_STEP ((MAX_LEVEL - MIN_LEVEL) / FB_BACKLIGHT_MAX)
283 static struct backlight_properties riva_bl_data;
285 /* Call with fb_info->bl_mutex held */
286 static int riva_bl_get_level_brightness(struct riva_par *par,
289 struct fb_info *info = pci_get_drvdata(par->pdev);
292 /* Get and convert the value */
293 nlevel = MIN_LEVEL + info->bl_curve[level] * LEVEL_STEP;
297 else if (nlevel < MIN_LEVEL)
299 else if (nlevel > MAX_LEVEL)
305 /* Call with fb_info->bl_mutex held */
306 static int __riva_bl_update_status(struct backlight_device *bd)
308 struct riva_par *par = class_get_devdata(&bd->class_dev);
309 U032 tmp_pcrt, tmp_pmc;
312 if (bd->props->power != FB_BLANK_UNBLANK ||
313 bd->props->fb_blank != FB_BLANK_UNBLANK)
316 level = bd->props->brightness;
318 tmp_pmc = par->riva.PMC[0x10F0/4] & 0x0000FFFF;
319 tmp_pcrt = par->riva.PCRTC0[0x081C/4] & 0xFFFFFFFC;
322 tmp_pmc |= (1 << 31); /* backlight bit */
323 tmp_pmc |= riva_bl_get_level_brightness(par, level) << 16; /* level */
325 par->riva.PCRTC0[0x081C/4] = tmp_pcrt;
326 par->riva.PMC[0x10F0/4] = tmp_pmc;
331 static int riva_bl_update_status(struct backlight_device *bd)
333 struct riva_par *par = class_get_devdata(&bd->class_dev);
334 struct fb_info *info = pci_get_drvdata(par->pdev);
337 mutex_lock(&info->bl_mutex);
338 ret = __riva_bl_update_status(bd);
339 mutex_unlock(&info->bl_mutex);
344 static int riva_bl_get_brightness(struct backlight_device *bd)
346 return bd->props->brightness;
349 static struct backlight_properties riva_bl_data = {
350 .owner = THIS_MODULE,
351 .get_brightness = riva_bl_get_brightness,
352 .update_status = riva_bl_update_status,
353 .max_brightness = (FB_BACKLIGHT_LEVELS - 1),
356 static void riva_bl_set_power(struct fb_info *info, int power)
358 mutex_lock(&info->bl_mutex);
361 down(&info->bl_dev->sem);
362 info->bl_dev->props->power = power;
363 __riva_bl_update_status(info->bl_dev);
364 up(&info->bl_dev->sem);
367 mutex_unlock(&info->bl_mutex);
370 static void riva_bl_init(struct riva_par *par)
372 struct fb_info *info = pci_get_drvdata(par->pdev);
373 struct backlight_device *bd;
379 #ifdef CONFIG_PMAC_BACKLIGHT
380 if (!machine_is(powermac) ||
381 !pmac_has_backlight_type("mnca"))
385 snprintf(name, sizeof(name), "rivabl%d", info->node);
387 bd = backlight_device_register(name, info->dev, par, &riva_bl_data);
390 printk(KERN_WARNING "riva: Backlight registration failed\n");
394 mutex_lock(&info->bl_mutex);
396 fb_bl_default_curve(info, 0,
397 MIN_LEVEL * FB_BACKLIGHT_MAX / MAX_LEVEL,
399 mutex_unlock(&info->bl_mutex);
402 bd->props->brightness = riva_bl_data.max_brightness;
403 bd->props->power = FB_BLANK_UNBLANK;
404 bd->props->update_status(bd);
407 #ifdef CONFIG_PMAC_BACKLIGHT
408 mutex_lock(&pmac_backlight_mutex);
411 mutex_unlock(&pmac_backlight_mutex);
414 printk("riva: Backlight initialized (%s)\n", name);
422 static void riva_bl_exit(struct riva_par *par)
424 struct fb_info *info = pci_get_drvdata(par->pdev);
426 #ifdef CONFIG_PMAC_BACKLIGHT
427 mutex_lock(&pmac_backlight_mutex);
430 mutex_lock(&info->bl_mutex);
432 #ifdef CONFIG_PMAC_BACKLIGHT
433 if (pmac_backlight == info->bl_dev)
434 pmac_backlight = NULL;
437 backlight_device_unregister(info->bl_dev);
439 printk("riva: Backlight unloaded\n");
441 mutex_unlock(&info->bl_mutex);
443 #ifdef CONFIG_PMAC_BACKLIGHT
444 mutex_unlock(&pmac_backlight_mutex);
448 static inline void riva_bl_init(struct riva_par *par) {}
449 static inline void riva_bl_exit(struct riva_par *par) {}
450 static inline void riva_bl_set_power(struct fb_info *info, int power) {}
451 #endif /* CONFIG_FB_RIVA_BACKLIGHT */
453 /* ------------------------------------------------------------------------- *
457 * ------------------------------------------------------------------------- */
459 static inline void CRTCout(struct riva_par *par, unsigned char index,
462 VGA_WR08(par->riva.PCIO, 0x3d4, index);
463 VGA_WR08(par->riva.PCIO, 0x3d5, val);
466 static inline unsigned char CRTCin(struct riva_par *par,
469 VGA_WR08(par->riva.PCIO, 0x3d4, index);
470 return (VGA_RD08(par->riva.PCIO, 0x3d5));
473 static inline void GRAout(struct riva_par *par, unsigned char index,
476 VGA_WR08(par->riva.PVIO, 0x3ce, index);
477 VGA_WR08(par->riva.PVIO, 0x3cf, val);
480 static inline unsigned char GRAin(struct riva_par *par,
483 VGA_WR08(par->riva.PVIO, 0x3ce, index);
484 return (VGA_RD08(par->riva.PVIO, 0x3cf));
487 static inline void SEQout(struct riva_par *par, unsigned char index,
490 VGA_WR08(par->riva.PVIO, 0x3c4, index);
491 VGA_WR08(par->riva.PVIO, 0x3c5, val);
494 static inline unsigned char SEQin(struct riva_par *par,
497 VGA_WR08(par->riva.PVIO, 0x3c4, index);
498 return (VGA_RD08(par->riva.PVIO, 0x3c5));
501 static inline void ATTRout(struct riva_par *par, unsigned char index,
504 VGA_WR08(par->riva.PCIO, 0x3c0, index);
505 VGA_WR08(par->riva.PCIO, 0x3c0, val);
508 static inline unsigned char ATTRin(struct riva_par *par,
511 VGA_WR08(par->riva.PCIO, 0x3c0, index);
512 return (VGA_RD08(par->riva.PCIO, 0x3c1));
515 static inline void MISCout(struct riva_par *par, unsigned char val)
517 VGA_WR08(par->riva.PVIO, 0x3c2, val);
520 static inline unsigned char MISCin(struct riva_par *par)
522 return (VGA_RD08(par->riva.PVIO, 0x3cc));
525 static inline void reverse_order(u32 *l)
528 a[0] = bitrev8(a[0]);
529 a[1] = bitrev8(a[1]);
530 a[2] = bitrev8(a[2]);
531 a[3] = bitrev8(a[3]);
534 /* ------------------------------------------------------------------------- *
538 * ------------------------------------------------------------------------- */
541 * rivafb_load_cursor_image - load cursor image to hardware
542 * @data: address to monochrome bitmap (1 = foreground color, 0 = background)
543 * @par: pointer to private data
544 * @w: width of cursor image in pixels
545 * @h: height of cursor image in scanlines
546 * @bg: background color (ARGB1555) - alpha bit determines opacity
547 * @fg: foreground color (ARGB1555)
550 * Loads cursor image based on a monochrome source and mask bitmap. The
551 * image bits determines the color of the pixel, 0 for background, 1 for
552 * foreground. Only the affected region (as determined by @w and @h
553 * parameters) will be updated.
558 static void rivafb_load_cursor_image(struct riva_par *par, u8 *data8,
559 u16 bg, u16 fg, u32 w, u32 h)
563 u32 *data = (u32 *)data8;
564 bg = le16_to_cpu(bg);
565 fg = le16_to_cpu(fg);
569 for (i = 0; i < h; i++) {
573 for (j = 0; j < w/2; j++) {
575 #if defined (__BIG_ENDIAN)
576 tmp = (b & (1 << 31)) ? fg << 16 : bg << 16;
578 tmp |= (b & (1 << 31)) ? fg : bg;
581 tmp = (b & 1) ? fg : bg;
583 tmp |= (b & 1) ? fg << 16 : bg << 16;
586 writel(tmp, &par->riva.CURSOR[k++]);
588 k += (MAX_CURS - w)/2;
592 /* ------------------------------------------------------------------------- *
594 * general utility functions
596 * ------------------------------------------------------------------------- */
599 * riva_wclut - set CLUT entry
600 * @chip: pointer to RIVA_HW_INST object
601 * @regnum: register number
602 * @red: red component
603 * @green: green component
604 * @blue: blue component
607 * Sets color register @regnum.
612 static void riva_wclut(RIVA_HW_INST *chip,
613 unsigned char regnum, unsigned char red,
614 unsigned char green, unsigned char blue)
616 VGA_WR08(chip->PDIO, 0x3c8, regnum);
617 VGA_WR08(chip->PDIO, 0x3c9, red);
618 VGA_WR08(chip->PDIO, 0x3c9, green);
619 VGA_WR08(chip->PDIO, 0x3c9, blue);
623 * riva_rclut - read fromCLUT register
624 * @chip: pointer to RIVA_HW_INST object
625 * @regnum: register number
626 * @red: red component
627 * @green: green component
628 * @blue: blue component
631 * Reads red, green, and blue from color register @regnum.
636 static void riva_rclut(RIVA_HW_INST *chip,
637 unsigned char regnum, unsigned char *red,
638 unsigned char *green, unsigned char *blue)
641 VGA_WR08(chip->PDIO, 0x3c7, regnum);
642 *red = VGA_RD08(chip->PDIO, 0x3c9);
643 *green = VGA_RD08(chip->PDIO, 0x3c9);
644 *blue = VGA_RD08(chip->PDIO, 0x3c9);
648 * riva_save_state - saves current chip state
649 * @par: pointer to riva_par object containing info for current riva board
650 * @regs: pointer to riva_regs object
653 * Saves current chip state to @regs.
659 static void riva_save_state(struct riva_par *par, struct riva_regs *regs)
664 par->riva.LockUnlock(&par->riva, 0);
666 par->riva.UnloadStateExt(&par->riva, ®s->ext);
668 regs->misc_output = MISCin(par);
670 for (i = 0; i < NUM_CRT_REGS; i++)
671 regs->crtc[i] = CRTCin(par, i);
673 for (i = 0; i < NUM_ATC_REGS; i++)
674 regs->attr[i] = ATTRin(par, i);
676 for (i = 0; i < NUM_GRC_REGS; i++)
677 regs->gra[i] = GRAin(par, i);
679 for (i = 0; i < NUM_SEQ_REGS; i++)
680 regs->seq[i] = SEQin(par, i);
685 * riva_load_state - loads current chip state
686 * @par: pointer to riva_par object containing info for current riva board
687 * @regs: pointer to riva_regs object
690 * Loads chip state from @regs.
693 * riva_load_video_mode()
698 static void riva_load_state(struct riva_par *par, struct riva_regs *regs)
700 RIVA_HW_STATE *state = ®s->ext;
704 CRTCout(par, 0x11, 0x00);
706 par->riva.LockUnlock(&par->riva, 0);
708 par->riva.LoadStateExt(&par->riva, state);
710 MISCout(par, regs->misc_output);
712 for (i = 0; i < NUM_CRT_REGS; i++) {
718 CRTCout(par, i, regs->crtc[i]);
722 for (i = 0; i < NUM_ATC_REGS; i++)
723 ATTRout(par, i, regs->attr[i]);
725 for (i = 0; i < NUM_GRC_REGS; i++)
726 GRAout(par, i, regs->gra[i]);
728 for (i = 0; i < NUM_SEQ_REGS; i++)
729 SEQout(par, i, regs->seq[i]);
734 * riva_load_video_mode - calculate timings
735 * @info: pointer to fb_info object containing info for current riva board
738 * Calculate some timings and then send em off to riva_load_state().
743 static int riva_load_video_mode(struct fb_info *info)
745 int bpp, width, hDisplaySize, hDisplay, hStart,
746 hEnd, hTotal, height, vDisplay, vStart, vEnd, vTotal, dotClock;
747 int hBlankStart, hBlankEnd, vBlankStart, vBlankEnd;
749 struct riva_par *par = info->par;
750 struct riva_regs newmode;
753 /* time to calculate */
754 rivafb_blank(FB_BLANK_NORMAL, info);
756 bpp = info->var.bits_per_pixel;
757 if (bpp == 16 && info->var.green.length == 5)
759 width = info->var.xres_virtual;
760 hDisplaySize = info->var.xres;
761 hDisplay = (hDisplaySize / 8) - 1;
762 hStart = (hDisplaySize + info->var.right_margin) / 8 - 1;
763 hEnd = (hDisplaySize + info->var.right_margin +
764 info->var.hsync_len) / 8 - 1;
765 hTotal = (hDisplaySize + info->var.right_margin +
766 info->var.hsync_len + info->var.left_margin) / 8 - 5;
767 hBlankStart = hDisplay;
768 hBlankEnd = hTotal + 4;
770 height = info->var.yres_virtual;
771 vDisplay = info->var.yres - 1;
772 vStart = info->var.yres + info->var.lower_margin - 1;
773 vEnd = info->var.yres + info->var.lower_margin +
774 info->var.vsync_len - 1;
775 vTotal = info->var.yres + info->var.lower_margin +
776 info->var.vsync_len + info->var.upper_margin + 2;
777 vBlankStart = vDisplay;
778 vBlankEnd = vTotal + 1;
779 dotClock = 1000000000 / info->var.pixclock;
781 memcpy(&newmode, ®_template, sizeof(struct riva_regs));
783 if ((info->var.vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED)
786 if (par->FlatPanel) {
789 vBlankStart = vStart;
792 hBlankEnd = hTotal + 4;
795 newmode.crtc[0x0] = Set8Bits (hTotal);
796 newmode.crtc[0x1] = Set8Bits (hDisplay);
797 newmode.crtc[0x2] = Set8Bits (hBlankStart);
798 newmode.crtc[0x3] = SetBitField (hBlankEnd, 4: 0, 4:0) | SetBit (7);
799 newmode.crtc[0x4] = Set8Bits (hStart);
800 newmode.crtc[0x5] = SetBitField (hBlankEnd, 5: 5, 7:7)
801 | SetBitField (hEnd, 4: 0, 4:0);
802 newmode.crtc[0x6] = SetBitField (vTotal, 7: 0, 7:0);
803 newmode.crtc[0x7] = SetBitField (vTotal, 8: 8, 0:0)
804 | SetBitField (vDisplay, 8: 8, 1:1)
805 | SetBitField (vStart, 8: 8, 2:2)
806 | SetBitField (vBlankStart, 8: 8, 3:3)
808 | SetBitField (vTotal, 9: 9, 5:5)
809 | SetBitField (vDisplay, 9: 9, 6:6)
810 | SetBitField (vStart, 9: 9, 7:7);
811 newmode.crtc[0x9] = SetBitField (vBlankStart, 9: 9, 5:5)
813 newmode.crtc[0x10] = Set8Bits (vStart);
814 newmode.crtc[0x11] = SetBitField (vEnd, 3: 0, 3:0)
816 newmode.crtc[0x12] = Set8Bits (vDisplay);
817 newmode.crtc[0x13] = (width / 8) * ((bpp + 1) / 8);
818 newmode.crtc[0x15] = Set8Bits (vBlankStart);
819 newmode.crtc[0x16] = Set8Bits (vBlankEnd);
821 newmode.ext.screen = SetBitField(hBlankEnd,6:6,4:4)
822 | SetBitField(vBlankStart,10:10,3:3)
823 | SetBitField(vStart,10:10,2:2)
824 | SetBitField(vDisplay,10:10,1:1)
825 | SetBitField(vTotal,10:10,0:0);
826 newmode.ext.horiz = SetBitField(hTotal,8:8,0:0)
827 | SetBitField(hDisplay,8:8,1:1)
828 | SetBitField(hBlankStart,8:8,2:2)
829 | SetBitField(hStart,8:8,3:3);
830 newmode.ext.extra = SetBitField(vTotal,11:11,0:0)
831 | SetBitField(vDisplay,11:11,2:2)
832 | SetBitField(vStart,11:11,4:4)
833 | SetBitField(vBlankStart,11:11,6:6);
835 if ((info->var.vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
836 int tmp = (hTotal >> 1) & ~1;
837 newmode.ext.interlace = Set8Bits(tmp);
838 newmode.ext.horiz |= SetBitField(tmp, 8:8,4:4);
840 newmode.ext.interlace = 0xff; /* interlace off */
842 if (par->riva.Architecture >= NV_ARCH_10)
843 par->riva.CURSOR = (U032 __iomem *)(info->screen_base + par->riva.CursorStart);
845 if (info->var.sync & FB_SYNC_HOR_HIGH_ACT)
846 newmode.misc_output &= ~0x40;
848 newmode.misc_output |= 0x40;
849 if (info->var.sync & FB_SYNC_VERT_HIGH_ACT)
850 newmode.misc_output &= ~0x80;
852 newmode.misc_output |= 0x80;
854 rc = CalcStateExt(&par->riva, &newmode.ext, bpp, width,
855 hDisplaySize, height, dotClock);
859 newmode.ext.scale = NV_RD32(par->riva.PRAMDAC, 0x00000848) &
861 if (par->FlatPanel == 1) {
862 newmode.ext.pixel |= (1 << 7);
863 newmode.ext.scale |= (1 << 8);
865 if (par->SecondCRTC) {
866 newmode.ext.head = NV_RD32(par->riva.PCRTC0, 0x00000860) &
868 newmode.ext.head2 = NV_RD32(par->riva.PCRTC0, 0x00002860) |
870 newmode.ext.crtcOwner = 3;
871 newmode.ext.pllsel |= 0x20000800;
872 newmode.ext.vpll2 = newmode.ext.vpll;
873 } else if (par->riva.twoHeads) {
874 newmode.ext.head = NV_RD32(par->riva.PCRTC0, 0x00000860) |
876 newmode.ext.head2 = NV_RD32(par->riva.PCRTC0, 0x00002860) &
878 newmode.ext.crtcOwner = 0;
879 newmode.ext.vpll2 = NV_RD32(par->riva.PRAMDAC0, 0x00000520);
881 if (par->FlatPanel == 1) {
882 newmode.ext.pixel |= (1 << 7);
883 newmode.ext.scale |= (1 << 8);
885 newmode.ext.cursorConfig = 0x02000100;
886 par->current_state = newmode;
887 riva_load_state(par, &par->current_state);
888 par->riva.LockUnlock(&par->riva, 0); /* important for HW cursor */
891 rivafb_blank(FB_BLANK_UNBLANK, info);
897 static void riva_update_var(struct fb_var_screeninfo *var,
898 const struct fb_videomode *modedb)
901 var->xres = var->xres_virtual = modedb->xres;
902 var->yres = modedb->yres;
903 if (var->yres_virtual < var->yres)
904 var->yres_virtual = var->yres;
905 var->xoffset = var->yoffset = 0;
906 var->pixclock = modedb->pixclock;
907 var->left_margin = modedb->left_margin;
908 var->right_margin = modedb->right_margin;
909 var->upper_margin = modedb->upper_margin;
910 var->lower_margin = modedb->lower_margin;
911 var->hsync_len = modedb->hsync_len;
912 var->vsync_len = modedb->vsync_len;
913 var->sync = modedb->sync;
914 var->vmode = modedb->vmode;
919 * rivafb_do_maximize -
920 * @info: pointer to fb_info object containing info for current riva board
929 * -EINVAL on failure, 0 on success
935 static int rivafb_do_maximize(struct fb_info *info,
936 struct fb_var_screeninfo *var,
952 /* use highest possible virtual resolution */
953 if (var->xres_virtual == -1 && var->yres_virtual == -1) {
954 printk(KERN_WARNING PFX
955 "using maximum available virtual resolution\n");
956 for (i = 0; modes[i].xres != -1; i++) {
957 if (modes[i].xres * nom / den * modes[i].yres <
961 if (modes[i].xres == -1) {
963 "could not find a virtual resolution that fits into video memory!!\n");
964 NVTRACE("EXIT - EINVAL error\n");
967 var->xres_virtual = modes[i].xres;
968 var->yres_virtual = modes[i].yres;
971 "virtual resolution set to maximum of %dx%d\n",
972 var->xres_virtual, var->yres_virtual);
973 } else if (var->xres_virtual == -1) {
974 var->xres_virtual = (info->fix.smem_len * den /
975 (nom * var->yres_virtual)) & ~15;
976 printk(KERN_WARNING PFX
977 "setting virtual X resolution to %d\n", var->xres_virtual);
978 } else if (var->yres_virtual == -1) {
979 var->xres_virtual = (var->xres_virtual + 15) & ~15;
980 var->yres_virtual = info->fix.smem_len * den /
981 (nom * var->xres_virtual);
982 printk(KERN_WARNING PFX
983 "setting virtual Y resolution to %d\n", var->yres_virtual);
985 var->xres_virtual = (var->xres_virtual + 15) & ~15;
986 if (var->xres_virtual * nom / den * var->yres_virtual > info->fix.smem_len) {
988 "mode %dx%dx%d rejected...resolution too high to fit into video memory!\n",
989 var->xres, var->yres, var->bits_per_pixel);
990 NVTRACE("EXIT - EINVAL error\n");
995 if (var->xres_virtual * nom / den >= 8192) {
996 printk(KERN_WARNING PFX
997 "virtual X resolution (%d) is too high, lowering to %d\n",
998 var->xres_virtual, 8192 * den / nom - 16);
999 var->xres_virtual = 8192 * den / nom - 16;
1002 if (var->xres_virtual < var->xres) {
1004 "virtual X resolution (%d) is smaller than real\n", var->xres_virtual);
1008 if (var->yres_virtual < var->yres) {
1010 "virtual Y resolution (%d) is smaller than real\n", var->yres_virtual);
1013 if (var->yres_virtual > 0x7fff/nom)
1014 var->yres_virtual = 0x7fff/nom;
1015 if (var->xres_virtual > 0x7fff/nom)
1016 var->xres_virtual = 0x7fff/nom;
1022 riva_set_pattern(struct riva_par *par, int clr0, int clr1, int pat0, int pat1)
1024 RIVA_FIFO_FREE(par->riva, Patt, 4);
1025 NV_WR32(&par->riva.Patt->Color0, 0, clr0);
1026 NV_WR32(&par->riva.Patt->Color1, 0, clr1);
1027 NV_WR32(par->riva.Patt->Monochrome, 0, pat0);
1028 NV_WR32(par->riva.Patt->Monochrome, 4, pat1);
1031 /* acceleration routines */
1032 static inline void wait_for_idle(struct riva_par *par)
1034 while (par->riva.Busy(&par->riva));
1038 * Set ROP. Translate X rop into ROP3. Internal routine.
1041 riva_set_rop_solid(struct riva_par *par, int rop)
1043 riva_set_pattern(par, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
1044 RIVA_FIFO_FREE(par->riva, Rop, 1);
1045 NV_WR32(&par->riva.Rop->Rop3, 0, rop);
1049 static void riva_setup_accel(struct fb_info *info)
1051 struct riva_par *par = info->par;
1053 RIVA_FIFO_FREE(par->riva, Clip, 2);
1054 NV_WR32(&par->riva.Clip->TopLeft, 0, 0x0);
1055 NV_WR32(&par->riva.Clip->WidthHeight, 0,
1056 (info->var.xres_virtual & 0xffff) |
1057 (info->var.yres_virtual << 16));
1058 riva_set_rop_solid(par, 0xcc);
1063 * riva_get_cmap_len - query current color map length
1064 * @var: standard kernel fb changeable data
1067 * Get current color map length.
1070 * Length of color map
1073 * rivafb_setcolreg()
1075 static int riva_get_cmap_len(const struct fb_var_screeninfo *var)
1077 int rc = 256; /* reasonable default */
1079 switch (var->green.length) {
1081 rc = 256; /* 256 entries (2^8), 8 bpp and RGB8888 */
1084 rc = 32; /* 32 entries (2^5), 16 bpp, RGB555 */
1087 rc = 64; /* 64 entries (2^6), 16 bpp, RGB565 */
1090 /* should not occur */
1096 /* ------------------------------------------------------------------------- *
1098 * framebuffer operations
1100 * ------------------------------------------------------------------------- */
1102 static int rivafb_open(struct fb_info *info, int user)
1104 struct riva_par *par = info->par;
1107 mutex_lock(&par->open_lock);
1108 if (!par->ref_count) {
1110 memset(&par->state, 0, sizeof(struct vgastate));
1111 par->state.flags = VGA_SAVE_MODE | VGA_SAVE_FONTS;
1112 /* save the DAC for Riva128 */
1113 if (par->riva.Architecture == NV_ARCH_03)
1114 par->state.flags |= VGA_SAVE_CMAP;
1115 save_vga(&par->state);
1117 /* vgaHWunlock() + riva unlock (0x7F) */
1118 CRTCout(par, 0x11, 0xFF);
1119 par->riva.LockUnlock(&par->riva, 0);
1121 riva_save_state(par, &par->initial_state);
1124 mutex_unlock(&par->open_lock);
1129 static int rivafb_release(struct fb_info *info, int user)
1131 struct riva_par *par = info->par;
1134 mutex_lock(&par->open_lock);
1135 if (!par->ref_count) {
1136 mutex_unlock(&par->open_lock);
1139 if (par->ref_count == 1) {
1140 par->riva.LockUnlock(&par->riva, 0);
1141 par->riva.LoadStateExt(&par->riva, &par->initial_state.ext);
1142 riva_load_state(par, &par->initial_state);
1144 restore_vga(&par->state);
1146 par->riva.LockUnlock(&par->riva, 1);
1149 mutex_unlock(&par->open_lock);
1154 static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
1156 const struct fb_videomode *mode;
1157 struct riva_par *par = info->par;
1158 int nom, den; /* translating from pixels->bytes */
1162 switch (var->bits_per_pixel) {
1164 var->red.offset = var->green.offset = var->blue.offset = 0;
1165 var->red.length = var->green.length = var->blue.length = 8;
1166 var->bits_per_pixel = 8;
1170 var->green.length = 5;
1173 var->bits_per_pixel = 16;
1174 /* The Riva128 supports RGB555 only */
1175 if (par->riva.Architecture == NV_ARCH_03)
1176 var->green.length = 5;
1177 if (var->green.length == 5) {
1178 /* 0rrrrrgg gggbbbbb */
1179 var->red.offset = 10;
1180 var->green.offset = 5;
1181 var->blue.offset = 0;
1182 var->red.length = 5;
1183 var->green.length = 5;
1184 var->blue.length = 5;
1186 /* rrrrrggg gggbbbbb */
1187 var->red.offset = 11;
1188 var->green.offset = 5;
1189 var->blue.offset = 0;
1190 var->red.length = 5;
1191 var->green.length = 6;
1192 var->blue.length = 5;
1198 var->red.length = var->green.length = var->blue.length = 8;
1199 var->bits_per_pixel = 32;
1200 var->red.offset = 16;
1201 var->green.offset = 8;
1202 var->blue.offset = 0;
1208 "mode %dx%dx%d rejected...color depth not supported.\n",
1209 var->xres, var->yres, var->bits_per_pixel);
1210 NVTRACE("EXIT, returning -EINVAL\n");
1215 if (!info->monspecs.vfmax || !info->monspecs.hfmax ||
1216 !info->monspecs.dclkmax || !fb_validate_mode(var, info))
1220 /* calculate modeline if supported by monitor */
1221 if (!mode_valid && info->monspecs.gtf) {
1222 if (!fb_get_mode(FB_MAXTIMINGS, 0, var, info))
1227 mode = fb_find_best_mode(var, &info->modelist);
1229 riva_update_var(var, mode);
1234 if (!mode_valid && info->monspecs.modedb_len)
1237 if (var->xres_virtual < var->xres)
1238 var->xres_virtual = var->xres;
1239 if (var->yres_virtual <= var->yres)
1240 var->yres_virtual = -1;
1241 if (rivafb_do_maximize(info, var, nom, den) < 0)
1244 if (var->xoffset < 0)
1246 if (var->yoffset < 0)
1249 /* truncate xoffset and yoffset to maximum if too high */
1250 if (var->xoffset > var->xres_virtual - var->xres)
1251 var->xoffset = var->xres_virtual - var->xres - 1;
1253 if (var->yoffset > var->yres_virtual - var->yres)
1254 var->yoffset = var->yres_virtual - var->yres - 1;
1256 var->red.msb_right =
1257 var->green.msb_right =
1258 var->blue.msb_right =
1259 var->transp.offset = var->transp.length = var->transp.msb_right = 0;
1264 static int rivafb_set_par(struct fb_info *info)
1266 struct riva_par *par = info->par;
1270 /* vgaHWunlock() + riva unlock (0x7F) */
1271 CRTCout(par, 0x11, 0xFF);
1272 par->riva.LockUnlock(&par->riva, 0);
1273 rc = riva_load_video_mode(info);
1276 if(!(info->flags & FBINFO_HWACCEL_DISABLED))
1277 riva_setup_accel(info);
1279 par->cursor_reset = 1;
1280 info->fix.line_length = (info->var.xres_virtual * (info->var.bits_per_pixel >> 3));
1281 info->fix.visual = (info->var.bits_per_pixel == 8) ?
1282 FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
1284 if (info->flags & FBINFO_HWACCEL_DISABLED)
1285 info->pixmap.scan_align = 1;
1287 info->pixmap.scan_align = 4;
1295 * rivafb_pan_display
1296 * @var: standard kernel fb changeable data
1298 * @info: pointer to fb_info object containing info for current riva board
1301 * Pan (or wrap, depending on the `vmode' field) the display using the
1302 * `xoffset' and `yoffset' fields of the `var' structure.
1303 * If the values don't fit, return -EINVAL.
1305 * This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
1307 static int rivafb_pan_display(struct fb_var_screeninfo *var,
1308 struct fb_info *info)
1310 struct riva_par *par = info->par;
1314 base = var->yoffset * info->fix.line_length + var->xoffset;
1315 par->riva.SetStartAddress(&par->riva, base);
1320 static int rivafb_blank(int blank, struct fb_info *info)
1322 struct riva_par *par= info->par;
1323 unsigned char tmp, vesa;
1325 tmp = SEQin(par, 0x01) & ~0x20; /* screen on/off */
1326 vesa = CRTCin(par, 0x1a) & ~0xc0; /* sync on/off */
1334 case FB_BLANK_UNBLANK:
1335 case FB_BLANK_NORMAL:
1337 case FB_BLANK_VSYNC_SUSPEND:
1340 case FB_BLANK_HSYNC_SUSPEND:
1343 case FB_BLANK_POWERDOWN:
1348 SEQout(par, 0x01, tmp);
1349 CRTCout(par, 0x1a, vesa);
1351 riva_bl_set_power(info, blank);
1360 * @regno: register index
1361 * @red: red component
1362 * @green: green component
1363 * @blue: blue component
1364 * @transp: transparency
1365 * @info: pointer to fb_info object containing info for current riva board
1368 * Set a single color register. The values supplied have a 16 bit
1372 * Return != 0 for invalid regno.
1375 * fbcmap.c:fb_set_cmap()
1377 static int rivafb_setcolreg(unsigned regno, unsigned red, unsigned green,
1378 unsigned blue, unsigned transp,
1379 struct fb_info *info)
1381 struct riva_par *par = info->par;
1382 RIVA_HW_INST *chip = &par->riva;
1385 if (regno >= riva_get_cmap_len(&info->var))
1388 if (info->var.grayscale) {
1389 /* gray = 0.30*R + 0.59*G + 0.11*B */
1390 red = green = blue =
1391 (red * 77 + green * 151 + blue * 28) >> 8;
1394 if (regno < 16 && info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
1395 ((u32 *) info->pseudo_palette)[regno] =
1396 (regno << info->var.red.offset) |
1397 (regno << info->var.green.offset) |
1398 (regno << info->var.blue.offset);
1400 * The Riva128 2D engine requires color information in
1401 * TrueColor format even if framebuffer is in DirectColor
1403 if (par->riva.Architecture == NV_ARCH_03) {
1404 switch (info->var.bits_per_pixel) {
1406 par->palette[regno] = ((red & 0xf800) >> 1) |
1407 ((green & 0xf800) >> 6) |
1408 ((blue & 0xf800) >> 11);
1411 par->palette[regno] = ((red & 0xff00) << 8) |
1412 ((green & 0xff00)) |
1413 ((blue & 0xff00) >> 8);
1419 switch (info->var.bits_per_pixel) {
1421 /* "transparent" stuff is completely ignored. */
1422 riva_wclut(chip, regno, red >> 8, green >> 8, blue >> 8);
1425 if (info->var.green.length == 5) {
1426 for (i = 0; i < 8; i++) {
1427 riva_wclut(chip, regno*8+i, red >> 8,
1428 green >> 8, blue >> 8);
1434 for (i = 0; i < 8; i++) {
1435 riva_wclut(chip, regno*8+i,
1436 red >> 8, green >> 8,
1440 riva_rclut(chip, regno*4, &r, &g, &b);
1441 for (i = 0; i < 4; i++)
1442 riva_wclut(chip, regno*4+i, r,
1447 riva_wclut(chip, regno, red >> 8, green >> 8, blue >> 8);
1457 * rivafb_fillrect - hardware accelerated color fill function
1458 * @info: pointer to fb_info structure
1459 * @rect: pointer to fb_fillrect structure
1462 * This function fills up a region of framebuffer memory with a solid
1463 * color with a choice of two different ROP's, copy or invert.
1468 static void rivafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
1470 struct riva_par *par = info->par;
1471 u_int color, rop = 0;
1473 if ((info->flags & FBINFO_HWACCEL_DISABLED)) {
1474 cfb_fillrect(info, rect);
1478 if (info->var.bits_per_pixel == 8)
1479 color = rect->color;
1481 if (par->riva.Architecture != NV_ARCH_03)
1482 color = ((u32 *)info->pseudo_palette)[rect->color];
1484 color = par->palette[rect->color];
1487 switch (rect->rop) {
1497 riva_set_rop_solid(par, rop);
1499 RIVA_FIFO_FREE(par->riva, Bitmap, 1);
1500 NV_WR32(&par->riva.Bitmap->Color1A, 0, color);
1502 RIVA_FIFO_FREE(par->riva, Bitmap, 2);
1503 NV_WR32(&par->riva.Bitmap->UnclippedRectangle[0].TopLeft, 0,
1504 (rect->dx << 16) | rect->dy);
1506 NV_WR32(&par->riva.Bitmap->UnclippedRectangle[0].WidthHeight, 0,
1507 (rect->width << 16) | rect->height);
1509 riva_set_rop_solid(par, 0xcc);
1514 * rivafb_copyarea - hardware accelerated blit function
1515 * @info: pointer to fb_info structure
1516 * @region: pointer to fb_copyarea structure
1519 * This copies an area of pixels from one location to another
1524 static void rivafb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
1526 struct riva_par *par = info->par;
1528 if ((info->flags & FBINFO_HWACCEL_DISABLED)) {
1529 cfb_copyarea(info, region);
1533 RIVA_FIFO_FREE(par->riva, Blt, 3);
1534 NV_WR32(&par->riva.Blt->TopLeftSrc, 0,
1535 (region->sy << 16) | region->sx);
1536 NV_WR32(&par->riva.Blt->TopLeftDst, 0,
1537 (region->dy << 16) | region->dx);
1539 NV_WR32(&par->riva.Blt->WidthHeight, 0,
1540 (region->height << 16) | region->width);
1544 static inline void convert_bgcolor_16(u32 *col)
1546 *col = ((*col & 0x0000F800) << 8)
1547 | ((*col & 0x00007E0) << 5)
1548 | ((*col & 0x0000001F) << 3)
1554 * rivafb_imageblit: hardware accelerated color expand function
1555 * @info: pointer to fb_info structure
1556 * @image: pointer to fb_image structure
1559 * If the source is a monochrome bitmap, the function fills up a a region
1560 * of framebuffer memory with pixels whose color is determined by the bit
1561 * setting of the bitmap, 1 - foreground, 0 - background.
1563 * If the source is not a monochrome bitmap, color expansion is not done.
1564 * In this case, it is channeled to a software function.
1569 static void rivafb_imageblit(struct fb_info *info,
1570 const struct fb_image *image)
1572 struct riva_par *par = info->par;
1573 u32 fgx = 0, bgx = 0, width, tmp;
1574 u8 *cdat = (u8 *) image->data;
1575 volatile u32 __iomem *d;
1578 if ((info->flags & FBINFO_HWACCEL_DISABLED) || image->depth != 1) {
1579 cfb_imageblit(info, image);
1583 switch (info->var.bits_per_pixel) {
1585 fgx = image->fg_color;
1586 bgx = image->bg_color;
1590 if (par->riva.Architecture != NV_ARCH_03) {
1591 fgx = ((u32 *)info->pseudo_palette)[image->fg_color];
1592 bgx = ((u32 *)info->pseudo_palette)[image->bg_color];
1594 fgx = par->palette[image->fg_color];
1595 bgx = par->palette[image->bg_color];
1597 if (info->var.green.length == 6)
1598 convert_bgcolor_16(&bgx);
1602 RIVA_FIFO_FREE(par->riva, Bitmap, 7);
1603 NV_WR32(&par->riva.Bitmap->ClipE.TopLeft, 0,
1604 (image->dy << 16) | (image->dx & 0xFFFF));
1605 NV_WR32(&par->riva.Bitmap->ClipE.BottomRight, 0,
1606 (((image->dy + image->height) << 16) |
1607 ((image->dx + image->width) & 0xffff)));
1608 NV_WR32(&par->riva.Bitmap->Color0E, 0, bgx);
1609 NV_WR32(&par->riva.Bitmap->Color1E, 0, fgx);
1610 NV_WR32(&par->riva.Bitmap->WidthHeightInE, 0,
1611 (image->height << 16) | ((image->width + 31) & ~31));
1612 NV_WR32(&par->riva.Bitmap->WidthHeightOutE, 0,
1613 (image->height << 16) | ((image->width + 31) & ~31));
1614 NV_WR32(&par->riva.Bitmap->PointE, 0,
1615 (image->dy << 16) | (image->dx & 0xFFFF));
1617 d = &par->riva.Bitmap->MonochromeData01E;
1619 width = (image->width + 31)/32;
1620 size = width * image->height;
1621 while (size >= 16) {
1622 RIVA_FIFO_FREE(par->riva, Bitmap, 16);
1623 for (i = 0; i < 16; i++) {
1624 tmp = *((u32 *)cdat);
1625 cdat = (u8 *)((u32 *)cdat + 1);
1626 reverse_order(&tmp);
1627 NV_WR32(d, i*4, tmp);
1632 RIVA_FIFO_FREE(par->riva, Bitmap, size);
1633 for (i = 0; i < size; i++) {
1634 tmp = *((u32 *) cdat);
1635 cdat = (u8 *)((u32 *)cdat + 1);
1636 reverse_order(&tmp);
1637 NV_WR32(d, i*4, tmp);
1643 * rivafb_cursor - hardware cursor function
1644 * @info: pointer to info structure
1645 * @cursor: pointer to fbcursor structure
1648 * A cursor function that supports displaying a cursor image via hardware.
1649 * Within the kernel, copy and invert rops are supported. If exported
1650 * to user space, only the copy rop will be supported.
1655 static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1657 struct riva_par *par = info->par;
1658 u8 data[MAX_CURS * MAX_CURS/8];
1659 int i, set = cursor->set;
1662 if (cursor->image.width > MAX_CURS || cursor->image.height > MAX_CURS)
1665 par->riva.ShowHideCursor(&par->riva, 0);
1667 if (par->cursor_reset) {
1668 set = FB_CUR_SETALL;
1669 par->cursor_reset = 0;
1672 if (set & FB_CUR_SETSIZE)
1673 memset_io(par->riva.CURSOR, 0, MAX_CURS * MAX_CURS * 2);
1675 if (set & FB_CUR_SETPOS) {
1678 yy = cursor->image.dy - info->var.yoffset;
1679 xx = cursor->image.dx - info->var.xoffset;
1683 NV_WR32(par->riva.PRAMDAC, 0x0000300, temp);
1687 if (set & (FB_CUR_SETSHAPE | FB_CUR_SETCMAP | FB_CUR_SETIMAGE)) {
1688 u32 bg_idx = cursor->image.bg_color;
1689 u32 fg_idx = cursor->image.fg_color;
1690 u32 s_pitch = (cursor->image.width+7) >> 3;
1691 u32 d_pitch = MAX_CURS/8;
1692 u8 *dat = (u8 *) cursor->image.data;
1693 u8 *msk = (u8 *) cursor->mask;
1696 src = kmalloc(s_pitch * cursor->image.height, GFP_ATOMIC);
1699 switch (cursor->rop) {
1701 for (i = 0; i < s_pitch * cursor->image.height; i++)
1702 src[i] = dat[i] ^ msk[i];
1706 for (i = 0; i < s_pitch * cursor->image.height; i++)
1707 src[i] = dat[i] & msk[i];
1711 fb_pad_aligned_buffer(data, d_pitch, src, s_pitch,
1712 cursor->image.height);
1714 bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) |
1715 ((info->cmap.green[bg_idx] & 0xf8) << 2) |
1716 ((info->cmap.blue[bg_idx] & 0xf8) >> 3) |
1719 fg = ((info->cmap.red[fg_idx] & 0xf8) << 7) |
1720 ((info->cmap.green[fg_idx] & 0xf8) << 2) |
1721 ((info->cmap.blue[fg_idx] & 0xf8) >> 3) |
1724 par->riva.LockUnlock(&par->riva, 0);
1726 rivafb_load_cursor_image(par, data, bg, fg,
1727 cursor->image.width,
1728 cursor->image.height);
1734 par->riva.ShowHideCursor(&par->riva, 1);
1739 static int rivafb_sync(struct fb_info *info)
1741 struct riva_par *par = info->par;
1747 /* ------------------------------------------------------------------------- *
1749 * initialization helper functions
1751 * ------------------------------------------------------------------------- */
1753 /* kernel interface */
1754 static struct fb_ops riva_fb_ops = {
1755 .owner = THIS_MODULE,
1756 .fb_open = rivafb_open,
1757 .fb_release = rivafb_release,
1758 .fb_check_var = rivafb_check_var,
1759 .fb_set_par = rivafb_set_par,
1760 .fb_setcolreg = rivafb_setcolreg,
1761 .fb_pan_display = rivafb_pan_display,
1762 .fb_blank = rivafb_blank,
1763 .fb_fillrect = rivafb_fillrect,
1764 .fb_copyarea = rivafb_copyarea,
1765 .fb_imageblit = rivafb_imageblit,
1766 .fb_cursor = rivafb_cursor,
1767 .fb_sync = rivafb_sync,
1770 static int __devinit riva_set_fbinfo(struct fb_info *info)
1772 unsigned int cmap_len;
1773 struct riva_par *par = info->par;
1776 info->flags = FBINFO_DEFAULT
1777 | FBINFO_HWACCEL_XPAN
1778 | FBINFO_HWACCEL_YPAN
1779 | FBINFO_HWACCEL_COPYAREA
1780 | FBINFO_HWACCEL_FILLRECT
1781 | FBINFO_HWACCEL_IMAGEBLIT;
1783 /* Accel seems to not work properly on NV30 yet...*/
1784 if ((par->riva.Architecture == NV_ARCH_30) || noaccel) {
1785 printk(KERN_DEBUG PFX "disabling acceleration\n");
1786 info->flags |= FBINFO_HWACCEL_DISABLED;
1789 info->var = rivafb_default_var;
1790 info->fix.visual = (info->var.bits_per_pixel == 8) ?
1791 FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
1793 info->pseudo_palette = par->pseudo_palette;
1795 cmap_len = riva_get_cmap_len(&info->var);
1796 fb_alloc_cmap(&info->cmap, cmap_len, 0);
1798 info->pixmap.size = 8 * 1024;
1799 info->pixmap.buf_align = 4;
1800 info->pixmap.access_align = 32;
1801 info->pixmap.flags = FB_PIXMAP_SYSTEM;
1802 info->var.yres_virtual = -1;
1804 return (rivafb_check_var(&info->var, info));
1807 #ifdef CONFIG_PPC_OF
1808 static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
1810 struct riva_par *par = info->par;
1811 struct device_node *dp;
1812 const unsigned char *pedid = NULL;
1813 const unsigned char *disptype = NULL;
1814 static char *propnames[] = {
1815 "DFP,EDID", "LCD,EDID", "EDID", "EDID1", "EDID,B", "EDID,A", NULL };
1819 dp = pci_device_to_OF_node(pd);
1820 for (; dp != NULL; dp = dp->child) {
1821 disptype = get_property(dp, "display-type", NULL);
1822 if (disptype == NULL)
1824 if (strncmp(disptype, "LCD", 3) != 0)
1826 for (i = 0; propnames[i] != NULL; ++i) {
1827 pedid = get_property(dp, propnames[i], NULL);
1828 if (pedid != NULL) {
1829 par->EDID = (unsigned char *)pedid;
1830 NVTRACE("LCD found.\n");
1838 #endif /* CONFIG_PPC_OF */
1840 #if defined(CONFIG_FB_RIVA_I2C) && !defined(CONFIG_PPC_OF)
1841 static int __devinit riva_get_EDID_i2c(struct fb_info *info)
1843 struct riva_par *par = info->par;
1844 struct fb_var_screeninfo var;
1848 riva_create_i2c_busses(par);
1849 for (i = 0; i < par->bus; i++) {
1850 riva_probe_i2c_connector(par, i+1, &par->EDID);
1851 if (par->EDID && !fb_parse_edid(par->EDID, &var)) {
1852 printk(PFX "Found EDID Block from BUS %i\n", i);
1858 return (par->EDID) ? 1 : 0;
1860 #endif /* CONFIG_FB_RIVA_I2C */
1862 static void __devinit riva_update_default_var(struct fb_var_screeninfo *var,
1863 struct fb_info *info)
1865 struct fb_monspecs *specs = &info->monspecs;
1866 struct fb_videomode modedb;
1869 /* respect mode options */
1871 fb_find_mode(var, info, mode_option,
1872 specs->modedb, specs->modedb_len,
1874 } else if (specs->modedb != NULL) {
1875 /* get preferred timing */
1876 if (info->monspecs.misc & FB_MISC_1ST_DETAIL) {
1879 for (i = 0; i < specs->modedb_len; i++) {
1880 if (specs->modedb[i].flag & FB_MODE_IS_FIRST) {
1881 modedb = specs->modedb[i];
1886 /* otherwise, get first mode in database */
1887 modedb = specs->modedb[0];
1889 var->bits_per_pixel = 8;
1890 riva_update_var(var, &modedb);
1896 static void __devinit riva_get_EDID(struct fb_info *info, struct pci_dev *pdev)
1899 #ifdef CONFIG_PPC_OF
1900 if (!riva_get_EDID_OF(info, pdev))
1901 printk(PFX "could not retrieve EDID from OF\n");
1902 #elif defined(CONFIG_FB_RIVA_I2C)
1903 if (!riva_get_EDID_i2c(info))
1904 printk(PFX "could not retrieve EDID from DDC/I2C\n");
1910 static void __devinit riva_get_edidinfo(struct fb_info *info)
1912 struct fb_var_screeninfo *var = &rivafb_default_var;
1913 struct riva_par *par = info->par;
1915 fb_edid_to_monspecs(par->EDID, &info->monspecs);
1916 fb_videomode_to_modelist(info->monspecs.modedb, info->monspecs.modedb_len,
1918 riva_update_default_var(var, info);
1920 /* if user specified flatpanel, we respect that */
1921 if (info->monspecs.input & FB_DISP_DDI)
1925 /* ------------------------------------------------------------------------- *
1929 * ------------------------------------------------------------------------- */
1931 static u32 __devinit riva_get_arch(struct pci_dev *pd)
1935 switch (pd->device & 0x0ff0) {
1936 case 0x0100: /* GeForce 256 */
1937 case 0x0110: /* GeForce2 MX */
1938 case 0x0150: /* GeForce2 */
1939 case 0x0170: /* GeForce4 MX */
1940 case 0x0180: /* GeForce4 MX (8x AGP) */
1941 case 0x01A0: /* nForce */
1942 case 0x01F0: /* nForce2 */
1945 case 0x0200: /* GeForce3 */
1946 case 0x0250: /* GeForce4 Ti */
1947 case 0x0280: /* GeForce4 Ti (8x AGP) */
1950 case 0x0300: /* GeForceFX 5800 */
1951 case 0x0310: /* GeForceFX 5600 */
1952 case 0x0320: /* GeForceFX 5200 */
1953 case 0x0330: /* GeForceFX 5900 */
1954 case 0x0340: /* GeForceFX 5700 */
1957 case 0x0020: /* TNT, TNT2 */
1960 case 0x0010: /* Riva128 */
1963 default: /* unknown architecture */
1969 static int __devinit rivafb_probe(struct pci_dev *pd,
1970 const struct pci_device_id *ent)
1972 struct riva_par *default_par;
1973 struct fb_info *info;
1979 info = framebuffer_alloc(sizeof(struct riva_par), &pd->dev);
1981 printk (KERN_ERR PFX "could not allocate memory\n");
1985 default_par = info->par;
1986 default_par->pdev = pd;
1988 info->pixmap.addr = kzalloc(8 * 1024, GFP_KERNEL);
1989 if (info->pixmap.addr == NULL) {
1991 goto err_framebuffer_release;
1994 ret = pci_enable_device(pd);
1996 printk(KERN_ERR PFX "cannot enable PCI device\n");
1997 goto err_free_pixmap;
2000 ret = pci_request_regions(pd, "rivafb");
2002 printk(KERN_ERR PFX "cannot request PCI regions\n");
2003 goto err_disable_device;
2006 mutex_init(&default_par->open_lock);
2007 default_par->riva.Architecture = riva_get_arch(pd);
2009 default_par->Chipset = (pd->vendor << 16) | pd->device;
2010 printk(KERN_INFO PFX "nVidia device/chipset %X\n",default_par->Chipset);
2012 if(default_par->riva.Architecture == 0) {
2013 printk(KERN_ERR PFX "unknown NV_ARCH\n");
2015 goto err_release_region;
2017 if(default_par->riva.Architecture == NV_ARCH_10 ||
2018 default_par->riva.Architecture == NV_ARCH_20 ||
2019 default_par->riva.Architecture == NV_ARCH_30) {
2020 sprintf(rivafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4);
2022 sprintf(rivafb_fix.id, "NV%x", default_par->riva.Architecture);
2025 default_par->FlatPanel = flatpanel;
2027 printk(KERN_INFO PFX "flatpanel support enabled\n");
2028 default_par->forceCRTC = forceCRTC;
2030 rivafb_fix.mmio_len = pci_resource_len(pd, 0);
2031 rivafb_fix.smem_len = pci_resource_len(pd, 1);
2034 /* enable IO and mem if not already done */
2037 pci_read_config_word(pd, PCI_COMMAND, &cmd);
2038 cmd |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
2039 pci_write_config_word(pd, PCI_COMMAND, cmd);
2042 rivafb_fix.mmio_start = pci_resource_start(pd, 0);
2043 rivafb_fix.smem_start = pci_resource_start(pd, 1);
2045 default_par->ctrl_base = ioremap(rivafb_fix.mmio_start,
2046 rivafb_fix.mmio_len);
2047 if (!default_par->ctrl_base) {
2048 printk(KERN_ERR PFX "cannot ioremap MMIO base\n");
2050 goto err_release_region;
2053 switch (default_par->riva.Architecture) {
2055 /* Riva128's PRAMIN is in the "framebuffer" space
2056 * Since these cards were never made with more than 8 megabytes
2057 * we can safely allocate this separately.
2059 default_par->riva.PRAMIN = ioremap(rivafb_fix.smem_start + 0x00C00000, 0x00008000);
2060 if (!default_par->riva.PRAMIN) {
2061 printk(KERN_ERR PFX "cannot ioremap PRAMIN region\n");
2063 goto err_iounmap_ctrl_base;
2070 default_par->riva.PCRTC0 =
2071 (u32 __iomem *)(default_par->ctrl_base + 0x00600000);
2072 default_par->riva.PRAMIN =
2073 (u32 __iomem *)(default_par->ctrl_base + 0x00710000);
2076 riva_common_setup(default_par);
2078 if (default_par->riva.Architecture == NV_ARCH_03) {
2079 default_par->riva.PCRTC = default_par->riva.PCRTC0
2080 = default_par->riva.PGRAPH;
2083 rivafb_fix.smem_len = riva_get_memlen(default_par) * 1024;
2084 default_par->dclk_max = riva_get_maxdclk(default_par) * 1000;
2085 info->screen_base = ioremap(rivafb_fix.smem_start,
2086 rivafb_fix.smem_len);
2087 if (!info->screen_base) {
2088 printk(KERN_ERR PFX "cannot ioremap FB base\n");
2090 goto err_iounmap_pramin;
2095 default_par->mtrr.vram = mtrr_add(rivafb_fix.smem_start,
2096 rivafb_fix.smem_len,
2097 MTRR_TYPE_WRCOMB, 1);
2098 if (default_par->mtrr.vram < 0) {
2099 printk(KERN_ERR PFX "unable to setup MTRR\n");
2101 default_par->mtrr.vram_valid = 1;
2102 /* let there be speed */
2103 printk(KERN_INFO PFX "RIVA MTRR set to ON\n");
2106 #endif /* CONFIG_MTRR */
2108 info->fbops = &riva_fb_ops;
2109 info->fix = rivafb_fix;
2110 riva_get_EDID(info, pd);
2111 riva_get_edidinfo(info);
2113 ret=riva_set_fbinfo(info);
2115 printk(KERN_ERR PFX "error setting initial video mode\n");
2116 goto err_iounmap_screen_base;
2119 fb_destroy_modedb(info->monspecs.modedb);
2120 info->monspecs.modedb = NULL;
2122 pci_set_drvdata(pd, info);
2123 riva_bl_init(info->par);
2124 ret = register_framebuffer(info);
2127 "error registering riva framebuffer\n");
2128 goto err_iounmap_screen_base;
2131 printk(KERN_INFO PFX
2132 "PCI nVidia %s framebuffer ver %s (%dMB @ 0x%lX)\n",
2135 info->fix.smem_len / (1024 * 1024),
2136 info->fix.smem_start);
2141 err_iounmap_screen_base:
2142 #ifdef CONFIG_FB_RIVA_I2C
2143 riva_delete_i2c_busses(info->par);
2145 iounmap(info->screen_base);
2147 if (default_par->riva.Architecture == NV_ARCH_03)
2148 iounmap(default_par->riva.PRAMIN);
2149 err_iounmap_ctrl_base:
2150 iounmap(default_par->ctrl_base);
2152 pci_release_regions(pd);
2155 kfree(info->pixmap.addr);
2156 err_framebuffer_release:
2157 framebuffer_release(info);
2162 static void __exit rivafb_remove(struct pci_dev *pd)
2164 struct fb_info *info = pci_get_drvdata(pd);
2165 struct riva_par *par = info->par;
2171 #ifdef CONFIG_FB_RIVA_I2C
2172 riva_delete_i2c_busses(par);
2176 unregister_framebuffer(info);
2178 if (par->mtrr.vram_valid)
2179 mtrr_del(par->mtrr.vram, info->fix.smem_start,
2180 info->fix.smem_len);
2181 #endif /* CONFIG_MTRR */
2183 iounmap(par->ctrl_base);
2184 iounmap(info->screen_base);
2185 if (par->riva.Architecture == NV_ARCH_03)
2186 iounmap(par->riva.PRAMIN);
2187 pci_release_regions(pd);
2188 kfree(info->pixmap.addr);
2189 framebuffer_release(info);
2190 pci_set_drvdata(pd, NULL);
2194 /* ------------------------------------------------------------------------- *
2198 * ------------------------------------------------------------------------- */
2201 static int __init rivafb_setup(char *options)
2206 if (!options || !*options)
2209 while ((this_opt = strsep(&options, ",")) != NULL) {
2210 if (!strncmp(this_opt, "forceCRTC", 9)) {
2214 if (!*p || !*(++p)) continue;
2215 forceCRTC = *p - '0';
2216 if (forceCRTC < 0 || forceCRTC > 1)
2218 } else if (!strncmp(this_opt, "flatpanel", 9)) {
2221 } else if (!strncmp(this_opt, "nomtrr", 6)) {
2224 } else if (!strncmp(this_opt, "strictmode", 10)) {
2226 } else if (!strncmp(this_opt, "noaccel", 7)) {
2229 mode_option = this_opt;
2234 #endif /* !MODULE */
2236 static struct pci_driver rivafb_driver = {
2238 .id_table = rivafb_pci_tbl,
2239 .probe = rivafb_probe,
2240 .remove = __exit_p(rivafb_remove),
2245 /* ------------------------------------------------------------------------- *
2249 * ------------------------------------------------------------------------- */
2251 static int __devinit rivafb_init(void)
2254 char *option = NULL;
2256 if (fb_get_options("rivafb", &option))
2258 rivafb_setup(option);
2260 return pci_register_driver(&rivafb_driver);
2264 module_init(rivafb_init);
2267 static void __exit rivafb_exit(void)
2269 pci_unregister_driver(&rivafb_driver);
2272 module_exit(rivafb_exit);
2275 module_param(noaccel, bool, 0);
2276 MODULE_PARM_DESC(noaccel, "bool: disable acceleration");
2277 module_param(flatpanel, int, 0);
2278 MODULE_PARM_DESC(flatpanel, "Enables experimental flat panel support for some chipsets. (0 or 1=enabled) (default=0)");
2279 module_param(forceCRTC, int, 0);
2280 MODULE_PARM_DESC(forceCRTC, "Forces usage of a particular CRTC in case autodetection fails. (0 or 1) (default=autodetect)");
2282 module_param(nomtrr, bool, 0);
2283 MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) (default=0)");
2285 module_param(strictmode, bool, 0);
2286 MODULE_PARM_DESC(strictmode, "Only use video modes from EDID");
2288 MODULE_AUTHOR("Ani Joshi, maintainer");
2289 MODULE_DESCRIPTION("Framebuffer driver for nVidia Riva 128, TNT, TNT2, and the GeForce series");
2290 MODULE_LICENSE("GPL");