aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-08-01 05:18:29 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-02-11 05:16:06 -0500
commit24d6e5cb191189531396870402bf276aacf01598 (patch)
treefc10e45c665963b080b3e770e52bbef412600d95
parentb7ca01a9b20e3fdd11745227905e9ad8a99e0123 (diff)
VIDEO: cyberpro: update handling of device structures
Provide the framebuffer device with its correct parent (the PCI device for PCI connected cards.) Also, use this struct device to pass to sub-drivers rather than the pci_dev structure, which is really what they want. Also propagate the assigned IRQ, which they were getting direct from the PCI device structure. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/video/cyber2000fb.c18
-rw-r--r--drivers/video/cyber2000fb.h3
2 files changed, 11 insertions, 10 deletions
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
index 27cb3b23c3da..e802cc36dbc6 100644
--- a/drivers/video/cyber2000fb.c
+++ b/drivers/video/cyber2000fb.c
@@ -63,10 +63,10 @@ struct cfb_info {
63 struct fb_info fb; 63 struct fb_info fb;
64 struct display_switch *dispsw; 64 struct display_switch *dispsw;
65 struct display *display; 65 struct display *display;
66 struct pci_dev *dev;
67 unsigned char __iomem *region; 66 unsigned char __iomem *region;
68 unsigned char __iomem *regs; 67 unsigned char __iomem *regs;
69 u_int id; 68 u_int id;
69 u_int irq;
70 int func_use_count; 70 int func_use_count;
71 u_long ref_ps; 71 u_long ref_ps;
72 72
@@ -1134,13 +1134,14 @@ EXPORT_SYMBOL(cyber2000fb_get_fb_var);
1134int cyber2000fb_attach(struct cyberpro_info *info, int idx) 1134int cyber2000fb_attach(struct cyberpro_info *info, int idx)
1135{ 1135{
1136 if (int_cfb_info != NULL) { 1136 if (int_cfb_info != NULL) {
1137 info->dev = int_cfb_info->dev; 1137 info->dev = int_cfb_info->fb.device;
1138#ifdef CONFIG_FB_CYBER2000_I2C 1138#ifdef CONFIG_FB_CYBER2000_I2C
1139 info->i2c = &int_cfb_info->i2c_adapter; 1139 info->i2c = &int_cfb_info->i2c_adapter;
1140#else 1140#else
1141 info->i2c = NULL; 1141 info->i2c = NULL;
1142#endif 1142#endif
1143 info->regs = int_cfb_info->regs; 1143 info->regs = int_cfb_info->regs;
1144 info->irq = int_cfb_info->irq;
1144 info->fb = int_cfb_info->fb.screen_base; 1145 info->fb = int_cfb_info->fb.screen_base;
1145 info->fb_size = int_cfb_info->fb.fix.smem_len; 1146 info->fb_size = int_cfb_info->fb.fix.smem_len;
1146 info->enable_extregs = cyber2000fb_enable_extregs; 1147 info->enable_extregs = cyber2000fb_enable_extregs;
@@ -1245,7 +1246,7 @@ static int __devinit cyber2000fb_setup_ddc_bus(struct cfb_info *cfb)
1245 cfb->ddc_adapter.owner = THIS_MODULE; 1246 cfb->ddc_adapter.owner = THIS_MODULE;
1246 cfb->ddc_adapter.class = I2C_CLASS_DDC; 1247 cfb->ddc_adapter.class = I2C_CLASS_DDC;
1247 cfb->ddc_adapter.algo_data = &cfb->ddc_algo; 1248 cfb->ddc_adapter.algo_data = &cfb->ddc_algo;
1248 cfb->ddc_adapter.dev.parent = &cfb->dev->dev; 1249 cfb->ddc_adapter.dev.parent = cfb->fb.device;
1249 cfb->ddc_algo.setsda = cyber2000fb_ddc_setsda; 1250 cfb->ddc_algo.setsda = cyber2000fb_ddc_setsda;
1250 cfb->ddc_algo.setscl = cyber2000fb_ddc_setscl; 1251 cfb->ddc_algo.setscl = cyber2000fb_ddc_setscl;
1251 cfb->ddc_algo.getsda = cyber2000fb_ddc_getsda; 1252 cfb->ddc_algo.getsda = cyber2000fb_ddc_getsda;
@@ -1319,7 +1320,7 @@ static int __devinit cyber2000fb_i2c_register(struct cfb_info *cfb)
1319 sizeof(cfb->i2c_adapter.name)); 1320 sizeof(cfb->i2c_adapter.name));
1320 cfb->i2c_adapter.owner = THIS_MODULE; 1321 cfb->i2c_adapter.owner = THIS_MODULE;
1321 cfb->i2c_adapter.algo_data = &cfb->i2c_algo; 1322 cfb->i2c_adapter.algo_data = &cfb->i2c_algo;
1322 cfb->i2c_adapter.dev.parent = &cfb->dev->dev; 1323 cfb->i2c_adapter.dev.parent = cfb->fb.device;
1323 cfb->i2c_algo.setsda = cyber2000fb_i2c_setsda; 1324 cfb->i2c_algo.setsda = cyber2000fb_i2c_setsda;
1324 cfb->i2c_algo.setscl = cyber2000fb_i2c_setscl; 1325 cfb->i2c_algo.setscl = cyber2000fb_i2c_setscl;
1325 cfb->i2c_algo.getsda = cyber2000fb_i2c_getsda; 1326 cfb->i2c_algo.getsda = cyber2000fb_i2c_getsda;
@@ -1607,9 +1608,6 @@ static int __devinit cyberpro_common_probe(struct cfb_info *cfb)
1607 cfb->fb.var.xres, cfb->fb.var.yres, 1608 cfb->fb.var.xres, cfb->fb.var.yres,
1608 h_sync / 1000, h_sync % 1000, v_sync); 1609 h_sync / 1000, h_sync % 1000, v_sync);
1609 1610
1610 if (cfb->dev)
1611 cfb->fb.device = &cfb->dev->dev;
1612
1613 err = cyber2000fb_i2c_register(cfb); 1611 err = cyber2000fb_i2c_register(cfb);
1614 if (err) 1612 if (err)
1615 goto failed; 1613 goto failed;
@@ -1669,12 +1667,13 @@ static int __devinit cyberpro_vl_probe(void)
1669 if (!cfb) 1667 if (!cfb)
1670 goto failed_release; 1668 goto failed_release;
1671 1669
1672 cfb->dev = NULL; 1670 cfb->irq = -1;
1673 cfb->region = ioremap(FB_START, FB_SIZE); 1671 cfb->region = ioremap(FB_START, FB_SIZE);
1674 if (!cfb->region) 1672 if (!cfb->region)
1675 goto failed_ioremap; 1673 goto failed_ioremap;
1676 1674
1677 cfb->regs = cfb->region + MMIO_OFFSET; 1675 cfb->regs = cfb->region + MMIO_OFFSET;
1676 cfb->fb.device = NULL;
1678 cfb->fb.fix.mmio_start = FB_START + MMIO_OFFSET; 1677 cfb->fb.fix.mmio_start = FB_START + MMIO_OFFSET;
1679 cfb->fb.fix.smem_start = FB_START; 1678 cfb->fb.fix.smem_start = FB_START;
1680 1679
@@ -1812,12 +1811,13 @@ cyberpro_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1812 if (err) 1811 if (err)
1813 goto failed_regions; 1812 goto failed_regions;
1814 1813
1815 cfb->dev = dev; 1814 cfb->irq = dev->irq;
1816 cfb->region = pci_ioremap_bar(dev, 0); 1815 cfb->region = pci_ioremap_bar(dev, 0);
1817 if (!cfb->region) 1816 if (!cfb->region)
1818 goto failed_ioremap; 1817 goto failed_ioremap;
1819 1818
1820 cfb->regs = cfb->region + MMIO_OFFSET; 1819 cfb->regs = cfb->region + MMIO_OFFSET;
1820 cfb->fb.device = &dev->dev;
1821 cfb->fb.fix.mmio_start = pci_resource_start(dev, 0) + MMIO_OFFSET; 1821 cfb->fb.fix.mmio_start = pci_resource_start(dev, 0) + MMIO_OFFSET;
1822 cfb->fb.fix.smem_start = pci_resource_start(dev, 0); 1822 cfb->fb.fix.smem_start = pci_resource_start(dev, 0);
1823 1823
diff --git a/drivers/video/cyber2000fb.h b/drivers/video/cyber2000fb.h
index 814cce5acf12..555c8d4f2b76 100644
--- a/drivers/video/cyber2000fb.h
+++ b/drivers/video/cyber2000fb.h
@@ -464,13 +464,14 @@ static void debug_printf(char *fmt, ...)
464struct cfb_info; 464struct cfb_info;
465 465
466struct cyberpro_info { 466struct cyberpro_info {
467 struct pci_dev *dev; 467 struct device *dev;
468 struct i2c_adapter *i2c; 468 struct i2c_adapter *i2c;
469 unsigned char __iomem *regs; 469 unsigned char __iomem *regs;
470 char __iomem *fb; 470 char __iomem *fb;
471 char dev_name[32]; 471 char dev_name[32];
472 unsigned int fb_size; 472 unsigned int fb_size;
473 unsigned int chip_id; 473 unsigned int chip_id;
474 unsigned int irq;
474 475
475 /* 476 /*
476 * The following is a pointer to be passed into the 477 * The following is a pointer to be passed into the