2 * linux/drivers/video/kyro/fbdev.c
4 * Copyright (C) 2002 STMicroelectronics
5 * Copyright (C) 2003, 2004 Paul Mundt
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive
12 #include <linux/module.h>
13 #include <linux/types.h>
14 #include <linux/kernel.h>
15 #include <linux/sched.h>
17 #include <linux/errno.h>
18 #include <linux/string.h>
19 #include <linux/delay.h>
21 #include <linux/ioctl.h>
22 #include <linux/init.h>
23 #include <linux/pci.h>
25 #include <asm/uaccess.h>
30 #include <video/kyro.h>
32 #include "STG4000Reg.h"
33 #include "STG4000Interface.h"
38 #define PCI_VENDOR_ID_ST 0x104a
39 #define PCI_DEVICE_ID_STG4000 0x0010
41 #define KHZ2PICOS(a) (1000000000UL/(a))
43 /****************************************************************************/
44 static struct fb_fix_screeninfo kyro_fix __devinitdata = {
46 .type = FB_TYPE_PACKED_PIXELS,
47 .visual = FB_VISUAL_TRUECOLOR,
48 .accel = FB_ACCEL_NONE,
51 static struct fb_var_screeninfo kyro_var __devinitdata = {
52 /* 640x480, 16bpp @ 60 Hz */
61 .activate = FB_ACTIVATE_NOW,
64 .pixclock = KHZ2PICOS(25175),
71 .vmode = FB_VMODE_NONINTERLACED,
75 STG4000REG __iomem *pSTGReg; /* Virtual address of PCI register region */
76 u32 ulNextFreeVidMem; /* Offset from start of vid mem to next free region */
77 u32 ulOverlayOffset; /* Offset from start of vid mem to overlay */
78 u32 ulOverlayStride; /* Interleaved YUV and 422 mode Y stride */
79 u32 ulOverlayUVStride; /* 422 mode U & V stride */
82 /* global graphics card info structure (one per card) */
83 static device_info_t deviceInfo;
85 static char *mode_option __devinitdata = NULL;
86 static int nopan __devinitdata = 0;
87 static int nowrap __devinitdata = 1;
89 static int nomtrr __devinitdata = 0;
92 /* PCI driver prototypes */
93 static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
94 static void kyrofb_remove(struct pci_dev *pdev);
96 static struct fb_videomode kyro_modedb[] __devinitdata = {
99 NULL, 85, 640, 350, KHZ2PICOS(31500),
100 96, 32, 60, 32, 64, 3,
101 FB_SYNC_HOR_HIGH_ACT, FB_VMODE_NONINTERLACED
104 NULL, 85, 640, 400, KHZ2PICOS(31500),
105 96, 32, 41, 1, 64, 3,
106 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
109 NULL, 85, 720, 400, KHZ2PICOS(35500),
110 108, 36, 42, 1, 72, 3,
111 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
114 NULL, 60, 640, 480, KHZ2PICOS(25175),
115 48, 16, 33, 10, 96, 2,
116 0, FB_VMODE_NONINTERLACED
119 NULL, 72, 640, 480, KHZ2PICOS(31500),
120 128, 24, 28, 9, 40, 3,
121 0, FB_VMODE_NONINTERLACED
124 NULL, 75, 640, 480, KHZ2PICOS(31500),
125 120, 16, 16, 1, 64, 3,
126 0, FB_VMODE_NONINTERLACED
129 NULL, 85, 640, 480, KHZ2PICOS(36000),
130 80, 56, 25, 1, 56, 3,
131 0, FB_VMODE_NONINTERLACED
134 NULL, 56, 800, 600, KHZ2PICOS(36000),
135 128, 24, 22, 1, 72, 2,
136 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
139 NULL, 60, 800, 600, KHZ2PICOS(40000),
140 88, 40, 23, 1, 128, 4,
141 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
144 NULL, 72, 800, 600, KHZ2PICOS(50000),
145 64, 56, 23, 37, 120, 6,
146 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
149 NULL, 75, 800, 600, KHZ2PICOS(49500),
150 160, 16, 21, 1, 80, 3,
151 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
154 NULL, 85, 800, 600, KHZ2PICOS(56250),
155 152, 32, 27, 1, 64, 3,
156 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
158 /* 1024x768 @ 60Hz */
159 NULL, 60, 1024, 768, KHZ2PICOS(65000),
160 160, 24, 29, 3, 136, 6,
161 0, FB_VMODE_NONINTERLACED
163 /* 1024x768 @ 70Hz */
164 NULL, 70, 1024, 768, KHZ2PICOS(75000),
165 144, 24, 29, 3, 136, 6,
166 0, FB_VMODE_NONINTERLACED
168 /* 1024x768 @ 75Hz */
169 NULL, 75, 1024, 768, KHZ2PICOS(78750),
170 176, 16, 28, 1, 96, 3,
171 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
173 /* 1024x768 @ 85Hz */
174 NULL, 85, 1024, 768, KHZ2PICOS(94500),
175 208, 48, 36, 1, 96, 3,
176 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
178 /* 1152x864 @ 75Hz */
179 NULL, 75, 1152, 864, KHZ2PICOS(108000),
180 256, 64, 32, 1, 128, 3,
181 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
183 /* 1280x960 @ 60Hz */
184 NULL, 60, 1280, 960, KHZ2PICOS(108000),
185 312, 96, 36, 1, 112, 3,
186 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
188 /* 1280x960 @ 85Hz */
189 NULL, 85, 1280, 960, KHZ2PICOS(148500),
190 224, 64, 47, 1, 160, 3,
191 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
193 /* 1280x1024 @ 60Hz */
194 NULL, 60, 1280, 1024, KHZ2PICOS(108000),
195 248, 48, 38, 1, 112, 3,
196 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
198 /* 1280x1024 @ 75Hz */
199 NULL, 75, 1280, 1024, KHZ2PICOS(135000),
200 248, 16, 38, 1, 144, 3,
201 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
203 /* 1280x1024 @ 85Hz */
204 NULL, 85, 1280, 1024, KHZ2PICOS(157500),
205 224, 64, 44, 1, 160, 3,
206 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
208 /* 1600x1200 @ 60Hz */
209 NULL, 60, 1600, 1200, KHZ2PICOS(162000),
210 304, 64, 46, 1, 192, 3,
211 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
213 /* 1600x1200 @ 65Hz */
214 NULL, 65, 1600, 1200, KHZ2PICOS(175500),
215 304, 64, 46, 1, 192, 3,
216 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
218 /* 1600x1200 @ 70Hz */
219 NULL, 70, 1600, 1200, KHZ2PICOS(189000),
220 304, 64, 46, 1, 192, 3,
221 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
223 /* 1600x1200 @ 75Hz */
224 NULL, 75, 1600, 1200, KHZ2PICOS(202500),
225 304, 64, 46, 1, 192, 3,
226 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
228 /* 1600x1200 @ 85Hz */
229 NULL, 85, 1600, 1200, KHZ2PICOS(229500),
230 304, 64, 46, 1, 192, 3,
231 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
233 /* 1792x1344 @ 60Hz */
234 NULL, 60, 1792, 1344, KHZ2PICOS(204750),
235 328, 128, 46, 1, 200, 3,
236 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
238 /* 1792x1344 @ 75Hz */
239 NULL, 75, 1792, 1344, KHZ2PICOS(261000),
240 352, 96, 69, 1, 216, 3,
241 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
243 /* 1856x1392 @ 60Hz */
244 NULL, 60, 1856, 1392, KHZ2PICOS(218250),
245 352, 96, 43, 1, 224, 3,
246 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
248 /* 1856x1392 @ 75Hz */
249 NULL, 75, 1856, 1392, KHZ2PICOS(288000),
250 352, 128, 104, 1, 224, 3,
251 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
253 /* 1920x1440 @ 60Hz */
254 NULL, 60, 1920, 1440, KHZ2PICOS(234000),
255 344, 128, 56, 1, 208, 3,
256 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
258 /* 1920x1440 @ 75Hz */
259 NULL, 75, 1920, 1440, KHZ2PICOS(297000),
260 352, 144, 56, 1, 224, 3,
261 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
264 #define NUM_TOTAL_MODES ARRAY_SIZE(kyro_modedb)
267 * This needs to be kept ordered corresponding to kyro_modedb.
306 static int kyro_dev_video_mode_set(struct fb_info *info)
308 struct kyrofb_info *par = info->par;
310 /* Turn off display */
311 StopVTG(deviceInfo.pSTGReg);
312 DisableRamdacOutput(deviceInfo.pSTGReg);
314 /* Bring us out of VGA and into Hi-Res mode, if not already. */
315 DisableVGA(deviceInfo.pSTGReg);
317 if (InitialiseRamdac(deviceInfo.pSTGReg,
318 info->var.bits_per_pixel,
319 info->var.xres, info->var.yres,
320 par->HSP, par->VSP, &par->PIXCLK) < 0)
323 SetupVTG(deviceInfo.pSTGReg, par);
325 ResetOverlayRegisters(deviceInfo.pSTGReg);
327 /* Turn on display in new mode */
328 EnableRamdacOutput(deviceInfo.pSTGReg);
329 StartVTG(deviceInfo.pSTGReg);
331 deviceInfo.ulNextFreeVidMem = info->var.xres * info->var.yres *
332 info->var.bits_per_pixel;
333 deviceInfo.ulOverlayOffset = 0;
338 static int kyro_dev_overlay_create(u32 ulWidth,
339 u32 ulHeight, int bLinear)
342 u32 stride, uvStride;
344 if (deviceInfo.ulOverlayOffset != 0)
346 * Can only create one overlay without resetting the card or
347 * changing display mode
351 ResetOverlayRegisters(deviceInfo.pSTGReg);
353 /* Overlays are addressed in multiples of 16bytes or 32bytes, so make
354 * sure the start offset is on an appropriate boundary.
356 offset = deviceInfo.ulNextFreeVidMem;
357 if ((offset & 0x1f) != 0) {
358 offset = (offset + 32L) & 0xffffffE0L;
361 if (CreateOverlaySurface(deviceInfo.pSTGReg, ulWidth, ulHeight,
362 bLinear, offset, &stride, &uvStride) < 0)
365 deviceInfo.ulOverlayOffset = offset;
366 deviceInfo.ulOverlayStride = stride;
367 deviceInfo.ulOverlayUVStride = uvStride;
368 deviceInfo.ulNextFreeVidMem = offset + (ulHeight * stride) + (ulHeight * 2 * uvStride);
370 SetOverlayBlendMode(deviceInfo.pSTGReg, GLOBAL_ALPHA, 0xf, 0x0);
375 static int kyro_dev_overlay_viewport_set(u32 x, u32 y, u32 ulWidth, u32 ulHeight)
377 if (deviceInfo.ulOverlayOffset == 0)
378 /* probably haven't called CreateOverlay yet */
381 /* Stop Ramdac Output */
382 DisableRamdacOutput(deviceInfo.pSTGReg);
384 SetOverlayViewPort(deviceInfo.pSTGReg,
385 x, y, x + ulWidth - 1, y + ulHeight - 1);
387 EnableOverlayPlane(deviceInfo.pSTGReg);
388 /* Start Ramdac Output */
389 EnableRamdacOutput(deviceInfo.pSTGReg);
394 static inline unsigned long get_line_length(int x, int bpp)
396 return (unsigned long)((((x*bpp)+31)&~31) >> 3);
399 static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
401 struct kyrofb_info *par = info->par;
403 if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) {
404 printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel);
408 switch (var->bits_per_pixel) {
410 var->red.offset = 11;
412 var->green.offset = 5;
413 var->green.length = 6;
414 var->blue.length = 5;
417 var->transp.offset = 24;
418 var->red.offset = 16;
419 var->green.offset = 8;
420 var->blue.offset = 0;
423 var->green.length = 8;
424 var->blue.length = 8;
425 var->transp.length = 8;
429 /* Height/Width of picture in mm */
430 var->height = var->width = -1;
432 /* Timing information. All values are in picoseconds */
434 /* par->PIXCLK is in 100Hz units. Convert to picoseconds -
435 * ensuring we do not exceed 32 bit precision
438 * XXX: Enabling this really screws over the pixclock value when we
439 * read it back with fbset. As such, leaving this commented out appears
440 * to do the right thing (at least for now) .. bearing in mind that we
441 * have infact already done the KHZ2PICOS conversion in both the modedb
442 * and kyro_var. -- PFM.
444 // var->pixclock = 1000000000 / (par->PIXCLK / 10);
446 /* the header file claims we should use picoseconds
447 * - nobody else does though, the all use pixels and lines
448 * of h and v sizes. Both options here.
452 * If we're being called by __fb_try_mode(), then we don't want to
453 * override any of the var settings that we've already parsed
454 * from our modedb. -- PFM.
456 if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_TEST)
459 var->left_margin = par->HBP;
460 var->hsync_len = par->HST;
461 var->right_margin = par->HFP;
463 var->upper_margin = par->VBP;
464 var->vsync_len = par->VST;
465 var->lower_margin = par->VFP;
468 var->sync |= FB_SYNC_HOR_HIGH_ACT;
470 var->sync |= FB_SYNC_VERT_HIGH_ACT;
475 static int kyrofb_set_par(struct fb_info *info)
477 struct kyrofb_info *par = info->par;
478 unsigned long lineclock;
479 unsigned long frameclock;
481 /* Actual resolution */
482 par->XRES = info->var.xres;
483 par->YRES = info->var.yres;
486 par->PIXDEPTH = info->var.bits_per_pixel;
489 /* time for a line in ns */
490 lineclock = (info->var.pixclock * (info->var.xres +
491 info->var.right_margin +
492 info->var.hsync_len +
493 info->var.left_margin)) / 1000;
496 /* time for a frame in ns (precision in 32bpp) */
497 frameclock = lineclock * (info->var.yres +
498 info->var.lower_margin +
499 info->var.vsync_len +
500 info->var.upper_margin);
502 /* Calculate refresh rate and horrizontal clocks */
503 par->VFREQ = (1000000000 + (frameclock / 2)) / frameclock;
504 par->HCLK = (1000000000 + (lineclock / 2)) / lineclock;
505 par->PIXCLK = ((1000000000 + (info->var.pixclock / 2))
506 / info->var.pixclock) * 10;
508 /* calculate horizontal timings */
509 par->HFP = info->var.right_margin;
510 par->HST = info->var.hsync_len;
511 par->HBP = info->var.left_margin;
512 par->HTot = par->XRES + par->HBP + par->HST + par->HFP;
514 /* calculate vertical timings */
515 par->VFP = info->var.lower_margin;
516 par->VST = info->var.vsync_len;
517 par->VBP = info->var.upper_margin;
518 par->VTot = par->YRES + par->VBP + par->VST + par->VFP;
520 par->HSP = (info->var.sync & FB_SYNC_HOR_HIGH_ACT) ? 1 : 0;
521 par->VSP = (info->var.sync & FB_SYNC_VERT_HIGH_ACT) ? 1 : 0;
523 kyro_dev_video_mode_set(info);
525 /* length of a line in bytes */
526 info->fix.line_length = get_line_length(par->XRES, par->PIXDEPTH);
527 info->fix.visual = FB_VISUAL_TRUECOLOR;
532 static int kyrofb_setcolreg(u_int regno, u_int red, u_int green,
533 u_int blue, u_int transp, struct fb_info *info)
535 struct kyrofb_info *par = info->par;
538 return 1; /* Invalid register */
541 switch (info->var.bits_per_pixel) {
543 par->palette[regno] =
545 ((green & 0xfc00) >> 5) |
546 ((blue & 0xf800) >> 11);
549 red >>= 8; green >>= 8; blue >>= 8; transp >>= 8;
550 par->palette[regno] =
551 (transp << 24) | (red << 16) | (green << 8) | blue;
560 static int __init kyrofb_setup(char *options)
564 if (!options || !*options)
567 while ((this_opt = strsep(&options, ","))) {
570 if (strcmp(this_opt, "nopan") == 0) {
572 } else if (strcmp(this_opt, "nowrap") == 0) {
575 } else if (strcmp(this_opt, "nomtrr") == 0) {
579 mode_option = this_opt;
587 static int kyrofb_ioctl(struct fb_info *info,
588 unsigned int cmd, unsigned long arg)
590 overlay_create ol_create;
591 overlay_viewport_set ol_viewport_set;
592 void __user *argp = (void __user *)arg;
595 case KYRO_IOCTL_OVERLAY_CREATE:
596 if (copy_from_user(&ol_create, argp, sizeof(overlay_create)))
599 if (kyro_dev_overlay_create(ol_create.ulWidth,
600 ol_create.ulHeight, 0) < 0) {
601 printk(KERN_ERR "Kyro FB: failed to create overlay surface.\n");
606 case KYRO_IOCTL_OVERLAY_VIEWPORT_SET:
607 if (copy_from_user(&ol_viewport_set, argp,
608 sizeof(overlay_viewport_set)))
611 if (kyro_dev_overlay_viewport_set(ol_viewport_set.xOrgin,
612 ol_viewport_set.yOrgin,
613 ol_viewport_set.xSize,
614 ol_viewport_set.ySize) != 0)
616 printk(KERN_ERR "Kyro FB: failed to create overlay viewport.\n");
620 case KYRO_IOCTL_SET_VIDEO_MODE:
622 printk(KERN_ERR "Kyro FB: KYRO_IOCTL_SET_VIDEO_MODE is"
623 "obsolete, use the appropriate fb_ioctl()"
624 "command instead.\n");
628 case KYRO_IOCTL_UVSTRIDE:
629 if (copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(unsigned long)))
632 case KYRO_IOCTL_STRIDE:
633 if (copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(unsigned long)))
636 case KYRO_IOCTL_OVERLAY_OFFSET:
637 if (copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(unsigned long)))
645 static struct pci_device_id kyrofb_pci_tbl[] = {
646 { PCI_VENDOR_ID_ST, PCI_DEVICE_ID_STG4000,
647 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
651 MODULE_DEVICE_TABLE(pci, kyrofb_pci_tbl);
653 static struct pci_driver kyrofb_pci_driver = {
655 .id_table = kyrofb_pci_tbl,
656 .probe = kyrofb_probe,
657 .remove = __devexit_p(kyrofb_remove),
660 static struct fb_ops kyrofb_ops = {
661 .owner = THIS_MODULE,
662 .fb_check_var = kyrofb_check_var,
663 .fb_set_par = kyrofb_set_par,
664 .fb_setcolreg = kyrofb_setcolreg,
665 .fb_ioctl = kyrofb_ioctl,
666 .fb_fillrect = cfb_fillrect,
667 .fb_copyarea = cfb_copyarea,
668 .fb_imageblit = cfb_imageblit,
671 static int __devinit kyrofb_probe(struct pci_dev *pdev,
672 const struct pci_device_id *ent)
674 struct fb_info *info;
675 struct kyrofb_info *currentpar;
679 if ((err = pci_enable_device(pdev))) {
680 printk(KERN_WARNING "kyrofb: Can't enable pdev: %d\n", err);
684 info = framebuffer_alloc(sizeof(struct kyrofb_info), &pdev->dev);
688 currentpar = info->par;
690 kyro_fix.smem_start = pci_resource_start(pdev, 0);
691 kyro_fix.smem_len = pci_resource_len(pdev, 0);
692 kyro_fix.mmio_start = pci_resource_start(pdev, 1);
693 kyro_fix.mmio_len = pci_resource_len(pdev, 1);
695 currentpar->regbase = deviceInfo.pSTGReg =
696 ioremap_nocache(kyro_fix.mmio_start, kyro_fix.mmio_len);
698 info->screen_base = ioremap_nocache(kyro_fix.smem_start,
703 currentpar->mtrr_handle =
704 mtrr_add(kyro_fix.smem_start,
706 MTRR_TYPE_WRCOMB, 1);
709 kyro_fix.ypanstep = nopan ? 0 : 1;
710 kyro_fix.ywrapstep = nowrap ? 0 : 1;
712 info->fbops = &kyrofb_ops;
713 info->fix = kyro_fix;
714 info->pseudo_palette = currentpar->palette;
715 info->flags = FBINFO_DEFAULT;
717 SetCoreClockPLL(deviceInfo.pSTGReg, pdev);
719 deviceInfo.ulNextFreeVidMem = 0;
720 deviceInfo.ulOverlayOffset = 0;
722 /* This should give a reasonable default video mode */
723 if (!fb_find_mode(&info->var, info, mode_option, kyro_modedb,
724 NUM_TOTAL_MODES, &kyro_modedb[VMODE_1024_768_75], 32))
725 info->var = kyro_var;
727 fb_alloc_cmap(&info->cmap, 256, 0);
729 kyrofb_set_par(info);
730 kyrofb_check_var(&info->var, info);
732 size = get_line_length(info->var.xres_virtual,
733 info->var.bits_per_pixel);
734 size *= info->var.yres_virtual;
736 fb_memset(info->screen_base, 0, size);
738 if (register_framebuffer(info) < 0)
741 printk("fb%d: %s frame buffer device, at %dx%d@%d using %ldk/%ldk of VRAM\n",
742 info->node, info->fix.id, info->var.xres,
743 info->var.yres, info->var.bits_per_pixel, size >> 10,
744 (unsigned long)info->fix.smem_len >> 10);
746 pci_set_drvdata(pdev, info);
751 iounmap(currentpar->regbase);
752 iounmap(info->screen_base);
753 framebuffer_release(info);
758 static void __devexit kyrofb_remove(struct pci_dev *pdev)
760 struct fb_info *info = pci_get_drvdata(pdev);
761 struct kyrofb_info *par = info->par;
763 /* Reset the board */
764 StopVTG(deviceInfo.pSTGReg);
765 DisableRamdacOutput(deviceInfo.pSTGReg);
767 /* Sync up the PLL */
768 SetCoreClockPLL(deviceInfo.pSTGReg, pdev);
770 deviceInfo.ulNextFreeVidMem = 0;
771 deviceInfo.ulOverlayOffset = 0;
773 iounmap(info->screen_base);
774 iounmap(par->regbase);
777 if (par->mtrr_handle)
778 mtrr_del(par->mtrr_handle,
779 info->fix.smem_start,
783 unregister_framebuffer(info);
784 pci_set_drvdata(pdev, NULL);
785 framebuffer_release(info);
788 static int __init kyrofb_init(void)
793 if (fb_get_options("kyrofb", &option))
795 kyrofb_setup(option);
797 return pci_register_driver(&kyrofb_pci_driver);
800 static void __exit kyrofb_exit(void)
802 pci_unregister_driver(&kyrofb_pci_driver);
805 module_init(kyrofb_init);
808 module_exit(kyrofb_exit);
811 MODULE_AUTHOR("STMicroelectronics; Paul Mundt <lethal@linux-sh.org>");
812 MODULE_LICENSE("GPL");