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/tty.h>
20 #include <linux/delay.h>
22 #include <linux/ioctl.h>
23 #include <linux/init.h>
24 #include <linux/pci.h>
26 #include <asm/uaccess.h>
31 #include <video/kyro.h>
33 #include "STG4000Reg.h"
34 #include "STG4000Interface.h"
39 #define PCI_VENDOR_ID_ST 0x104a
40 #define PCI_DEVICE_ID_STG4000 0x0010
42 #define KHZ2PICOS(a) (1000000000UL/(a))
44 /****************************************************************************/
45 static struct fb_fix_screeninfo kyro_fix __devinitdata = {
47 .type = FB_TYPE_PACKED_PIXELS,
48 .visual = FB_VISUAL_TRUECOLOR,
49 .accel = FB_ACCEL_NONE,
52 static struct fb_var_screeninfo kyro_var __devinitdata = {
53 /* 640x480, 16bpp @ 60 Hz */
62 .activate = FB_ACTIVATE_NOW,
65 .pixclock = KHZ2PICOS(25175),
72 .vmode = FB_VMODE_NONINTERLACED,
76 STG4000REG __iomem *pSTGReg; /* Virtual address of PCI register region */
77 u32 ulNextFreeVidMem; /* Offset from start of vid mem to next free region */
78 u32 ulOverlayOffset; /* Offset from start of vid mem to overlay */
79 u32 ulOverlayStride; /* Interleaved YUV and 422 mode Y stride */
80 u32 ulOverlayUVStride; /* 422 mode U & V stride */
83 /* global graphics card info structure (one per card) */
84 static device_info_t deviceInfo;
86 static char *mode_option __devinitdata = NULL;
87 static int nopan __devinitdata = 0;
88 static int nowrap __devinitdata = 1;
90 static int nomtrr __devinitdata = 0;
93 /* PCI driver prototypes */
94 static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
95 static void kyrofb_remove(struct pci_dev *pdev);
97 static struct fb_videomode kyro_modedb[] __devinitdata = {
100 NULL, 85, 640, 350, KHZ2PICOS(31500),
101 96, 32, 60, 32, 64, 3,
102 FB_SYNC_HOR_HIGH_ACT, FB_VMODE_NONINTERLACED
105 NULL, 85, 640, 400, KHZ2PICOS(31500),
106 96, 32, 41, 1, 64, 3,
107 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
110 NULL, 85, 720, 400, KHZ2PICOS(35500),
111 108, 36, 42, 1, 72, 3,
112 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
115 NULL, 60, 640, 480, KHZ2PICOS(25175),
116 48, 16, 33, 10, 96, 2,
117 0, FB_VMODE_NONINTERLACED
120 NULL, 72, 640, 480, KHZ2PICOS(31500),
121 128, 24, 28, 9, 40, 3,
122 0, FB_VMODE_NONINTERLACED
125 NULL, 75, 640, 480, KHZ2PICOS(31500),
126 120, 16, 16, 1, 64, 3,
127 0, FB_VMODE_NONINTERLACED
130 NULL, 85, 640, 480, KHZ2PICOS(36000),
131 80, 56, 25, 1, 56, 3,
132 0, FB_VMODE_NONINTERLACED
135 NULL, 56, 800, 600, KHZ2PICOS(36000),
136 128, 24, 22, 1, 72, 2,
137 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
140 NULL, 60, 800, 600, KHZ2PICOS(40000),
141 88, 40, 23, 1, 128, 4,
142 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
145 NULL, 72, 800, 600, KHZ2PICOS(50000),
146 64, 56, 23, 37, 120, 6,
147 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
150 NULL, 75, 800, 600, KHZ2PICOS(49500),
151 160, 16, 21, 1, 80, 3,
152 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
155 NULL, 85, 800, 600, KHZ2PICOS(56250),
156 152, 32, 27, 1, 64, 3,
157 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
159 /* 1024x768 @ 60Hz */
160 NULL, 60, 1024, 768, KHZ2PICOS(65000),
161 160, 24, 29, 3, 136, 6,
162 0, FB_VMODE_NONINTERLACED
164 /* 1024x768 @ 70Hz */
165 NULL, 70, 1024, 768, KHZ2PICOS(75000),
166 144, 24, 29, 3, 136, 6,
167 0, FB_VMODE_NONINTERLACED
169 /* 1024x768 @ 75Hz */
170 NULL, 75, 1024, 768, KHZ2PICOS(78750),
171 176, 16, 28, 1, 96, 3,
172 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
174 /* 1024x768 @ 85Hz */
175 NULL, 85, 1024, 768, KHZ2PICOS(94500),
176 208, 48, 36, 1, 96, 3,
177 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
179 /* 1152x864 @ 75Hz */
180 NULL, 75, 1152, 864, KHZ2PICOS(108000),
181 256, 64, 32, 1, 128, 3,
182 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
184 /* 1280x960 @ 60Hz */
185 NULL, 60, 1280, 960, KHZ2PICOS(108000),
186 312, 96, 36, 1, 112, 3,
187 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
189 /* 1280x960 @ 85Hz */
190 NULL, 85, 1280, 960, KHZ2PICOS(148500),
191 224, 64, 47, 1, 160, 3,
192 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
194 /* 1280x1024 @ 60Hz */
195 NULL, 60, 1280, 1024, KHZ2PICOS(108000),
196 248, 48, 38, 1, 112, 3,
197 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
199 /* 1280x1024 @ 75Hz */
200 NULL, 75, 1280, 1024, KHZ2PICOS(135000),
201 248, 16, 38, 1, 144, 3,
202 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
204 /* 1280x1024 @ 85Hz */
205 NULL, 85, 1280, 1024, KHZ2PICOS(157500),
206 224, 64, 44, 1, 160, 3,
207 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
209 /* 1600x1200 @ 60Hz */
210 NULL, 60, 1600, 1200, KHZ2PICOS(162000),
211 304, 64, 46, 1, 192, 3,
212 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
214 /* 1600x1200 @ 65Hz */
215 NULL, 65, 1600, 1200, KHZ2PICOS(175500),
216 304, 64, 46, 1, 192, 3,
217 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
219 /* 1600x1200 @ 70Hz */
220 NULL, 70, 1600, 1200, KHZ2PICOS(189000),
221 304, 64, 46, 1, 192, 3,
222 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
224 /* 1600x1200 @ 75Hz */
225 NULL, 75, 1600, 1200, KHZ2PICOS(202500),
226 304, 64, 46, 1, 192, 3,
227 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
229 /* 1600x1200 @ 85Hz */
230 NULL, 85, 1600, 1200, KHZ2PICOS(229500),
231 304, 64, 46, 1, 192, 3,
232 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
234 /* 1792x1344 @ 60Hz */
235 NULL, 60, 1792, 1344, KHZ2PICOS(204750),
236 328, 128, 46, 1, 200, 3,
237 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
239 /* 1792x1344 @ 75Hz */
240 NULL, 75, 1792, 1344, KHZ2PICOS(261000),
241 352, 96, 69, 1, 216, 3,
242 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
244 /* 1856x1392 @ 60Hz */
245 NULL, 60, 1856, 1392, KHZ2PICOS(218250),
246 352, 96, 43, 1, 224, 3,
247 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
249 /* 1856x1392 @ 75Hz */
250 NULL, 75, 1856, 1392, KHZ2PICOS(288000),
251 352, 128, 104, 1, 224, 3,
252 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
254 /* 1920x1440 @ 60Hz */
255 NULL, 60, 1920, 1440, KHZ2PICOS(234000),
256 344, 128, 56, 1, 208, 3,
257 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
259 /* 1920x1440 @ 75Hz */
260 NULL, 75, 1920, 1440, KHZ2PICOS(297000),
261 352, 144, 56, 1, 224, 3,
262 FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
265 #define NUM_TOTAL_MODES ARRAY_SIZE(kyro_modedb)
268 * This needs to be kept ordered corresponding to kyro_modedb.
307 static int kyro_dev_video_mode_set(struct fb_info *info)
309 struct kyrofb_info *par = info->par;
311 /* Turn off display */
312 StopVTG(deviceInfo.pSTGReg);
313 DisableRamdacOutput(deviceInfo.pSTGReg);
315 /* Bring us out of VGA and into Hi-Res mode, if not already. */
316 DisableVGA(deviceInfo.pSTGReg);
318 if (InitialiseRamdac(deviceInfo.pSTGReg,
319 info->var.bits_per_pixel,
320 info->var.xres, info->var.yres,
321 par->HSP, par->VSP, &par->PIXCLK) < 0)
324 SetupVTG(deviceInfo.pSTGReg, par);
326 ResetOverlayRegisters(deviceInfo.pSTGReg);
328 /* Turn on display in new mode */
329 EnableRamdacOutput(deviceInfo.pSTGReg);
330 StartVTG(deviceInfo.pSTGReg);
332 deviceInfo.ulNextFreeVidMem = info->var.xres * info->var.yres *
333 info->var.bits_per_pixel;
334 deviceInfo.ulOverlayOffset = 0;
339 static int kyro_dev_overlay_create(u32 ulWidth,
340 u32 ulHeight, int bLinear)
343 u32 stride, uvStride;
345 if (deviceInfo.ulOverlayOffset != 0)
347 * Can only create one overlay without resetting the card or
348 * changing display mode
352 ResetOverlayRegisters(deviceInfo.pSTGReg);
354 /* Overlays are addressed in multiples of 16bytes or 32bytes, so make
355 * sure the start offset is on an appropriate boundary.
357 offset = deviceInfo.ulNextFreeVidMem;
358 if ((offset & 0x1f) != 0) {
359 offset = (offset + 32L) & 0xffffffE0L;
362 if (CreateOverlaySurface(deviceInfo.pSTGReg, ulWidth, ulHeight,
363 bLinear, offset, &stride, &uvStride) < 0)
366 deviceInfo.ulOverlayOffset = offset;
367 deviceInfo.ulOverlayStride = stride;
368 deviceInfo.ulOverlayUVStride = uvStride;
369 deviceInfo.ulNextFreeVidMem = offset + (ulHeight * stride) + (ulHeight * 2 * uvStride);
371 SetOverlayBlendMode(deviceInfo.pSTGReg, GLOBAL_ALPHA, 0xf, 0x0);
376 static int kyro_dev_overlay_viewport_set(u32 x, u32 y, u32 ulWidth, u32 ulHeight)
378 if (deviceInfo.ulOverlayOffset == 0)
379 /* probably haven't called CreateOverlay yet */
382 /* Stop Ramdac Output */
383 DisableRamdacOutput(deviceInfo.pSTGReg);
385 SetOverlayViewPort(deviceInfo.pSTGReg,
386 x, y, x + ulWidth - 1, y + ulHeight - 1);
388 EnableOverlayPlane(deviceInfo.pSTGReg);
389 /* Start Ramdac Output */
390 EnableRamdacOutput(deviceInfo.pSTGReg);
395 static inline unsigned long get_line_length(int x, int bpp)
397 return (unsigned long)((((x*bpp)+31)&~31) >> 3);
400 static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
402 struct kyrofb_info *par = info->par;
404 if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) {
405 printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel);
409 switch (var->bits_per_pixel) {
411 var->red.offset = 11;
413 var->green.offset = 5;
414 var->green.length = 6;
415 var->blue.length = 5;
418 var->transp.offset = 24;
419 var->red.offset = 16;
420 var->green.offset = 8;
421 var->blue.offset = 0;
424 var->green.length = 8;
425 var->blue.length = 8;
426 var->transp.length = 8;
430 /* Height/Width of picture in mm */
431 var->height = var->width = -1;
433 /* Timing information. All values are in picoseconds */
435 /* par->PIXCLK is in 100Hz units. Convert to picoseconds -
436 * ensuring we do not exceed 32 bit precision
439 * XXX: Enabling this really screws over the pixclock value when we
440 * read it back with fbset. As such, leaving this commented out appears
441 * to do the right thing (at least for now) .. bearing in mind that we
442 * have infact already done the KHZ2PICOS conversion in both the modedb
443 * and kyro_var. -- PFM.
445 // var->pixclock = 1000000000 / (par->PIXCLK / 10);
447 /* the header file claims we should use picoseconds
448 * - nobody else does though, the all use pixels and lines
449 * of h and v sizes. Both options here.
453 * If we're being called by __fb_try_mode(), then we don't want to
454 * override any of the var settings that we've already parsed
455 * from our modedb. -- PFM.
457 if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_TEST)
460 var->left_margin = par->HBP;
461 var->hsync_len = par->HST;
462 var->right_margin = par->HFP;
464 var->upper_margin = par->VBP;
465 var->vsync_len = par->VST;
466 var->lower_margin = par->VFP;
469 var->sync |= FB_SYNC_HOR_HIGH_ACT;
471 var->sync |= FB_SYNC_VERT_HIGH_ACT;
476 static int kyrofb_set_par(struct fb_info *info)
478 struct kyrofb_info *par = info->par;
479 unsigned long lineclock;
480 unsigned long frameclock;
482 /* Actual resolution */
483 par->XRES = info->var.xres;
484 par->YRES = info->var.yres;
487 par->PIXDEPTH = info->var.bits_per_pixel;
490 /* time for a line in ns */
491 lineclock = (info->var.pixclock * (info->var.xres +
492 info->var.right_margin +
493 info->var.hsync_len +
494 info->var.left_margin)) / 1000;
497 /* time for a frame in ns (precision in 32bpp) */
498 frameclock = lineclock * (info->var.yres +
499 info->var.lower_margin +
500 info->var.vsync_len +
501 info->var.upper_margin);
503 /* Calculate refresh rate and horrizontal clocks */
504 par->VFREQ = (1000000000 + (frameclock / 2)) / frameclock;
505 par->HCLK = (1000000000 + (lineclock / 2)) / lineclock;
506 par->PIXCLK = ((1000000000 + (info->var.pixclock / 2))
507 / info->var.pixclock) * 10;
509 /* calculate horizontal timings */
510 par->HFP = info->var.right_margin;
511 par->HST = info->var.hsync_len;
512 par->HBP = info->var.left_margin;
513 par->HTot = par->XRES + par->HBP + par->HST + par->HFP;
515 /* calculate vertical timings */
516 par->VFP = info->var.lower_margin;
517 par->VST = info->var.vsync_len;
518 par->VBP = info->var.upper_margin;
519 par->VTot = par->YRES + par->VBP + par->VST + par->VFP;
521 par->HSP = (info->var.sync & FB_SYNC_HOR_HIGH_ACT) ? 1 : 0;
522 par->VSP = (info->var.sync & FB_SYNC_VERT_HIGH_ACT) ? 1 : 0;
524 kyro_dev_video_mode_set(info);
526 /* length of a line in bytes */
527 info->fix.line_length = get_line_length(par->XRES, par->PIXDEPTH);
528 info->fix.visual = FB_VISUAL_TRUECOLOR;
533 static int kyrofb_setcolreg(u_int regno, u_int red, u_int green,
534 u_int blue, u_int transp, struct fb_info *info)
536 struct kyrofb_info *par = info->par;
539 return 1; /* Invalid register */
542 switch (info->var.bits_per_pixel) {
544 par->palette[regno] =
546 ((green & 0xfc00) >> 5) |
547 ((blue & 0xf800) >> 11);
550 red >>= 8; green >>= 8; blue >>= 8; transp >>= 8;
551 par->palette[regno] =
552 (transp << 24) | (red << 16) | (green << 8) | blue;
561 static int __init kyrofb_setup(char *options)
565 if (!options || !*options)
568 while ((this_opt = strsep(&options, ","))) {
571 if (strcmp(this_opt, "nopan") == 0) {
573 } else if (strcmp(this_opt, "nowrap") == 0) {
576 } else if (strcmp(this_opt, "nomtrr") == 0) {
580 mode_option = this_opt;
588 static int kyrofb_ioctl(struct fb_info *info,
589 unsigned int cmd, unsigned long arg)
591 overlay_create ol_create;
592 overlay_viewport_set ol_viewport_set;
593 void __user *argp = (void __user *)arg;
596 case KYRO_IOCTL_OVERLAY_CREATE:
597 if (copy_from_user(&ol_create, argp, sizeof(overlay_create)))
600 if (kyro_dev_overlay_create(ol_create.ulWidth,
601 ol_create.ulHeight, 0) < 0) {
602 printk(KERN_ERR "Kyro FB: failed to create overlay surface.\n");
607 case KYRO_IOCTL_OVERLAY_VIEWPORT_SET:
608 if (copy_from_user(&ol_viewport_set, argp,
609 sizeof(overlay_viewport_set)))
612 if (kyro_dev_overlay_viewport_set(ol_viewport_set.xOrgin,
613 ol_viewport_set.yOrgin,
614 ol_viewport_set.xSize,
615 ol_viewport_set.ySize) != 0)
617 printk(KERN_ERR "Kyro FB: failed to create overlay viewport.\n");
621 case KYRO_IOCTL_SET_VIDEO_MODE:
623 printk(KERN_ERR "Kyro FB: KYRO_IOCTL_SET_VIDEO_MODE is"
624 "obsolete, use the appropriate fb_ioctl()"
625 "command instead.\n");
629 case KYRO_IOCTL_UVSTRIDE:
630 if (copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(unsigned long)))
633 case KYRO_IOCTL_STRIDE:
634 if (copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(unsigned long)))
637 case KYRO_IOCTL_OVERLAY_OFFSET:
638 if (copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(unsigned long)))
646 static struct pci_device_id kyrofb_pci_tbl[] = {
647 { PCI_VENDOR_ID_ST, PCI_DEVICE_ID_STG4000,
648 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
652 MODULE_DEVICE_TABLE(pci, kyrofb_pci_tbl);
654 static struct pci_driver kyrofb_pci_driver = {
656 .id_table = kyrofb_pci_tbl,
657 .probe = kyrofb_probe,
658 .remove = __devexit_p(kyrofb_remove),
661 static struct fb_ops kyrofb_ops = {
662 .owner = THIS_MODULE,
663 .fb_check_var = kyrofb_check_var,
664 .fb_set_par = kyrofb_set_par,
665 .fb_setcolreg = kyrofb_setcolreg,
666 .fb_ioctl = kyrofb_ioctl,
667 .fb_fillrect = cfb_fillrect,
668 .fb_copyarea = cfb_copyarea,
669 .fb_imageblit = cfb_imageblit,
672 static int __devinit kyrofb_probe(struct pci_dev *pdev,
673 const struct pci_device_id *ent)
675 struct fb_info *info;
676 struct kyrofb_info *currentpar;
680 if ((err = pci_enable_device(pdev))) {
681 printk(KERN_WARNING "kyrofb: Can't enable pdev: %d\n", err);
685 info = framebuffer_alloc(sizeof(struct kyrofb_info), &pdev->dev);
689 currentpar = info->par;
691 kyro_fix.smem_start = pci_resource_start(pdev, 0);
692 kyro_fix.smem_len = pci_resource_len(pdev, 0);
693 kyro_fix.mmio_start = pci_resource_start(pdev, 1);
694 kyro_fix.mmio_len = pci_resource_len(pdev, 1);
696 currentpar->regbase = deviceInfo.pSTGReg =
697 ioremap_nocache(kyro_fix.mmio_start, kyro_fix.mmio_len);
699 info->screen_base = ioremap_nocache(kyro_fix.smem_start,
704 currentpar->mtrr_handle =
705 mtrr_add(kyro_fix.smem_start,
707 MTRR_TYPE_WRCOMB, 1);
710 kyro_fix.ypanstep = nopan ? 0 : 1;
711 kyro_fix.ywrapstep = nowrap ? 0 : 1;
713 info->fbops = &kyrofb_ops;
714 info->fix = kyro_fix;
715 info->pseudo_palette = currentpar->palette;
716 info->flags = FBINFO_DEFAULT;
718 SetCoreClockPLL(deviceInfo.pSTGReg, pdev);
720 deviceInfo.ulNextFreeVidMem = 0;
721 deviceInfo.ulOverlayOffset = 0;
723 /* This should give a reasonable default video mode */
724 if (!fb_find_mode(&info->var, info, mode_option, kyro_modedb,
725 NUM_TOTAL_MODES, &kyro_modedb[VMODE_1024_768_75], 32))
726 info->var = kyro_var;
728 fb_alloc_cmap(&info->cmap, 256, 0);
730 kyrofb_set_par(info);
731 kyrofb_check_var(&info->var, info);
733 size = get_line_length(info->var.xres_virtual,
734 info->var.bits_per_pixel);
735 size *= info->var.yres_virtual;
737 fb_memset(info->screen_base, 0, size);
739 if (register_framebuffer(info) < 0)
742 printk("fb%d: %s frame buffer device, at %dx%d@%d using %ldk/%ldk of VRAM\n",
743 info->node, info->fix.id, info->var.xres,
744 info->var.yres, info->var.bits_per_pixel, size >> 10,
745 (unsigned long)info->fix.smem_len >> 10);
747 pci_set_drvdata(pdev, info);
752 iounmap(currentpar->regbase);
753 iounmap(info->screen_base);
754 framebuffer_release(info);
759 static void __devexit kyrofb_remove(struct pci_dev *pdev)
761 struct fb_info *info = pci_get_drvdata(pdev);
762 struct kyrofb_info *par = info->par;
764 /* Reset the board */
765 StopVTG(deviceInfo.pSTGReg);
766 DisableRamdacOutput(deviceInfo.pSTGReg);
768 /* Sync up the PLL */
769 SetCoreClockPLL(deviceInfo.pSTGReg, pdev);
771 deviceInfo.ulNextFreeVidMem = 0;
772 deviceInfo.ulOverlayOffset = 0;
774 iounmap(info->screen_base);
775 iounmap(par->regbase);
778 if (par->mtrr_handle)
779 mtrr_del(par->mtrr_handle,
780 info->fix.smem_start,
784 unregister_framebuffer(info);
785 pci_set_drvdata(pdev, NULL);
786 framebuffer_release(info);
789 static int __init kyrofb_init(void)
794 if (fb_get_options("kyrofb", &option))
796 kyrofb_setup(option);
798 return pci_register_driver(&kyrofb_pci_driver);
801 static void __exit kyrofb_exit(void)
803 pci_unregister_driver(&kyrofb_pci_driver);
806 module_init(kyrofb_init);
809 module_exit(kyrofb_exit);
812 MODULE_AUTHOR("STMicroelectronics; Paul Mundt <lethal@linux-sh.org>");
813 MODULE_LICENSE("GPL");