Attached are a patch for adding isapnp configuration to the gus.o
driver. It seems to work, configures fine and all, but interrupts are
never ack'ed by the kernel (/proc/interrupt count does not move). All my
debugging output indicates everything goes well.
I hear some stuttery sound, however :)
Could someone take a hard look at this and try pointing out to me where I
went wrong? I've stared myself blind a few times already.
--
Erik I. Bols� | email: <knan at mo.himolde.no>
| irc: Knan / #linux.no @ Undernet
diff -u --recursive --new-file linux/drivers/sound/Config.in
linux-gus/drivers/sound/Config.in
--- linux/drivers/sound/Config.in Tue Aug 22 18:31:05 2000
+++ linux-gus/drivers/sound/Config.in Sat Sep 9 18:25:04 2000
@@ -96,7 +96,7 @@
dep_tristate ' Gravis Ultrasound support' CONFIG_SOUND_GUS $CONFIG_SOUND_OSS
if [ "$CONFIG_SOUND_GUS" != "n" ]; then
bool ' 16 bit sampling option of GUS (_NOT_ GUS MAX)' CONFIG_SOUND_GUS16
- bool ' GUS MAX support' CONFIG_SOUND_GUSMAX
+ bool ' GUS MAX / PnP / compatibles support' CONFIG_SOUND_GUSMAX
fi
dep_tristate ' Intel ICH audio support' CONFIG_SOUND_ICH $CONFIG_SOUND_OSS
dep_tristate ' Loopback MIDI device support' CONFIG_SOUND_VMIDI
$CONFIG_SOUND_OSS
diff -u --recursive --new-file linux/drivers/sound/gus_card.c
linux-gus/drivers/sound/gus_card.c
--- linux/drivers/sound/gus_card.c Fri Aug 11 15:26:43 2000
+++ linux-gus/drivers/sound/gus_card.c Sat Sep 9 18:05:02 2000
@@ -6,18 +6,21 @@
* Copyright (C) by Hannu Savolainen 1993-1997
*
*
- * Frank van de Pol : Fixed GUS MAX interrupt handling, enabled simultanious
+ * Frank van de Pol : Fixed GUS MAX interrupt handling, enabled simultaneous
* usage of CS4231A codec, GUS wave and MIDI for GUS MAX.
* Christoph Hellwig: Adapted to module_init/module_exit, simple cleanups.
+ * Erik Inge Bols� : Added ISAPnP detection for Gravis Ultrasound PnP and
+compatibles.
+ * (september 2000)
*
* Status:
- * Tested...
+ * Tested. Multiple cards not supported.
*/
#include <linux/config.h>
#include <linux/init.h>
#include <linux/module.h>
+#include <linux/isapnp.h>
#include "sound_config.h"
@@ -98,7 +101,7 @@
}
#endif
- printk("NO GUS card found !\n");
+ printk(KERN_ERR "GUS: NO GUS card found !\n");
return 0;
}
@@ -163,6 +166,78 @@
}
}
+#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE
+static struct {
+ char *name;
+ unsigned short card_vendor, card_device,
+ audio_vendor, audio_function;
+} gus_isapnp_list[] __devinitdata = {
+ { "Gravis Ultrasound PnP",
+ ISAPNP_VENDOR('G','R','V'), ISAPNP_DEVICE(0x0001),
+ ISAPNP_VENDOR('G','R','V'), ISAPNP_DEVICE(0x0000)
+ },
+ { "STB SoundRage 32",
+ ISAPNP_VENDOR('S','T','B'), ISAPNP_DEVICE(0x011a),
+ ISAPNP_VENDOR('S','T','B'), ISAPNP_DEVICE(0x0010)
+ },
+ { "ExpertMedia MED-3210",
+ ISAPNP_VENDOR('D','X','P'), ISAPNP_DEVICE(0x3201),
+ ISAPNP_VENDOR('D','X','P'), ISAPNP_DEVICE(0x0010)
+ },
+ { "Core Dynamics Dynasonix Pro",
+ ISAPNP_VENDOR('C','D','C'), ISAPNP_DEVICE(0x1111),
+ ISAPNP_VENDOR('C','D','C'), ISAPNP_DEVICE(0x1112)
+ },
+ { "Panasonic PCA761AW",
+ ISAPNP_VENDOR('A','D','V'), ISAPNP_DEVICE(0x55ff),
+ ISAPNP_VENDOR('A','D','V'), ISAPNP_DEVICE(0x0010)
+ },
+ {0}
+ };
+
+static int __init probe_gus_isapnp(struct address_info *hw_config)
+{
+ static struct pci_bus *bus = NULL;
+ static int i = 0;
+
+ while (gus_isapnp_list[i].card_vendor != 0) {
+ if ((bus = isapnp_find_card(gus_isapnp_list[i].card_vendor,
+gus_isapnp_list[i].card_device, bus))) {
+ static struct pci_dev *dev = NULL;
+
+ printk(KERN_INFO "gus: %s sound card detected\n",
+gus_isapnp_list[i].name );
+
+ if ((dev = isapnp_find_dev(bus, gus_isapnp_list[i].audio_vendor,
+gus_isapnp_list[i].audio_function, NULL))) {
+ if (dev->active) {
+ printk (KERN_INFO "gus: card already active, trying to use it
+anyway\n");
+ }
+ else {
+ static int ret;
+ if ((ret = dev->prepare(dev)) < 0) {
+ printk (KERN_ERR "gus: ISAPnP found device that could not
+be autoconfigured [%d]\n", ret);
+ continue;
+ }
+
+ if ((ret = dev->activate(dev)) < 0) {
+ printk (KERN_ERR "gus: ISAPnP autoconfig failed (out of
+resources?) [%d]\n", ret);
+ dev->deactivate(dev);
+ continue;
+ }
+ }
+
+ hw_config->io_base = dev->resource[0].start ;
+ hw_config->irq = dev->irq_resource[0].start ;
+ hw_config->dma = dev->dma_resource[0].start ;
+ hw_config->dma2 = dev->dma_resource[1].start ;
+ printk (KERN_NOTICE "gus: debug: io_base = %x, irq = %d, dma = %d,
+dma2 = %d\n", hw_config->io_base, hw_config->irq, hw_config->dma, hw_config->dma2);
+ return 1;
+ }
+ }
+ i++;
+ }
+ return 0;
+}
+#endif
+
/*
* Some extra code for the 16 bit sampling option
*/
@@ -217,6 +292,9 @@
static int __initdata dma = -1;
static int __initdata dma16 = -1; /* Set this for modules that need it */
static int __initdata type = 0; /* 1 for PnP */
+#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE
+static int __initdata isapnp = 1;
+#endif
MODULE_PARM(io, "i");
MODULE_PARM(irq, "i");
@@ -230,6 +308,9 @@
#ifdef CONFIG_SOUND_GUS16
MODULE_PARM(db16, "i");
#endif
+#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE
+MODULE_PARM(isapnp, "i");
+#endif
static int __init init_gus(void)
{
@@ -244,11 +325,21 @@
gus_no_wave_dma = no_wave_dma;
#endif
+#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE
+ if ((cfg.io_base == -1 || cfg.dma == -1 || cfg.irq == -1) && isapnp == 0 ) {
+#else
if (cfg.io_base == -1 || cfg.dma == -1 || cfg.irq == -1) {
+#endif
printk(KERN_ERR "I/O, IRQ, and DMA are mandatory\n");
return -EINVAL;
}
+#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE
+ if ((isapnp == 1) && !probe_gus_isapnp(&cfg)) {
+ return -ENODEV;
+ }
+#endif
+
#ifdef CONFIG_SOUND_GUS16
if (probe_gus_db16(&cfg) && gus16) {
/* FIXME: This can't work, can it ? -- Christoph */
@@ -257,7 +348,10 @@
}
#endif
if (!probe_gus(&cfg))
+ {
+ printk(KERN_ERR "gus: debug: detection failed in probe_gus()\n");
return -ENODEV;
+ }
attach_gus(&cfg);
return 0;
diff -u --recursive --new-file linux/Documentation/Configure.help
linux-gus/Documentation/Configure.help
--- linux/Documentation/Configure.help Sat Sep 9 17:48:46 2000
+++ linux-gus/Documentation/Configure.help Sat Sep 9 18:28:39 2000
@@ -13719,11 +13719,35 @@
Gravis Ultrasound support
CONFIG_SOUND_GUS
Say Y here for any type of Gravis Ultrasound card, including
- the GUS or GUS MAX. See also Documentation/sound/ultrasound for
- more information on configuring this card with modules.
+ the GUS, GUS MAX, GUS PnP, and compatibles.
+
+ This includes the Gravis Ultrasound MAX, Gravis Ultrasound PnP,
+ Gravis Ultrasound PnP Pro, STB SoundRage 32, ExpertMedia MED-3210,
+ Core Dynamics Dynasonix Pro and Panasonic PCA761AW.
+
+ See also Documentation/sound/ultrasound for
+ more information on configuring these cards with modules.
If you compile the driver into the kernel, you have to add
"gus=<io>,<irq>,<dma>,<dma2>" to the kernel command line.
+
+GUS MAX / PnP / compatibles support
+CONFIG_SOUND_GUSMAX
+ Say Y here to enable support for the GUS MAX, GUS PnP, and
+ compatibles, including cards based on the AMD Interwave chip.
+
+ (That is, say no only if you have one of the original Gravis
+ Ultrasound cards)
+
+ This includes the Gravis Ultrasound MAX, Gravis Ultrasound PnP,
+ Gravis Ultrasound PnP Pro, STB SoundRage 32, ExpertMedia MED-3210,
+ Core Dynamics Dynasonix Pro and Panasonic PCA761AW.
+
+ If you want these to be autodetected (apart from the GUS MAX), you
+ also need to say Y or M to Plug And Play configuration ->
+ Plug and Play support -> ISA Plug and Play support.
+
+ If unsure, say Y.
MPU-401 support (NOT for SB16)
CONFIG_SOUND_MPU401