fbdev: move FBIO_WAITFORVSYNC to linux/fb.h
[safe/jmp/linux-2.6] / drivers / video / intelfb / intelfbdrv.c
index e8e38ed..5ba3999 100644 (file)
@@ -2,9 +2,9 @@
  * intelfb
  *
  * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM/
- * 945G/945GM integrated graphics chips.
+ * 945G/945GM/945GME/965G/965GM integrated graphics chips.
  *
- * Copyright © 2002, 2003 David Dawes <dawes@xfree86.org>
+ * Copyright Â© 2002, 2003 David Dawes <dawes@xfree86.org>
  *                   2004 Sylvain Meyer
  *                   2006 David Airlie
  *
  *              Add vram option to reserve more memory than stolen by BIOS
  *              Fix intelfbhw_pan_display typo
  *              Add __initdata annotations
+ *
+ *    04/2008 - Version 0.9.5
+ *              Add support for 965G/965GM. (Maik Broemme <mbroemme@plusserver.de>)
+ *
+ *    08/2008 - Version 0.9.6
+ *              Add support for 945GME. (Phil Endecott <spam_from_intelfb@chezphil.org>)
  */
 
 #include <linux/module.h>
@@ -176,10 +182,14 @@ static struct pci_device_id intelfb_pci_table[] __devinitdata = {
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_845G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_845G },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_85XGM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_85XGM },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_865G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_865G },
+       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_854, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_854 },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_915G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_915G },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_915GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_915GM },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_945G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_945G },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_945GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_945GM },
+       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_945GME, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_945GME },
+       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_965G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_965G },
+       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_965GM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_965GM },
        { 0, }
 };
 
@@ -549,7 +559,11 @@ static int __devinit intelfb_pci_register(struct pci_dev *pdev,
        if ((ent->device == PCI_DEVICE_ID_INTEL_915G) ||
            (ent->device == PCI_DEVICE_ID_INTEL_915GM) ||
            (ent->device == PCI_DEVICE_ID_INTEL_945G)  ||
-           (ent->device == PCI_DEVICE_ID_INTEL_945GM)) {
+           (ent->device == PCI_DEVICE_ID_INTEL_945GM) ||
+           (ent->device == PCI_DEVICE_ID_INTEL_945GME) ||
+           (ent->device == PCI_DEVICE_ID_INTEL_965G) ||
+           (ent->device == PCI_DEVICE_ID_INTEL_965GM)) {
+
                aperture_bar = 2;
                mmio_bar = 0;
        }
@@ -860,6 +874,9 @@ static int __devinit intelfb_pci_register(struct pci_dev *pdev,
        if (bailearly == 18)
                bailout(dinfo);
 
+       /* read active pipe */
+       dinfo->pipe = intelfbhw_active_pipe(&dinfo->save_state);
+
        /* Cursor initialisation */
        if (dinfo->hwcursor) {
                intelfbhw_cursor_init(dinfo);
@@ -1351,6 +1368,11 @@ static int intelfb_set_par(struct fb_info *info)
        DBG_MSG("intelfb_set_par (%dx%d-%d)\n", info->var.xres,
                info->var.yres, info->var.bits_per_pixel);
 
+       /*
+        * Disable VCO prior to timing register change.
+        */
+       OUTREG(DPLL_A, INREG(DPLL_A) & ~DPLL_VCO_ENABLE);
+
        intelfb_blank(FB_BLANK_POWERDOWN, info);
 
        if (ACCEL(dinfo, info))
@@ -1480,8 +1502,10 @@ static void intelfb_fillrect (struct fb_info *info,
        DBG_MSG("intelfb_fillrect\n");
 #endif
 
-       if (!ACCEL(dinfo, info) || dinfo->depth == 4)
-               return cfb_fillrect(info, rect);
+       if (!ACCEL(dinfo, info) || dinfo->depth == 4) {
+               cfb_fillrect(info, rect);
+               return;
+       }
 
        if (rect->rop == ROP_COPY)
                rop = PAT_ROP_GXCOPY;
@@ -1508,8 +1532,10 @@ static void intelfb_copyarea(struct fb_info *info,
        DBG_MSG("intelfb_copyarea\n");
 #endif
 
-       if (!ACCEL(dinfo, info) || dinfo->depth == 4)
-               return cfb_copyarea(info, region);
+       if (!ACCEL(dinfo, info) || dinfo->depth == 4) {
+               cfb_copyarea(info, region);
+               return;
+       }
 
        intelfbhw_do_bitblt(dinfo, region->sx, region->sy, region->dx,
                            region->dy, region->width, region->height,
@@ -1527,8 +1553,10 @@ static void intelfb_imageblit(struct fb_info *info,
 #endif
 
        if (!ACCEL(dinfo, info) || dinfo->depth == 4
-           || image->depth != 1)
-               return cfb_imageblit(info, image);
+           || image->depth != 1) {
+               cfb_imageblit(info, image);
+               return;
+       }
 
        if (dinfo->depth != 8) {
                fgcolor = dinfo->pseudo_palette[image->fg_color];
@@ -1541,8 +1569,10 @@ static void intelfb_imageblit(struct fb_info *info,
        if (!intelfbhw_do_drawglyph(dinfo, fgcolor, bgcolor, image->width,
                                    image->height, image->data,
                                    image->dx, image->dy,
-                                   dinfo->pitch, info->var.bits_per_pixel))
-               return cfb_imageblit(info, image);
+                                   dinfo->pitch, info->var.bits_per_pixel)) {
+               cfb_imageblit(info, image);
+               return;
+       }
 }
 
 static int intelfb_cursor(struct fb_info *info, struct fb_cursor *cursor)