]> err.no Git - linux-2.6/blobdiff - drivers/video/nvidia/nvidia.c
Merge branches 'release' and 'hp-cid' into release
[linux-2.6] / drivers / video / nvidia / nvidia.c
index 8c3a25360232d73e245b43452342ca43177a3a4a..74517b1b26a6d2bfd8c7c79fa018b86df2b20dc3 100644 (file)
@@ -79,6 +79,7 @@ static int noscale __devinitdata = 0;
 static int paneltweak __devinitdata = 0;
 static int vram __devinitdata = 0;
 static int bpp __devinitdata = 8;
+static int reverse_i2c __devinitdata;
 #ifdef CONFIG_MTRR
 static int nomtrr __devinitdata = 0;
 #endif
@@ -848,9 +849,27 @@ static int nvidiafb_check_var(struct fb_var_screeninfo *var,
        if (!mode_valid && info->monspecs.modedb_len)
                return -EINVAL;
 
+       /*
+        * If we're on a flat panel, check if the mode is outside of the
+        * panel dimensions. If so, cap it and try for the next best mode
+        * before bailing out.
+        */
        if (par->fpWidth && par->fpHeight && (par->fpWidth < var->xres ||
-                                             par->fpHeight < var->yres))
-               return -EINVAL;
+                                             par->fpHeight < var->yres)) {
+               const struct fb_videomode *mode;
+
+               var->xres = par->fpWidth;
+               var->yres = par->fpHeight;
+
+               mode = fb_find_best_mode(var, &info->modelist);
+               if (!mode) {
+                       printk(KERN_ERR PFX "mode out of range of flat "
+                              "panel dimensions\n");
+                       return -EINVAL;
+               }
+
+               fb_videomode_to_var(var, mode);
+       }
 
        if (var->yres_virtual < var->yres)
                var->yres_virtual = var->yres;
@@ -1195,7 +1214,8 @@ static u32 __devinit nvidia_get_chipset(struct fb_info *info)
 
        printk(KERN_INFO PFX "Device ID: %x \n", id);
 
-       if ((id & 0xfff0) == 0x00f0) {
+       if ((id & 0xfff0) == 0x00f0 ||
+           (id & 0xfff0) == 0x02e0) {
                /* pci-e */
                id = NV_RD32(par->REGS, 0x1800);
 
@@ -1240,18 +1260,16 @@ static u32 __devinit nvidia_get_arch(struct fb_info *info)
        case 0x0040:            /* GeForce 6800 */
        case 0x00C0:            /* GeForce 6800 */
        case 0x0120:            /* GeForce 6800 */
-       case 0x0130:
        case 0x0140:            /* GeForce 6600 */
        case 0x0160:            /* GeForce 6200 */
        case 0x01D0:            /* GeForce 7200, 7300, 7400 */
-       case 0x02E0:            /* GeForce 7300 GT */
        case 0x0090:            /* GeForce 7800 */
        case 0x0210:            /* GeForce 6800 */
        case 0x0220:            /* GeForce 6200 */
-       case 0x0230:
        case 0x0240:            /* GeForce 6100 */
        case 0x0290:            /* GeForce 7900 */
        case 0x0390:            /* GeForce 7600 */
+       case 0x03D0:
                arch = NV_ARCH_40;
                break;
        case 0x0020:            /* TNT, TNT2 */
@@ -1306,6 +1324,7 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
        par->CRTCnumber = forceCRTC;
        par->FpScale = (!noscale);
        par->paneltweak = paneltweak;
+       par->reverse_i2c = reverse_i2c;
 
        /* enable IO and mem if not already done */
        pci_read_config_word(pd, PCI_COMMAND, &cmd);
@@ -1487,6 +1506,8 @@ static int __devinit nvidiafb_setup(char *options)
                        noaccel = 1;
                } else if (!strncmp(this_opt, "noscale", 7)) {
                        noscale = 1;
+               } else if (!strncmp(this_opt, "reverse_i2c", 11)) {
+                       reverse_i2c = 1;
                } else if (!strncmp(this_opt, "paneltweak:", 11)) {
                        paneltweak = simple_strtoul(this_opt+11, NULL, 0);
                } else if (!strncmp(this_opt, "vram:", 5)) {
@@ -1583,6 +1604,8 @@ MODULE_PARM_DESC(mode_option, "Specify initial video mode");
 module_param(bpp, int, 0);
 MODULE_PARM_DESC(bpp, "pixel width in bits"
                 "(default=8)");
+module_param(reverse_i2c, int, 0);
+MODULE_PARM_DESC(reverse_i2c, "reverse port assignment of the i2c bus");
 #ifdef CONFIG_MTRR
 module_param(nomtrr, bool, 0);
 MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) "