Merge branch 'master' into for_paulus
[linux-drm-fsl-dcu.git] / drivers / video / nvidia / nvidia.c
index f8cd4c519aebf1125ba9e6a347be3cdc67f80418..8e5b484db6498253fceaea43d818a13cbaa6970f 100644 (file)
@@ -28,6 +28,9 @@
 #include <asm/prom.h>
 #include <asm/pci-bridge.h>
 #endif
+#ifdef CONFIG_BOOTX_TEXT
+#include <asm/btext.h>
+#endif
 
 #include "nv_local.h"
 #include "nv_type.h"
@@ -681,6 +684,13 @@ static int nvidiafb_set_par(struct fb_info *info)
 
        nvidia_vga_protect(par, 0);
 
+#ifdef CONFIG_BOOTX_TEXT
+       /* Update debug text engine */
+       btext_update_display(info->fix.smem_start,
+                            info->var.xres, info->var.yres,
+                            info->var.bits_per_pixel, info->fix.line_length);
+#endif
+
        NVTRACE_LEAVE();
        return 0;
 }
@@ -819,7 +829,7 @@ static int nvidiafb_check_var(struct fb_var_screeninfo *var,
        }
 
        if (!mode_valid) {
-               struct fb_videomode *mode;
+               const struct fb_videomode *mode;
 
                mode = fb_find_best_mode(var, &info->modelist);
                if (mode) {
@@ -984,7 +994,10 @@ static int nvidiafb_resume(struct pci_dev *dev)
 
        if (par->pm_state != PM_EVENT_FREEZE) {
                pci_restore_state(dev);
-               pci_enable_device(dev);
+
+               if (pci_enable_device(dev))
+                       goto fail;
+
                pci_set_master(dev);
        }
 
@@ -993,6 +1006,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
        fb_set_suspend (info, 0);
        nvidiafb_blank(FB_BLANK_UNBLANK, info);
 
+fail:
        release_console_sem();
        return 0;
 }
@@ -1032,10 +1046,10 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info)
        }
 
        if (specs->modedb != NULL) {
-               struct fb_videomode *modedb;
+               const struct fb_videomode *mode;
 
-               modedb = fb_find_best_display(specs, &info->modelist);
-               fb_videomode_to_var(&nvidiafb_default_var, modedb);
+               mode = fb_find_best_display(specs, &info->modelist);
+               fb_videomode_to_var(&nvidiafb_default_var, mode);
                nvidiafb_default_var.bits_per_pixel = bpp;
        } else if (par->fpWidth && par->fpHeight) {
                char buf[16];
@@ -1146,20 +1160,20 @@ static u32 __devinit nvidia_get_arch(struct fb_info *info)
        case 0x0340:            /* GeForceFX 5700 */
                arch = NV_ARCH_30;
                break;
-       case 0x0040:
-       case 0x00C0:
-       case 0x0120:
+       case 0x0040:            /* GeForce 6800 */
+       case 0x00C0:            /* GeForce 6800 */
+       case 0x0120:            /* GeForce 6800 */
        case 0x0130:
-       case 0x0140:
-       case 0x0160:
-       case 0x01D0:
-       case 0x0090:
-       case 0x0210:
-       case 0x0220:
+       case 0x0140:            /* GeForce 6600 */
+       case 0x0160:            /* GeForce 6200 */
+       case 0x01D0:            /* GeForce 7200, 7300, 7400 */
+       case 0x0090:            /* GeForce 7800 */
+       case 0x0210:            /* GeForce 6800 */
+       case 0x0220:            /* GeForce 6200 */
        case 0x0230:
-       case 0x0240:
-       case 0x0290:
-       case 0x0390:
+       case 0x0240:            /* GeForce 6100 */
+       case 0x0290:            /* GeForce 7900 */
+       case 0x0390:            /* GeForce 7600 */
                arch = NV_ARCH_40;
                break;
        case 0x0020:            /* TNT, TNT2 */
@@ -1191,13 +1205,11 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
        par = info->par;
        par->pci_dev = pd;
 
-       info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL);
+       info->pixmap.addr = kzalloc(8 * 1024, GFP_KERNEL);
 
        if (info->pixmap.addr == NULL)
                goto err_out_kfree;
 
-       memset(info->pixmap.addr, 0, 8 * 1024);
-
        if (pci_enable_device(pd)) {
                printk(KERN_ERR PFX "cannot enable PCI device\n");
                goto err_out_enable;
@@ -1333,7 +1345,7 @@ err_out:
        return -ENODEV;
 }
 
-static void __exit nvidiafb_remove(struct pci_dev *pd)
+static void __devexit nvidiafb_remove(struct pci_dev *pd)
 {
        struct fb_info *info = pci_get_drvdata(pd);
        struct nvidia_par *par = info->par;
@@ -1419,7 +1431,7 @@ static struct pci_driver nvidiafb_driver = {
        .probe    = nvidiafb_probe,
        .suspend  = nvidiafb_suspend,
        .resume   = nvidiafb_resume,
-       .remove   = __exit_p(nvidiafb_remove),
+       .remove   = __devexit_p(nvidiafb_remove),
 };
 
 /* ------------------------------------------------------------------------- *