Commit a81c67e1 authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

[PATCH] fbdev: Add NV30 pci_id and cleanup of probe error returns

From Guido Guenther <agx@sigxcpu.org>

this patch against 2.6.10-rc2 finally detects rivafb on NV30 based power
books by adding the pciid. Wolfram Quester tested it and reported it
working. It also cleans up the error code reported from the probe
function.

From Antonino Daplas <adaplas@pol.net>
- do not validate mode if monitor specifications are not available
Signed-Off-By: default avatarGuido Guenther <agx@sigxcpu.org>
Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3aac0adf
...@@ -192,6 +192,8 @@ static struct pci_device_id rivafb_pci_tbl[] = { ...@@ -192,6 +192,8 @@ static struct pci_device_id rivafb_pci_tbl[] = {
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO_5200,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0, } /* terminate list */ { 0, } /* terminate list */
}; };
MODULE_DEVICE_TABLE(pci, rivafb_pci_tbl); MODULE_DEVICE_TABLE(pci, rivafb_pci_tbl);
...@@ -1110,7 +1112,8 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -1110,7 +1112,8 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
} }
if (!strictmode) { if (!strictmode) {
if (!fb_validate_mode(var, info)) if (!info->monspecs.vfmax || !info->monspecs.hfmax ||
!info->monspecs.dclkmax || !fb_validate_mode(var, info))
mode_valid = 1; mode_valid = 1;
} }
...@@ -1894,31 +1897,37 @@ static int __devinit rivafb_probe(struct pci_dev *pd, ...@@ -1894,31 +1897,37 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
{ {
struct riva_par *default_par; struct riva_par *default_par;
struct fb_info *info; struct fb_info *info;
int ret;
NVTRACE_ENTER(); NVTRACE_ENTER();
assert(pd != NULL); assert(pd != NULL);
info = framebuffer_alloc(sizeof(struct riva_par), &pd->dev); info = framebuffer_alloc(sizeof(struct riva_par), &pd->dev);
if (!info) {
if (!info) printk (KERN_ERR PFX "could not allocate memory\n");
goto err_out; ret = -ENOMEM;
goto err_ret;
}
default_par = (struct riva_par *) info->par; default_par = (struct riva_par *) info->par;
default_par->pdev = pd; default_par->pdev = pd;
info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL);
if (info->pixmap.addr == NULL) if (info->pixmap.addr == NULL) {
goto err_out_kfree; ret = -ENOMEM;
goto err_framebuffer_release;
}
memset(info->pixmap.addr, 0, 8 * 1024); memset(info->pixmap.addr, 0, 8 * 1024);
if (pci_enable_device(pd)) { ret = pci_enable_device(pd);
if (ret < 0) {
printk(KERN_ERR PFX "cannot enable PCI device\n"); printk(KERN_ERR PFX "cannot enable PCI device\n");
goto err_out_enable; goto err_free_pixmap;
} }
if (pci_request_regions(pd, "rivafb")) { ret = pci_request_regions(pd, "rivafb");
if (ret < 0) {
printk(KERN_ERR PFX "cannot request PCI regions\n"); printk(KERN_ERR PFX "cannot request PCI regions\n");
goto err_out_request; goto err_disable_device;
} }
default_par->riva.Architecture = riva_get_arch(pd); default_par->riva.Architecture = riva_get_arch(pd);
...@@ -1932,7 +1941,8 @@ static int __devinit rivafb_probe(struct pci_dev *pd, ...@@ -1932,7 +1941,8 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
if(default_par->riva.Architecture == 0) { if(default_par->riva.Architecture == 0) {
printk(KERN_ERR PFX "unknown NV_ARCH\n"); printk(KERN_ERR PFX "unknown NV_ARCH\n");
goto err_out_free_base0; ret=-ENODEV;
goto err_release_region;
} }
if(default_par->riva.Architecture == NV_ARCH_10 || if(default_par->riva.Architecture == NV_ARCH_10 ||
default_par->riva.Architecture == NV_ARCH_20 || default_par->riva.Architecture == NV_ARCH_20 ||
...@@ -1966,11 +1976,10 @@ static int __devinit rivafb_probe(struct pci_dev *pd, ...@@ -1966,11 +1976,10 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
rivafb_fix.mmio_len); rivafb_fix.mmio_len);
if (!default_par->ctrl_base) { if (!default_par->ctrl_base) {
printk(KERN_ERR PFX "cannot ioremap MMIO base\n"); printk(KERN_ERR PFX "cannot ioremap MMIO base\n");
goto err_out_free_base0; ret = -EIO;
goto err_release_region;
} }
info->par = default_par;
switch (default_par->riva.Architecture) { switch (default_par->riva.Architecture) {
case NV_ARCH_03: case NV_ARCH_03:
/* Riva128's PRAMIN is in the "framebuffer" space /* Riva128's PRAMIN is in the "framebuffer" space
...@@ -1980,7 +1989,8 @@ static int __devinit rivafb_probe(struct pci_dev *pd, ...@@ -1980,7 +1989,8 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
default_par->riva.PRAMIN = ioremap(rivafb_fix.smem_start + 0x00C00000, 0x00008000); default_par->riva.PRAMIN = ioremap(rivafb_fix.smem_start + 0x00C00000, 0x00008000);
if (!default_par->riva.PRAMIN) { if (!default_par->riva.PRAMIN) {
printk(KERN_ERR PFX "cannot ioremap PRAMIN region\n"); printk(KERN_ERR PFX "cannot ioremap PRAMIN region\n");
goto err_out_free_nv3_pramin; ret = -EIO;
goto err_iounmap_ctrl_base;
} }
break; break;
case NV_ARCH_04: case NV_ARCH_04:
...@@ -2006,7 +2016,8 @@ static int __devinit rivafb_probe(struct pci_dev *pd, ...@@ -2006,7 +2016,8 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
rivafb_fix.smem_len); rivafb_fix.smem_len);
if (!info->screen_base) { if (!info->screen_base) {
printk(KERN_ERR PFX "cannot ioremap FB base\n"); printk(KERN_ERR PFX "cannot ioremap FB base\n");
goto err_out_free_base1; ret = -EIO;
goto err_iounmap_pramin;
} }
#ifdef CONFIG_MTRR #ifdef CONFIG_MTRR
...@@ -2029,17 +2040,19 @@ static int __devinit rivafb_probe(struct pci_dev *pd, ...@@ -2029,17 +2040,19 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
riva_get_EDID(info, pd); riva_get_EDID(info, pd);
riva_get_edidinfo(info); riva_get_edidinfo(info);
if (riva_set_fbinfo(info) < 0) { ret=riva_set_fbinfo(info);
if (ret < 0) {
printk(KERN_ERR PFX "error setting initial video mode\n"); printk(KERN_ERR PFX "error setting initial video mode\n");
goto err_out_iounmap_fb; goto err_iounmap_screen_base;
} }
fb_destroy_modedb(info->monspecs.modedb); fb_destroy_modedb(info->monspecs.modedb);
info->monspecs.modedb = NULL; info->monspecs.modedb = NULL;
if (register_framebuffer(info) < 0) { ret = register_framebuffer(info);
if (ret < 0) {
printk(KERN_ERR PFX printk(KERN_ERR PFX
"error registering riva framebuffer\n"); "error registering riva framebuffer\n");
goto err_out_iounmap_fb; goto err_iounmap_screen_base;
} }
pci_set_drvdata(pd, info); pci_set_drvdata(pd, info);
...@@ -2058,26 +2071,26 @@ static int __devinit rivafb_probe(struct pci_dev *pd, ...@@ -2058,26 +2071,26 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
NVTRACE_LEAVE(); NVTRACE_LEAVE();
return 0; return 0;
err_out_iounmap_fb: err_iounmap_screen_base:
#ifdef CONFIG_FB_RIVA_I2C #ifdef CONFIG_FB_RIVA_I2C
riva_delete_i2c_busses((struct riva_par *) info->par); riva_delete_i2c_busses((struct riva_par *) info->par);
#endif #endif
iounmap(info->screen_base); iounmap(info->screen_base);
err_out_free_base1: err_iounmap_pramin:
if (default_par->riva.Architecture == NV_ARCH_03) if (default_par->riva.Architecture == NV_ARCH_03)
iounmap(default_par->riva.PRAMIN); iounmap(default_par->riva.PRAMIN);
err_out_free_nv3_pramin: err_iounmap_ctrl_base:
iounmap(default_par->ctrl_base); iounmap(default_par->ctrl_base);
err_out_free_base0: err_release_region:
pci_release_regions(pd); pci_release_regions(pd);
err_out_request: err_disable_device:
pci_disable_device(pd); pci_disable_device(pd);
err_out_enable: err_free_pixmap:
kfree(info->pixmap.addr); kfree(info->pixmap.addr);
err_out_kfree: err_framebuffer_release:
framebuffer_release(info); framebuffer_release(info);
err_out: err_ret:
return -ENODEV; return ret;
} }
static void __exit rivafb_remove(struct pci_dev *pd) static void __exit rivafb_remove(struct pci_dev *pd)
......
...@@ -1142,6 +1142,7 @@ ...@@ -1142,6 +1142,7 @@
#define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258
#define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259
#define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B #define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B
#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO_5200 0x0329
#define PCI_VENDOR_ID_IMS 0x10e0 #define PCI_VENDOR_ID_IMS 0x10e0
#define PCI_DEVICE_ID_IMS_8849 0x8849 #define PCI_DEVICE_ID_IMS_8849 0x8849
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment