patch-2.4.0-test11 linux/drivers/media/radio/radio-cadet.c
Next file: linux/drivers/media/radio/radio-gemtek.c
Previous file: linux/drivers/media/radio/radio-aztech.c
Back to the patch index
Back to the overall index
- Lines: 128
- Date:
Fri Nov 17 17:56:51 2000
- Orig file:
v2.4.0-test10/linux/drivers/media/radio/radio-cadet.c
- Orig date:
Wed May 3 01:45:19 2000
diff -u --recursive --new-file v2.4.0-test10/linux/drivers/media/radio/radio-cadet.c linux/drivers/media/radio/radio-cadet.c
@@ -12,6 +12,10 @@
* Scott McGrath (smcgrath@twilight.vtc.vsc.edu)
* William McGrath (wmcgrath@twilight.vtc.vsc.edu)
*
+ * History:
+ * 2000-04-29 Russell Kroll <rkroll@exploits.org>
+ * Added ISAPnP detection for Linux 2.3/2.4
+ *
*/
#include <linux/module.h> /* Modules */
@@ -40,6 +44,17 @@
static unsigned char rdsbuf[RDS_BUFFER];
static int cadet_lock=0;
+#ifndef MODULE
+static int cadet_probe(void);
+#endif
+
+#ifdef CONFIG_ISAPNP
+#include <linux/isapnp.h>
+
+struct pci_dev *dev;
+static int isapnp_cadet_probe(void);
+#endif
+
/*
* Signal Strength Threshold Values
* The V4L API spec does not define any particular unit for the signal
@@ -47,8 +62,6 @@
*/
static __u16 sigtable[2][4]={{5,10,30,150},{28,40,63,1000}};
-
-
void cadet_wake(unsigned long qnum)
{
switch(qnum) {
@@ -529,20 +542,41 @@
static struct video_device cadet_radio=
{
- "Cadet radio",
- VID_TYPE_TUNER,
- VID_HARDWARE_CADET,
- cadet_open,
- cadet_close,
- cadet_read,
- NULL, /* Can't write */
- NULL, /* No poll */
- cadet_ioctl,
- NULL,
- NULL
+ name: "Cadet radio",
+ type: VID_TYPE_TUNER,
+ hardware: VID_HARDWARE_CADET,
+ open: cadet_open,
+ close: cadet_close,
+ read: cadet_read,
+ ioctl: cadet_ioctl,
};
-#ifndef MODULE
+#ifdef CONFIG_ISAPNP
+static int isapnp_cadet_probe(void)
+{
+ dev = isapnp_find_dev (NULL, ISAPNP_VENDOR('M','S','M'),
+ ISAPNP_FUNCTION(0x0c24), NULL);
+
+ if (!dev)
+ return -ENODEV;
+ if (dev->prepare(dev)<0)
+ return -EAGAIN;
+ if (!(dev->resource[0].flags & IORESOURCE_IO))
+ return -ENODEV;
+ if (dev->activate(dev)<0) {
+ printk ("radio-cadet: isapnp configure failed (out of resources?)\n");
+ return -ENOMEM;
+ }
+
+ io = dev->resource[0].start;
+
+ printk ("radio-cadet: ISAPnP reports card at %#x\n", io);
+
+ return io;
+}
+#endif /* CONFIG_ISAPNP */
+
+#ifdef MODULE
static int cadet_probe(void)
{
static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e};
@@ -559,13 +593,20 @@
}
return -1;
}
-#endif
+#endif /* MODULE */
static int __init cadet_init(void)
{
-#ifndef MODULE
+#ifdef CONFIG_ISAPNP
+ io = isapnp_cadet_probe();
+
+ if (io < 0)
+ return (io);
+#else
+#ifndef MODULE /* only probe on non-ISAPnP monolithic compiles */
io = cadet_probe ();
-#endif
+#endif /* MODULE */
+#endif /* CONFIG_ISAPNP */
if(io < 0) {
#ifdef MODULE
@@ -596,6 +637,11 @@
{
video_unregister_device(&cadet_radio);
release_region(io,2);
+
+#ifdef CONFIG_ISAPNP
+ if (dev)
+ dev->deactivate(dev);
+#endif
}
module_init(cadet_init);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)