vserver 1.9.5.x5
[linux-2.6.git] / drivers / video / asiliantfb.c
1 /*
2  * drivers/video/asiliantfb.c
3  *  frame buffer driver for Asiliant 69000 chip
4  *  Copyright (C) 2001-2003 Saito.K & Jeanne
5  *
6  *  from driver/video/chipsfb.c and,
7  *
8  *  drivers/video/asiliantfb.c -- frame buffer device for
9  *  Asiliant 69030 chip (formerly Intel, formerly Chips & Technologies)
10  *  Author: apc@agelectronics.co.uk
11  *  Copyright (C) 2000 AG Electronics
12  *  Note: the data sheets don't seem to be available from Asiliant.
13  *  They are available by searching developer.intel.com, but are not otherwise
14  *  linked to.
15  *
16  *  This driver should be portable with minimal effort to the 69000 display
17  *  chip, and to the twin-display mode of the 69030.
18  *  Contains code from Thomas Hhenleitner <th@visuelle-maschinen.de> (thanks)
19  *
20  *  Derived from the CT65550 driver chipsfb.c:
21  *  Copyright (C) 1998 Paul Mackerras
22  *  ...which was derived from the Powermac "chips" driver:
23  *  Copyright (C) 1997 Fabio Riccardi.
24  *  And from the frame buffer device for Open Firmware-initialized devices:
25  *  Copyright (C) 1997 Geert Uytterhoeven.
26  *
27  *  This file is subject to the terms and conditions of the GNU General Public
28  *  License. See the file COPYING in the main directory of this archive for
29  *  more details.
30  */
31
32 #include <linux/config.h>
33 #include <linux/module.h>
34 #include <linux/kernel.h>
35 #include <linux/errno.h>
36 #include <linux/string.h>
37 #include <linux/mm.h>
38 #include <linux/tty.h>
39 #include <linux/slab.h>
40 #include <linux/vmalloc.h>
41 #include <linux/delay.h>
42 #include <linux/interrupt.h>
43 #include <linux/fb.h>
44 #include <linux/init.h>
45 #include <linux/pci.h>
46 #include <asm/io.h>
47
48 /* Built in clock of the 69030 */
49 const unsigned Fref = 14318180;
50
51 #define mmio_base (p->screen_base + 0x400000)
52
53 #define mm_write_ind(num, val, ap, dp)  do { \
54         writeb((num), mmio_base + (ap)); writeb((val), mmio_base + (dp)); \
55 } while (0)
56
57 static void mm_write_xr(struct fb_info *p, u8 reg, u8 data)
58 {
59         mm_write_ind(reg, data, 0x7ac, 0x7ad);
60 }
61 #define write_xr(num, val)      mm_write_xr(p, num, val)
62
63 static void mm_write_fr(struct fb_info *p, u8 reg, u8 data)
64 {
65         mm_write_ind(reg, data, 0x7a0, 0x7a1);
66 }
67 #define write_fr(num, val)      mm_write_fr(p, num, val)
68
69 static void mm_write_cr(struct fb_info *p, u8 reg, u8 data)
70 {
71         mm_write_ind(reg, data, 0x7a8, 0x7a9);
72 }
73 #define write_cr(num, val)      mm_write_cr(p, num, val)
74
75 static void mm_write_gr(struct fb_info *p, u8 reg, u8 data)
76 {
77         mm_write_ind(reg, data, 0x79c, 0x79d);
78 }
79 #define write_gr(num, val)      mm_write_gr(p, num, val)
80
81 static void mm_write_sr(struct fb_info *p, u8 reg, u8 data)
82 {
83         mm_write_ind(reg, data, 0x788, 0x789);
84 }
85 #define write_sr(num, val)      mm_write_sr(p, num, val)
86
87 static void mm_write_ar(struct fb_info *p, u8 reg, u8 data)
88 {
89         readb(mmio_base + 0x7b4);
90         mm_write_ind(reg, data, 0x780, 0x780);
91 }
92 #define write_ar(num, val)      mm_write_ar(p, num, val)
93
94 /*
95  * Exported functions
96  */
97 int asiliantfb_init(void);
98
99 static int asiliantfb_pci_init(struct pci_dev *dp, const struct pci_device_id *);
100 static int asiliantfb_check_var(struct fb_var_screeninfo *var,
101                                 struct fb_info *info);
102 static int asiliantfb_set_par(struct fb_info *info);
103 static int asiliantfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
104                                 u_int transp, struct fb_info *info);
105
106 static struct fb_ops asiliantfb_ops = {
107         .owner          = THIS_MODULE,
108         .fb_check_var   = asiliantfb_check_var,
109         .fb_set_par     = asiliantfb_set_par,
110         .fb_setcolreg   = asiliantfb_setcolreg,
111         .fb_fillrect    = cfb_fillrect,
112         .fb_copyarea    = cfb_copyarea,
113         .fb_imageblit   = cfb_imageblit,
114         .fb_cursor      = soft_cursor,
115 };
116
117 /* Calculate the ratios for the dot clocks without using a single long long
118  * value */
119 static void asiliant_calc_dclk2(u32 *ppixclock, u8 *dclk2_m, u8 *dclk2_n, u8 *dclk2_div)
120 {
121         unsigned pixclock = *ppixclock;
122         unsigned Ftarget = 1000000 * (1000000 / pixclock);
123         unsigned n;
124         unsigned best_error = 0xffffffff;
125         unsigned best_m = 0xffffffff,
126                  best_n = 0xffffffff;
127         unsigned ratio;
128         unsigned remainder;
129         unsigned char divisor = 0;
130
131         /* Calculate the frequency required. This is hard enough. */
132         ratio = 1000000 / pixclock;
133         remainder = 1000000 % pixclock;
134         Ftarget = 1000000 * ratio + (1000000 * remainder) / pixclock;
135
136         while (Ftarget < 100000000) {
137                 divisor += 0x10;
138                 Ftarget <<= 1;
139         }
140
141         ratio = Ftarget / Fref;
142         remainder = Ftarget % Fref;
143
144         /* This expresses the constraint that 150kHz <= Fref/n <= 5Mhz,
145          * together with 3 <= n <= 257. */
146         for (n = 3; n <= 257; n++) {
147                 unsigned m = n * ratio + (n * remainder) / Fref;
148
149                 /* 3 <= m <= 257 */
150                 if (m >= 3 && m <= 257) {
151                         unsigned new_error = ((Ftarget * n) - (Fref * m)) >= 0 ?
152                                                ((Ftarget * n) - (Fref * m)) : ((Fref * m) - (Ftarget * n));
153                         if (new_error < best_error) {
154                                 best_n = n;
155                                 best_m = m;
156                                 best_error = new_error;
157                         }
158                 }
159                 /* But if VLD = 4, then 4m <= 1028 */
160                 else if (m <= 1028) {
161                         /* remember there are still only 8-bits of precision in m, so
162                          * avoid over-optimistic error calculations */
163                         unsigned new_error = ((Ftarget * n) - (Fref * (m & ~3))) >= 0 ?
164                                                ((Ftarget * n) - (Fref * (m & ~3))) : ((Fref * (m & ~3)) - (Ftarget * n));
165                         if (new_error < best_error) {
166                                 best_n = n;
167                                 best_m = m;
168                                 best_error = new_error;
169                         }
170                 }
171         }
172         if (best_m > 257)
173                 best_m >>= 2;   /* divide m by 4, and leave VCO loop divide at 4 */
174         else
175                 divisor |= 4;   /* or set VCO loop divide to 1 */
176         *dclk2_m = best_m - 2;
177         *dclk2_n = best_n - 2;
178         *dclk2_div = divisor;
179         *ppixclock = pixclock;
180         return;
181 }
182
183 static void asiliant_set_timing(struct fb_info *p)
184 {
185         unsigned hd = p->var.xres / 8;
186         unsigned hs = (p->var.xres + p->var.right_margin) / 8;
187         unsigned he = (p->var.xres + p->var.right_margin + p->var.hsync_len) / 8;
188         unsigned ht = (p->var.left_margin + p->var.xres + p->var.right_margin + p->var.hsync_len) / 8;
189         unsigned vd = p->var.yres;
190         unsigned vs = p->var.yres + p->var.lower_margin;
191         unsigned ve = p->var.yres + p->var.lower_margin + p->var.vsync_len;
192         unsigned vt = p->var.upper_margin + p->var.yres + p->var.lower_margin + p->var.vsync_len;
193         unsigned wd = (p->var.xres_virtual * ((p->var.bits_per_pixel+7)/8)) / 8;
194
195         if ((p->var.xres == 640) && (p->var.yres == 480) && (p->var.pixclock == 39722)) {
196           write_fr(0x01, 0x02);  /* LCD */
197         } else {
198           write_fr(0x01, 0x01);  /* CRT */
199         }
200
201         write_cr(0x11, (ve - 1) & 0x0f);
202         write_cr(0x00, (ht - 5) & 0xff);
203         write_cr(0x01, hd - 1);
204         write_cr(0x02, hd);
205         write_cr(0x03, ((ht - 1) & 0x1f) | 0x80);
206         write_cr(0x04, hs);
207         write_cr(0x05, (((ht - 1) & 0x20) <<2) | (he & 0x1f));
208         write_cr(0x3c, (ht - 1) & 0xc0);
209         write_cr(0x06, (vt - 2) & 0xff);
210         write_cr(0x30, (vt - 2) >> 8);
211         write_cr(0x07, 0x00);
212         write_cr(0x08, 0x00);
213         write_cr(0x09, 0x00);
214         write_cr(0x10, (vs - 1) & 0xff);
215         write_cr(0x32, ((vs - 1) >> 8) & 0xf);
216         write_cr(0x11, ((ve - 1) & 0x0f) | 0x80);
217         write_cr(0x12, (vd - 1) & 0xff);
218         write_cr(0x31, ((vd - 1) & 0xf00) >> 8);
219         write_cr(0x13, wd & 0xff);
220         write_cr(0x41, (wd & 0xf00) >> 8);
221         write_cr(0x15, (vs - 1) & 0xff);
222         write_cr(0x33, ((vs - 1) >> 8) & 0xf);
223         write_cr(0x38, ((ht - 5) & 0x100) >> 8);
224         write_cr(0x16, (vt - 1) & 0xff);
225         write_cr(0x18, 0x00);
226
227         if (p->var.xres == 640) {
228           writeb(0xc7, mmio_base + 0x784);      /* set misc output reg */
229         } else {
230           writeb(0x07, mmio_base + 0x784);      /* set misc output reg */
231         }
232 }
233
234 static int asiliantfb_check_var(struct fb_var_screeninfo *var,
235                              struct fb_info *p)
236 {
237         unsigned long Ftarget, ratio, remainder;
238
239         ratio = 1000000 / var->pixclock;
240         remainder = 1000000 % var->pixclock;
241         Ftarget = 1000000 * ratio + (1000000 * remainder) / var->pixclock;
242
243         /* First check the constraint that the maximum post-VCO divisor is 32,
244          * and the maximum Fvco is 220MHz */
245         if (Ftarget > 220000000 || Ftarget < 3125000) {
246                 printk(KERN_ERR "asiliantfb dotclock must be between 3.125 and 220MHz\n");
247                 return -ENXIO;
248         }
249         var->xres_virtual = var->xres;
250         var->yres_virtual = var->yres;
251
252         if (var->bits_per_pixel == 24) {
253                 var->red.offset = 16;
254                 var->green.offset = 8;
255                 var->blue.offset = 0;
256                 var->red.length = var->blue.length = var->green.length = 8;
257         } else if (var->bits_per_pixel == 16) {
258                 switch (var->red.offset) {
259                         case 11:
260                                 var->green.length = 6;
261                                 break;
262                         case 10:
263                                 var->green.length = 5;
264                                 break;
265                         default:
266                                 return -EINVAL;
267                 }
268                 var->green.offset = 5;
269                 var->blue.offset = 0;
270                 var->red.length = var->blue.length = 5;
271         } else if (var->bits_per_pixel == 8) {
272                 var->red.offset = var->green.offset = var->blue.offset = 0;
273                 var->red.length = var->green.length = var->blue.length = 8;
274         }
275         return 0;
276 }
277
278 static int asiliantfb_set_par(struct fb_info *p)
279 {
280         u8 dclk2_m;             /* Holds m-2 value for register */
281         u8 dclk2_n;             /* Holds n-2 value for register */
282         u8 dclk2_div;           /* Holds divisor bitmask */
283
284         /* Set pixclock */
285         asiliant_calc_dclk2(&p->var.pixclock, &dclk2_m, &dclk2_n, &dclk2_div);
286
287         /* Set color depth */
288         if (p->var.bits_per_pixel == 24) {
289                 write_xr(0x81, 0x16);   /* 24 bit packed color mode */
290                 write_xr(0x82, 0x00);   /* Disable palettes */
291                 write_xr(0x20, 0x20);   /* 24 bit blitter mode */
292         } else if (p->var.bits_per_pixel == 16) {
293                 if (p->var.red.offset == 11)
294                         write_xr(0x81, 0x15);   /* 16 bit color mode */
295                 else
296                         write_xr(0x81, 0x14);   /* 15 bit color mode */
297                 write_xr(0x82, 0x00);   /* Disable palettes */
298                 write_xr(0x20, 0x10);   /* 16 bit blitter mode */
299         } else if (p->var.bits_per_pixel == 8) {
300                 write_xr(0x0a, 0x02);   /* Linear */
301                 write_xr(0x81, 0x12);   /* 8 bit color mode */
302                 write_xr(0x82, 0x00);   /* Graphics gamma enable */
303                 write_xr(0x20, 0x00);   /* 8 bit blitter mode */
304         }
305         p->fix.line_length = p->var.xres * (p->var.bits_per_pixel >> 3);
306         p->fix.visual = (p->var.bits_per_pixel == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
307         write_xr(0xc4, dclk2_m);
308         write_xr(0xc5, dclk2_n);
309         write_xr(0xc7, dclk2_div);
310         /* Set up the CR registers */
311         asiliant_set_timing(p);
312         return 0;
313 }
314
315 static int asiliantfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
316                              u_int transp, struct fb_info *p)
317 {
318         if (regno > 255)
319                 return 1;
320         red >>= 8;
321         green >>= 8;
322         blue >>= 8;
323
324         /* Set hardware palete */
325         writeb(regno, mmio_base + 0x790);
326         udelay(1);
327         writeb(red, mmio_base + 0x791);
328         writeb(green, mmio_base + 0x791);
329         writeb(blue, mmio_base + 0x791);
330
331         switch(p->var.bits_per_pixel) {
332         case 15:
333                 if (regno < 16) {
334                         ((u32 *)(p->pseudo_palette))[regno] =
335                                 ((red & 0xf8) << 7) |
336                                 ((green & 0xf8) << 2) |
337                                 ((blue & 0xf8) >> 3);
338                 }
339                 break;
340         case 16:
341                 if (regno < 16) {
342                         ((u32 *)(p->pseudo_palette))[regno] =
343                                 ((red & 0xf8) << 8) |
344                                 ((green & 0xfc) << 3) |
345                                 ((blue & 0xf8) >> 3);
346                 }
347                 break;
348         case 24:
349                 if (regno < 24) {
350                         ((u32 *)(p->pseudo_palette))[regno] =
351                                 (red << 16)  |
352                                 (green << 8) |
353                                 (blue);
354                 }
355                 break;
356         }
357         return 0;
358 }
359
360 struct chips_init_reg {
361         unsigned char addr;
362         unsigned char data;
363 };
364
365 #define N_ELTS(x)       (sizeof(x) / sizeof(x[0]))
366
367 static struct chips_init_reg chips_init_sr[] =
368 {
369         {0x00, 0x03},           /* Reset register */
370         {0x01, 0x01},           /* Clocking mode */
371         {0x02, 0x0f},           /* Plane mask */
372         {0x04, 0x0e}            /* Memory mode */
373 };
374
375 static struct chips_init_reg chips_init_gr[] =
376 {
377         {0x03, 0x00},           /* Data rotate */
378         {0x05, 0x00},           /* Graphics mode */
379         {0x06, 0x01},           /* Miscellaneous */
380         {0x08, 0x00}            /* Bit mask */
381 };
382
383 static struct chips_init_reg chips_init_ar[] =
384 {
385         {0x10, 0x01},           /* Mode control */
386         {0x11, 0x00},           /* Overscan */
387         {0x12, 0x0f},           /* Memory plane enable */
388         {0x13, 0x00}            /* Horizontal pixel panning */
389 };
390
391 static struct chips_init_reg chips_init_cr[] =
392 {
393         {0x0c, 0x00},           /* Start address high */
394         {0x0d, 0x00},           /* Start address low */
395         {0x40, 0x00},           /* Extended Start Address */
396         {0x41, 0x00},           /* Extended Start Address */
397         {0x14, 0x00},           /* Underline location */
398         {0x17, 0xe3},           /* CRT mode control */
399         {0x70, 0x00}            /* Interlace control */
400 };
401
402
403 static struct chips_init_reg chips_init_fr[] =
404 {
405         {0x01, 0x02},
406         {0x03, 0x08},
407         {0x08, 0xcc},
408         {0x0a, 0x08},
409         {0x18, 0x00},
410         {0x1e, 0x80},
411         {0x40, 0x83},
412         {0x41, 0x00},
413         {0x48, 0x13},
414         {0x4d, 0x60},
415         {0x4e, 0x0f},
416
417         {0x0b, 0x01},
418
419         {0x21, 0x51},
420         {0x22, 0x1d},
421         {0x23, 0x5f},
422         {0x20, 0x4f},
423         {0x34, 0x00},
424         {0x24, 0x51},
425         {0x25, 0x00},
426         {0x27, 0x0b},
427         {0x26, 0x00},
428         {0x37, 0x80},
429         {0x33, 0x0b},
430         {0x35, 0x11},
431         {0x36, 0x02},
432         {0x31, 0xea},
433         {0x32, 0x0c},
434         {0x30, 0xdf},
435         {0x10, 0x0c},
436         {0x11, 0xe0},
437         {0x12, 0x50},
438         {0x13, 0x00},
439         {0x16, 0x03},
440         {0x17, 0xbd},
441         {0x1a, 0x00},
442 };
443
444
445 static struct chips_init_reg chips_init_xr[] =
446 {
447         {0xce, 0x00},           /* set default memory clock */
448         {0xcc, 200 },           /* MCLK ratio M */
449         {0xcd, 18  },           /* MCLK ratio N */
450         {0xce, 0x90},           /* MCLK divisor = 2 */
451
452         {0xc4, 209 },
453         {0xc5, 118 },
454         {0xc7, 32  },
455         {0xcf, 0x06},
456         {0x09, 0x01},           /* IO Control - CRT controller extensions */
457         {0x0a, 0x02},           /* Frame buffer mapping */
458         {0x0b, 0x01},           /* PCI burst write */
459         {0x40, 0x03},           /* Memory access control */
460         {0x80, 0x82},           /* Pixel pipeline configuration 0 */
461         {0x81, 0x12},           /* Pixel pipeline configuration 1 */
462         {0x82, 0x08},           /* Pixel pipeline configuration 2 */
463
464         {0xd0, 0x0f},
465         {0xd1, 0x01},
466 };
467
468 static void __init chips_hw_init(struct fb_info *p)
469 {
470         int i;
471
472         for (i = 0; i < N_ELTS(chips_init_xr); ++i)
473                 write_xr(chips_init_xr[i].addr, chips_init_xr[i].data);
474         write_xr(0x81, 0x12);
475         write_xr(0x82, 0x08);
476         write_xr(0x20, 0x00);
477         for (i = 0; i < N_ELTS(chips_init_sr); ++i)
478                 write_sr(chips_init_sr[i].addr, chips_init_sr[i].data);
479         for (i = 0; i < N_ELTS(chips_init_gr); ++i)
480                 write_gr(chips_init_gr[i].addr, chips_init_gr[i].data);
481         for (i = 0; i < N_ELTS(chips_init_ar); ++i)
482                 write_ar(chips_init_ar[i].addr, chips_init_ar[i].data);
483         /* Enable video output in attribute index register */
484         writeb(0x20, mmio_base + 0x780);
485         for (i = 0; i < N_ELTS(chips_init_cr); ++i)
486                 write_cr(chips_init_cr[i].addr, chips_init_cr[i].data);
487         for (i = 0; i < N_ELTS(chips_init_fr); ++i)
488                 write_fr(chips_init_fr[i].addr, chips_init_fr[i].data);
489 }
490
491 static struct fb_fix_screeninfo asiliantfb_fix __initdata = {
492         .id =           "Asiliant 69000",
493         .type =         FB_TYPE_PACKED_PIXELS,
494         .visual =       FB_VISUAL_PSEUDOCOLOR,
495         .accel =        FB_ACCEL_NONE,
496         .line_length =  640,
497         .smem_len =     0x200000,       /* 2MB */
498 };
499
500 static struct fb_var_screeninfo asiliantfb_var __initdata = {
501         .xres           = 640,
502         .yres           = 480,
503         .xres_virtual   = 640,
504         .yres_virtual   = 480,
505         .bits_per_pixel = 8,
506         .red            = { .length = 8 },
507         .green          = { .length = 8 },
508         .blue           = { .length = 8 },
509         .height         = -1,
510         .width          = -1,
511         .vmode          = FB_VMODE_NONINTERLACED,
512         .pixclock       = 39722,
513         .left_margin    = 48,
514         .right_margin   = 16,
515         .upper_margin   = 33,
516         .lower_margin   = 10,
517         .hsync_len      = 96,
518         .vsync_len      = 2,
519 };
520
521 static void __init init_asiliant(struct fb_info *p, unsigned long addr)
522 {
523         p->fix                  = asiliantfb_fix;
524         p->fix.smem_start       = addr;
525         p->var                  = asiliantfb_var;
526         p->fbops                = &asiliantfb_ops;
527         p->flags                = FBINFO_DEFAULT;
528
529         fb_alloc_cmap(&p->cmap, 256, 0);
530
531         if (register_framebuffer(p) < 0) {
532                 printk(KERN_ERR "C&T 69000 framebuffer failed to register\n");
533                 return;
534         }
535
536         printk(KERN_INFO "fb%d: Asiliant 69000 frame buffer (%dK RAM detected)\n",
537                 p->node, p->fix.smem_len / 1024);
538
539         writeb(0xff, mmio_base + 0x78c);
540         chips_hw_init(p);
541 }
542
543 static int __devinit
544 asiliantfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
545 {
546         unsigned long addr, size;
547         struct fb_info *p;
548
549         if ((dp->resource[0].flags & IORESOURCE_MEM) == 0)
550                 return -ENODEV;
551         addr = pci_resource_start(dp, 0);
552         size = pci_resource_len(dp, 0);
553         if (addr == 0)
554                 return -ENODEV;
555         if (!request_mem_region(addr, size, "asiliantfb"))
556                 return -EBUSY;
557
558         p = framebuffer_alloc(sizeof(u32) * 256, &dp->dev);
559         if (!p) {
560                 release_mem_region(addr, size);
561                 return -ENOMEM;
562         }
563         p->pseudo_palette = p->par;
564         p->par = NULL;
565
566         p->screen_base = ioremap(addr, 0x800000);
567         if (p->screen_base == NULL) {
568                 release_mem_region(addr, size);
569                 framebuffer_release(p);
570                 return -ENOMEM;
571         }
572
573         pci_write_config_dword(dp, 4, 0x02800083);
574         writeb(3, p->screen_base + 0x400784);
575
576         init_asiliant(p, addr);
577
578         pci_set_drvdata(dp, p);
579         return 0;
580 }
581
582 static void __devexit asiliantfb_remove(struct pci_dev *dp)
583 {
584         struct fb_info *p = pci_get_drvdata(dp);
585
586         unregister_framebuffer(p);
587         iounmap(p->screen_base);
588         release_mem_region(pci_resource_start(dp, 0), pci_resource_len(dp, 0));
589         pci_set_drvdata(dp, NULL);
590         framebuffer_release(p);
591 }
592
593 static struct pci_device_id asiliantfb_pci_tbl[] __devinitdata = {
594         { PCI_VENDOR_ID_CT, PCI_DEVICE_ID_CT_69000, PCI_ANY_ID, PCI_ANY_ID },
595         { 0 }
596 };
597
598 MODULE_DEVICE_TABLE(pci, asiliantfb_pci_tbl);
599
600 static struct pci_driver asiliantfb_driver = {
601         .name =         "asiliantfb",
602         .id_table =     asiliantfb_pci_tbl,
603         .probe =        asiliantfb_pci_init,
604         .remove =       __devexit_p(asiliantfb_remove),
605 };
606
607 int __init asiliantfb_init(void)
608 {
609         if (fb_get_options("asiliantfb", NULL))
610                 return -ENODEV;
611
612         return pci_module_init(&asiliantfb_driver);
613 }
614
615 module_init(asiliantfb_init);
616
617 static void __exit asiliantfb_exit(void)
618 {
619         pci_unregister_driver(&asiliantfb_driver);
620 }
621
622 MODULE_LICENSE("GPL");