summaryrefslogtreecommitdiffstats
path: root/sound/isa/opti9xx/opti92x-ad1848.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/opti9xx/opti92x-ad1848.c')
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c76
1 files changed, 33 insertions, 43 deletions
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 41c047e665e..19706b0d849 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -33,11 +33,7 @@
#include <asm/io.h>
#include <asm/dma.h>
#include <sound/core.h>
-#if defined(CS4231) || defined(OPTi93X)
-#include <sound/cs4231.h>
-#else
-#include <sound/ad1848.h>
-#endif /* CS4231 */
+#include <sound/wss.h>
#include <sound/mpu401.h>
#include <sound/opl3.h>
#ifndef OPTi93X
@@ -68,7 +64,9 @@ MODULE_SUPPORTED_DEVICE("{{OPTi,82C924 (AD1848)},"
static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
//static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */
+#ifdef CONFIG_PNP
static int isapnp = 1; /* Enable ISA PnP detection */
+#endif
static long port = SNDRV_DEFAULT_PORT1; /* 0x530,0xe80,0xf40,0x604 */
static long mpu_port = SNDRV_DEFAULT_PORT1; /* 0x300,0x310,0x320,0x330 */
static long fm_port = SNDRV_DEFAULT_PORT1; /* 0x388 */
@@ -85,8 +83,10 @@ module_param(id, charp, 0444);
MODULE_PARM_DESC(id, "ID string for opti9xx based soundcard.");
//module_param(enable, bool, 0444);
//MODULE_PARM_DESC(enable, "Enable opti9xx soundcard.");
+#ifdef CONFIG_PNP
module_param(isapnp, bool, 0444);
MODULE_PARM_DESC(isapnp, "Enable ISA PnP detection for specified soundcard.");
+#endif
module_param(port, long, 0444);
MODULE_PARM_DESC(port, "WSS port # for opti9xx driver.");
module_param(mpu_port, long, 0444);
@@ -135,7 +135,7 @@ struct snd_opti9xx {
unsigned long mc_base_size;
#ifdef OPTi93X
unsigned long mc_indir_index;
- struct snd_cs4231 *codec;
+ struct snd_wss *codec;
#endif /* OPTi93X */
unsigned long pwd_reg;
@@ -144,9 +144,7 @@ struct snd_opti9xx {
long wss_base;
int irq;
int dma1;
-#if defined(CS4231) || defined(OPTi93X)
int dma2;
-#endif /* CS4231 || OPTi93X */
long fm_port;
@@ -221,9 +219,7 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
chip->wss_base = -1;
chip->irq = -1;
chip->dma1 = -1;
-#if defined(CS4231) || defined (OPTi93X)
chip->dma2 = -1;
-#endif /* CS4231 || OPTi93X */
chip->fm_port = -1;
chip->mpu_port = -1;
chip->mpu_irq = -1;
@@ -558,7 +554,7 @@ __skip_mpu:
static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id)
{
- struct snd_cs4231 *codec = dev_id;
+ struct snd_wss *codec = dev_id;
struct snd_opti9xx *chip = codec->card->private_data;
unsigned char status;
@@ -566,7 +562,7 @@ static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id)
if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream)
snd_pcm_period_elapsed(codec->playback_substream);
if ((status & OPTi93X_IRQ_CAPTURE) && codec->capture_substream) {
- snd_cs4231_overrange(codec);
+ snd_wss_overrange(codec);
snd_pcm_period_elapsed(codec->capture_substream);
}
outb(0x00, OPTi93X_PORT(codec, STATUS));
@@ -687,8 +683,8 @@ static void snd_card_opti9xx_free(struct snd_card *card)
if (chip) {
#ifdef OPTi93X
- struct snd_cs4231 *codec = chip->codec;
- if (codec->irq > 0) {
+ struct snd_wss *codec = chip->codec;
+ if (codec && codec->irq > 0) {
disable_irq(codec->irq);
free_irq(codec->irq, codec);
}
@@ -702,14 +698,10 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
int error;
struct snd_opti9xx *chip = card->private_data;
-#if defined(CS4231) || defined(OPTi93X)
- struct snd_cs4231 *codec;
+ struct snd_wss *codec;
#ifdef CS4231
struct snd_timer *timer;
#endif
-#else
- struct snd_ad1848 *codec;
-#endif
struct snd_pcm *pcm;
struct snd_rawmidi *rmidi;
struct snd_hwdep *synth;
@@ -727,38 +719,46 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
chip->dma1 = dma1;
#if defined(CS4231) || defined(OPTi93X)
chip->dma2 = dma2;
+#else
+ chip->dma2 = -1;
#endif
if (chip->wss_base == SNDRV_AUTO_PORT) {
- if ((chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4)) < 0) {
+ chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4);
+ if (chip->wss_base < 0) {
snd_printk("unable to find a free WSS port\n");
return -EBUSY;
}
}
- if ((error = snd_opti9xx_configure(chip)))
+ error = snd_opti9xx_configure(chip);
+ if (error)
return error;
-#if defined(CS4231) || defined(OPTi93X)
- if ((error = snd_cs4231_create(card, chip->wss_base + 4, -1,
- chip->irq, chip->dma1, chip->dma2,
-#ifdef CS4231
- CS4231_HW_DETECT, 0,
-#else /* OPTi93x */
- CS4231_HW_OPTI93X, CS4231_HWSHARE_IRQ,
+ error = snd_wss_create(card, chip->wss_base + 4, -1,
+ chip->irq, chip->dma1, chip->dma2,
+#ifdef OPTi93X
+ WSS_HW_OPTI93X, WSS_HWSHARE_IRQ,
+#else
+ WSS_HW_DETECT, 0,
#endif
- &codec)) < 0)
+ &codec);
+ if (error < 0)
return error;
#ifdef OPTi93X
chip->codec = codec;
#endif
- if ((error = snd_cs4231_pcm(codec, 0, &pcm)) < 0)
+ error = snd_wss_pcm(codec, 0, &pcm);
+ if (error < 0)
return error;
- if ((error = snd_cs4231_mixer(codec)) < 0)
+ error = snd_wss_mixer(codec);
+ if (error < 0)
return error;
#ifdef CS4231
- if ((error = snd_cs4231_timer(codec, 0, &timer)) < 0)
+ error = snd_wss_timer(codec, 0, &timer);
+ if (error < 0)
return error;
-#else /* OPTI93X */
+#endif
+#ifdef OPTi93X
error = request_irq(chip->irq, snd_opti93x_interrupt,
IRQF_DISABLED, DEV_NAME" - WSS", codec);
if (error < 0) {
@@ -766,16 +766,6 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
return error;
}
#endif
-#else
- if ((error = snd_ad1848_create(card, chip->wss_base + 4,
- chip->irq, chip->dma1,
- AD1848_HW_DETECT, &codec)) < 0)
- return error;
- if ((error = snd_ad1848_pcm(codec, 0, &pcm)) < 0)
- return error;
- if ((error = snd_ad1848_mixer(codec)) < 0)
- return error;
-#endif
strcpy(card->driver, chip->name);
sprintf(card->shortname, "OPTi %s", card->driver);
#if defined(CS4231) || defined(OPTi93X)