X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fvideo%2Fnvidia%2Fnvidia.c;h=74517b1b26a6d2bfd8c7c79fa018b86df2b20dc3;hb=d870ec7281d8429ab17d2e0324f4d8ca3f3de62d;hp=a7fe214f0f77d816308390dd3828ec4fe9af8583;hpb=0d090b6819e3559dabb05773c4a6dacc4fa94d0e;p=linux-2.6 diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index a7fe214f0f..74517b1b26 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c @@ -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; @@ -1305,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); @@ -1486,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)) { @@ -1582,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) "