patch-2.4.0-test2 linux/drivers/video/clgenfb.c
Next file: linux/drivers/video/controlfb.c
Previous file: linux/drivers/video/chipsfb.c
Back to the patch index
Back to the overall index
- Lines: 233
- Date:
Tue Jun 20 14:14:51 2000
- Orig file:
v2.4.0-test1/linux/drivers/video/clgenfb.c
- Orig date:
Thu May 11 15:30:08 2000
diff -u --recursive --new-file v2.4.0-test1/linux/drivers/video/clgenfb.c linux/drivers/video/clgenfb.c
@@ -31,10 +31,9 @@
*
*/
-#define CLGEN_VERSION "1.9.6"
+#define CLGEN_VERSION "1.9.8"
#include <linux/config.h>
-#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -481,18 +480,17 @@
#endif
/* function table of the above functions */
-static struct fb_ops clgenfb_ops =
-{
- clgenfb_open,
- clgenfb_release,
- fbgen_get_fix, /* using the generic functions */
- fbgen_get_var, /* makes things much easier... */
- fbgen_set_var,
- fbgen_get_cmap,
- fbgen_set_cmap,
- fbgen_pan_display,
- clgenfb_ioctl,
- NULL
+static struct fb_ops clgenfb_ops = {
+ owner: THIS_MODULE,
+ fb_open: clgenfb_open,
+ fb_release: clgenfb_release,
+ fb_get_fix: fbgen_get_fix,
+ fb_get_var: fbgen_get_var,
+ fb_set_var: fbgen_set_var,
+ fb_get_cmap: fbgen_get_cmap,
+ fb_set_cmap: fbgen_set_cmap,
+ fb_pan_display: fbgen_pan_display,
+ fb_ioctl: clgenfb_ioctl,
};
/*--- Hardware Specific Routines -------------------------------------------*/
@@ -628,12 +626,6 @@
long *nom, long *den,
long *div, long maxfreq);
-#ifdef CONFIG_PCI
-static struct pci_dev *clgen_pci_dev_get (clgen_board_t *btype);
-static unsigned int clgen_get_memsize (caddr_t regbase);
-static int clgen_pci_setup (struct clgenfb_info *fb_info, clgen_board_t *btype);
-#endif /* CONFIG_PCI */
-
#ifdef CLGEN_DEBUG
static void clgen_dump (void);
static void clgen_dbg_reg_dump (caddr_t regbase);
@@ -650,7 +642,6 @@
/*--- Open /dev/fbx ---------------------------------------------------------*/
static int clgenfb_open (struct fb_info *info, int user)
{
- MOD_INC_USE_COUNT;
if (opencount++ == 0)
switch_monitor ((struct clgenfb_info *) info, 1);
return 0;
@@ -661,7 +652,6 @@
{
if (--opencount == 0)
switch_monitor ((struct clgenfb_info *) info, 0);
- MOD_DEC_USE_COUNT;
return 0;
}
@@ -2493,20 +2483,25 @@
static struct pci_dev * __init clgen_pci_dev_get (clgen_board_t *btype)
{
- struct pci_dev *pdev = NULL;
+ struct pci_dev *pdev;
int i;
DPRINTK ("ENTER\n");
- for (i = 0; i < arraysize(clgen_pci_probe_list) && !pdev; i++)
- pdev = pci_find_device (PCI_VENDOR_ID_CIRRUS,
- clgen_pci_probe_list[i].device, NULL);
+ for (i = 0; i < arraysize(clgen_pci_probe_list); i++) {
+ pdev = NULL;
+ while ((pdev = pci_find_device (PCI_VENDOR_ID_CIRRUS,
+ clgen_pci_probe_list[i].device, pdev)) != NULL) {
+ if (pci_enable_device(pdev) == 0) {
+ *btype = clgen_pci_probe_list[i - 1].btype;
+ DPRINTK ("EXIT, returning pdev=%p\n", pdev);
+ return pdev;
+ }
+ }
+ }
- if (pdev)
- *btype = clgen_pci_probe_list[i - 1].btype;
-
- DPRINTK ("EXIT, returning %p\n", pdev);
- return pdev;
+ DPRINTK ("EXIT, returning NULL\n");
+ return NULL;
}
@@ -2526,53 +2521,32 @@
/* This is a best-guess for now */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13)
-
- *display = pdev->base_address[0];
- if ((*display & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) {
- *registers = *display;
- *display = pdev->base_address[1];
- } else {
- *registers = pdev->base_address[1];
- }
-
-#else
-
- if (pdev->resource[0].flags & IORESOURCE_IO) {
- *display = pdev->resource[1].start;
- *registers = pdev->resource[0].start;
+ if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) {
+ *display = pci_resource_start(pdev, 1);
+ *registers = pci_resource_start(pdev, 0);
} else {
- *display = pdev->resource[0].start;
- *registers = pdev->resource[1].start;
+ *display = pci_resource_start(pdev, 0);
+ *registers = pci_resource_start(pdev, 1);
}
-#endif /* kernel older than 2.3.13 */
-
assert (*display != 0);
DPRINTK ("EXIT\n");
}
-
-
-/* clgen_pci_unmap only used in modules */
-#ifdef MODULE
-static void clgen_pci_unmap (struct clgenfb_info *info)
+static void __exit clgen_pci_unmap (struct clgenfb_info *info)
{
iounmap (info->fbmem);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,13)
release_mem_region(info->fbmem_phys, info->size);
#if 0 /* if system didn't claim this region, we would... */
release_mem_region(0xA0000, 65535);
#endif
+
if (release_io_ports)
release_region(0x3C0, 32);
-#endif
}
-#endif /* MODULE */
static int __init clgen_pci_setup (struct clgenfb_info *info,
@@ -2604,12 +2578,6 @@
pcibios_write_config_dword (0, pdev->devfn, PCI_BASE_ADDRESS_0, 0x00000000);
#endif
- pci_read_config_word (pdev, PCI_COMMAND, &tmp16);
- if (!(tmp16 & (PCI_COMMAND_MEMORY | PCI_COMMAND_IO))) {
- u16 tmp16_o = tmp16 | PCI_COMMAND_MEMORY | PCI_COMMAND_IO;
- pci_write_config_word (pdev, PCI_COMMAND, tmp16_o);
- }
-
#ifdef CONFIG_FB_OF
/* Ok, so its an ugly hack, since we could have passed it down from
* clgen_of_init() if we'd done it right. */
@@ -2649,8 +2617,6 @@
board_size = clgen_get_memsize (info->regs);
}
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,13)
-
if (!request_mem_region(board_addr, board_size, "clgenfb")) {
pci_write_config_word (pdev, PCI_COMMAND, tmp16);
printk(KERN_ERR "clgen: cannot reserve region 0x%lx, abort\n",
@@ -2669,8 +2635,6 @@
if (request_region(0x3C0, 32, "clgenfb"))
release_io_ports = 1;
-#endif /* kernel > 2.3.13 */
-
info->fbmem = ioremap (board_addr, board_size);
info->fbmem_phys = board_addr;
info->size = board_size;
@@ -2721,14 +2685,10 @@
}
-
-/* clgen_zorro_unmap only used in modules */
-#ifdef MODULE
-static void clgen_zorro_unmap (struct clgenfb_info *info)
+static void __exit clgen_zorro_unmap (struct clgenfb_info *info)
{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,13)
release_mem_region(info->board_addr, info->board_size);
-#endif
+
if (info->btype == BT_PICASSO4) {
iounmap (info->board_addr);
iounmap (info->fbmem_phys);
@@ -2737,8 +2697,6 @@
iounmap (info->board_addr);
}
}
-#endif /* MODULE */
-
static int __init clgen_zorro_setup (struct clgenfb_info *info,
@@ -2835,7 +2793,7 @@
}
#else
-#error Unsupported bus. Supported: PCI, Zorro
+#error This driver requires Zorro or PCI bus.
#endif /* !CONFIG_PCI, !CONFIG_ZORRO */
/* sanity checks */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)