Skip to content

Commit

Permalink
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
Browse files Browse the repository at this point in the history
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai authored and Jaroslav Kysela committed Sep 12, 2005
1 parent 16dab54 commit 43bcd97
Show file tree
Hide file tree
Showing 18 changed files with 587 additions and 648 deletions.
18 changes: 13 additions & 5 deletions sound/isa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ menu "ISA devices"
config SND_AD1848_LIB
tristate
select SND_PCM
select SND_GENERIC_PM
select SND_GENERIC_DRIVER

config SND_CS4231_LIB
tristate
select SND_PCM
select SND_GENERIC_PM
select SND_GENERIC_DRIVER

config SND_AD1816A
tristate "Analog Devices SoundPort AD1816A"
Expand Down Expand Up @@ -97,6 +97,7 @@ config SND_ES1688
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_PCM
select SND_GENERIC_DRIVER
help
Say Y here to include support for ESS AudioDrive ES688 or
ES1688 chips.
Expand All @@ -110,7 +111,7 @@ config SND_ES18XX
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_PCM
select SND_GENERIC_PM
select SND_GENERIC_DRIVER
help
Say Y here to include support for ESS AudioDrive ES18xx chips.

Expand All @@ -126,6 +127,7 @@ config SND_GUSCLASSIC
select SND_RAWMIDI
select SND_PCM
select SND_GUS_SYNTH
select SND_GENERIC_DRIVER
help
Say Y here to include support for Gravis UltraSound Classic
soundcards.
Expand All @@ -140,6 +142,7 @@ config SND_GUSEXTREME
select SND_MPU401_UART
select SND_PCM
select SND_GUS_SYNTH
select SND_GENERIC_DRIVER
help
Say Y here to include support for Gravis UltraSound Extreme
soundcards.
Expand All @@ -153,6 +156,7 @@ config SND_GUSMAX
select SND_RAWMIDI
select SND_CS4231_LIB
select SND_GUS_SYNTH
select SND_GENERIC_DRIVER
help
Say Y here to include support for Gravis UltraSound MAX
soundcards.
Expand All @@ -166,7 +170,7 @@ config SND_INTERWAVE
select SND_RAWMIDI
select SND_CS4231_LIB
select SND_GUS_SYNTH
select ISAPNP
select SND_GENERIC_DRIVER
help
Say Y here to include support for AMD InterWave based
soundcards (Gravis UltraSound Plug & Play, STB SoundRage32,
Expand All @@ -181,7 +185,7 @@ config SND_INTERWAVE_STB
select SND_RAWMIDI
select SND_CS4231_LIB
select SND_GUS_SYNTH
select ISAPNP
select SND_GENERIC_DRIVER
help
Say Y here to include support for AMD InterWave based
soundcards with a TEA6330T bass and treble regulator
Expand Down Expand Up @@ -224,6 +228,7 @@ config SND_OPTI93X
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_PCM
select SND_GENERIC_DRIVER
help
Say Y here to include support for soundcards based on Opti
82C93x chips.
Expand All @@ -237,6 +242,7 @@ config SND_SB8
select SND_OPL3_LIB
select SND_RAWMIDI
select SND_PCM
select SND_GENERIC_DRIVER
help
Say Y here to include support for Creative Sound Blaster 1.0/
2.0/Pro (8-bit) or 100% compatible soundcards.
Expand All @@ -250,6 +256,7 @@ config SND_SB16
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_PCM
select SND_GENERIC_DRIVER
help
Say Y here to include support for Sound Blaster 16 soundcards
(including the Plug and Play version).
Expand All @@ -263,6 +270,7 @@ config SND_SBAWE
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_PCM
select SND_GENERIC_DRIVER
help
Say Y here to include support for Sound Blaster AWE soundcards
(including the Plug and Play version).
Expand Down
37 changes: 19 additions & 18 deletions sound/isa/ad1848/ad1848.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,35 +91,36 @@ static int __init snd_card_ad1848_probe(int dev)
irq[dev],
dma1[dev],
thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT,
&chip)) < 0) {
snd_card_free(card);
return err;
}
&chip)) < 0)
goto _err;

if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0)
goto _err;

if ((err = snd_ad1848_mixer(chip)) < 0)
goto _err;

if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0) {
snd_card_free(card);
return err;
}
if ((err = snd_ad1848_mixer(chip)) < 0) {
snd_card_free(card);
return err;
}
strcpy(card->driver, "AD1848");
strcpy(card->shortname, pcm->name);

sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
pcm->name, chip->port, irq[dev], dma1[dev]);

if (thinkpad[dev]) {
if (thinkpad[dev])
strcat(card->longname, " [Thinkpad]");
}

if ((err = snd_card_register(card)) < 0) {
snd_card_free(card);
return err;
}
if ((err = snd_card_set_generic_dev(card)) < 0)
goto _err;

if ((err = snd_card_register(card)) < 0)
goto _err;

snd_ad1848_cards[dev] = card;
return 0;

_err:
snd_card_free(card);
return err;
}

static int __init alsa_card_ad1848_init(void)
Expand Down
77 changes: 38 additions & 39 deletions sound/isa/cmi8330.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,33 +438,37 @@ static int __devinit snd_cmi8330_pcm(snd_card_t *card, struct snd_cmi8330 *chip)
/*
*/

#ifdef CONFIG_PNP
#define is_isapnp_selected(dev) isapnp[dev]
#else
#define is_isapnp_selected(dev) 0
#endif

#define PFX "cmi8330: "

static int __devinit snd_cmi8330_probe(int dev,
struct pnp_card_link *pcard,
const struct pnp_card_device_id *pid)
{
snd_card_t *card;
struct snd_cmi8330 *acard;
unsigned long flags;
int i, err;

#ifdef CONFIG_PNP
if (!isapnp[dev]) {
#endif
if (! is_isapnp_selected(dev)) {
if (wssport[dev] == SNDRV_AUTO_PORT) {
snd_printk("specify wssport\n");
snd_printk(KERN_ERR PFX "specify wssport\n");
return -EINVAL;
}
if (sbport[dev] == SNDRV_AUTO_PORT) {
snd_printk("specify sbport\n");
snd_printk(KERN_ERR PFX "specify sbport\n");
return -EINVAL;
}
#ifdef CONFIG_PNP
}
#endif

card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_cmi8330));
if (card == NULL) {
snd_printk("could not get a new card\n");
snd_printk(KERN_ERR PFX "could not get a new card\n");
return -ENOMEM;
}
acard = (struct snd_cmi8330 *)card->private_data;
Expand All @@ -473,9 +477,8 @@ static int __devinit snd_cmi8330_probe(int dev,
#ifdef CONFIG_PNP
if (isapnp[dev]) {
if ((err = snd_cmi8330_pnp(dev, acard, pcard, pid)) < 0) {
snd_printk("PnP detection failed\n");
snd_card_free(card);
return err;
snd_printk(KERN_ERR PFX "PnP detection failed\n");
goto _err;
}
snd_card_set_dev(card, &pcard->card->dev);
}
Expand All @@ -487,14 +490,13 @@ static int __devinit snd_cmi8330_probe(int dev,
wssdma[dev],
AD1848_HW_DETECT,
&acard->wss)) < 0) {
snd_printk("(AD1848) device busy??\n");
snd_card_free(card);
return err;
snd_printk(KERN_ERR PFX "(AD1848) device busy??\n");
goto _err;
}
if (acard->wss->hardware != AD1848_HW_CMI8330) {
snd_printk("(AD1848) not found during probe\n");
snd_card_free(card);
return -ENODEV;
snd_printk(KERN_ERR PFX "(AD1848) not found during probe\n");
err = -ENODEV;
goto _err;
}

if ((err = snd_sbdsp_create(card, sbport[dev],
Expand All @@ -503,32 +505,26 @@ static int __devinit snd_cmi8330_probe(int dev,
sbdma8[dev],
sbdma16[dev],
SB_HW_AUTO, &acard->sb)) < 0) {
snd_printk("(SB16) device busy??\n");
snd_card_free(card);
return err;
snd_printk(KERN_ERR PFX "(SB16) device busy??\n");
goto _err;
}
if (acard->sb->hardware != SB_HW_16) {
snd_printk("(SB16) not found during probe\n");
snd_card_free(card);
return -ENODEV;
snd_printk(KERN_ERR PFX "(SB16) not found during probe\n");
goto _err;
}

spin_lock_irqsave(&acard->wss->reg_lock, flags);
snd_ad1848_out(acard->wss, AD1848_MISC_INFO, 0x40); /* switch on MODE2 */
for (i = CMI8330_RMUX3D; i <= CMI8330_CDINGAIN; i++)
snd_ad1848_out(acard->wss, i, snd_cmi8330_image[i - CMI8330_RMUX3D]);
spin_unlock_irqrestore(&acard->wss->reg_lock, flags);

if ((err = snd_cmi8330_mixer(card, acard)) < 0) {
snd_printk("failed to create mixers\n");
snd_card_free(card);
return err;
snd_printk(KERN_ERR PFX "failed to create mixers\n");
goto _err;
}

if ((err = snd_cmi8330_pcm(card, acard)) < 0) {
snd_printk("failed to create pcms\n");
snd_card_free(card);
return err;
snd_printk(KERN_ERR PFX "failed to create pcms\n");
goto _err;
}

strcpy(card->driver, "CMI8330/C3D");
Expand All @@ -539,16 +535,21 @@ static int __devinit snd_cmi8330_probe(int dev,
wssirq[dev],
wssdma[dev]);

if ((err = snd_card_register(card)) < 0) {
snd_card_free(card);
return err;
}
if ((err = snd_card_set_generic_dev(card)) < 0)
goto _err;

if ((err = snd_card_register(card)) < 0)
goto _err;

if (pcard)
pnp_set_card_drvdata(pcard, card);
else
snd_cmi8330_legacy[dev] = card;
return 0;

_err:
snd_card_free(card);
return err;
}

#ifdef CONFIG_PNP
Expand Down Expand Up @@ -594,10 +595,8 @@ static int __init alsa_card_cmi8330_init(void)
for (dev = 0; dev < SNDRV_CARDS; dev++) {
if (!enable[dev])
continue;
#ifdef CONFIG_PNP
if (isapnp[dev])
if (is_isapnp_selected(dev))
continue;
#endif
if (snd_cmi8330_probe(dev, NULL, NULL) >= 0)
cards++;
}
Expand Down
Loading

0 comments on commit 43bcd97

Please sign in to comment.