aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/es18xx.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-09-05 11:19:20 -0400
committerJaroslav Kysela <perex@suse.cz>2005-09-12 04:42:01 -0400
commit43bcd973d6d05d16b876e09dcc49a09d3e48e88d (patch)
tree8c8493b66c417402f6188051c57e55099bbd156d /sound/isa/es18xx.c
parent16dab54b8cbac39bd3f639db5d7d0fd8300a6cb0 (diff)
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
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>
Diffstat (limited to 'sound/isa/es18xx.c')
-rw-r--r--sound/isa/es18xx.c81
1 files changed, 39 insertions, 42 deletions
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 1d832b2adb7c..f654d5948367 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -1988,6 +1988,12 @@ static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard,
1988} 1988}
1989#endif /* CONFIG_PNP */ 1989#endif /* CONFIG_PNP */
1990 1990
1991#ifdef CONFIG_PNP
1992#define is_isapnp_selected(dev) isapnp[dev]
1993#else
1994#define is_isapnp_selected(dev) 0
1995#endif
1996
1991static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, 1997static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
1992 const struct pnp_card_device_id *pid) 1998 const struct pnp_card_device_id *pid)
1993{ 1999{
@@ -1996,7 +2002,6 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
1996 int xirq, xdma1, xdma2; 2002 int xirq, xdma1, xdma2;
1997 snd_card_t *card; 2003 snd_card_t *card;
1998 struct snd_audiodrive *acard; 2004 struct snd_audiodrive *acard;
1999 snd_rawmidi_t *rmidi = NULL;
2000 es18xx_t *chip; 2005 es18xx_t *chip;
2001 opl3_t *opl3; 2006 opl3_t *opl3;
2002 int err; 2007 int err;
@@ -2019,25 +2024,25 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
2019 xirq = irq[dev]; 2024 xirq = irq[dev];
2020 if (xirq == SNDRV_AUTO_IRQ) { 2025 if (xirq == SNDRV_AUTO_IRQ) {
2021 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 2026 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
2022 snd_card_free(card); 2027 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
2023 snd_printk("unable to find a free IRQ\n"); 2028 err = -EBUSY;
2024 return -EBUSY; 2029 goto _err;
2025 } 2030 }
2026 } 2031 }
2027 xdma1 = dma1[dev]; 2032 xdma1 = dma1[dev];
2028 if (xdma1 == SNDRV_AUTO_DMA) { 2033 if (xdma1 == SNDRV_AUTO_DMA) {
2029 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 2034 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
2030 snd_card_free(card); 2035 snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
2031 snd_printk("unable to find a free DMA1\n"); 2036 err = -EBUSY;
2032 return -EBUSY; 2037 goto _err;
2033 } 2038 }
2034 } 2039 }
2035 xdma2 = dma2[dev]; 2040 xdma2 = dma2[dev];
2036 if (xdma2 == SNDRV_AUTO_DMA) { 2041 if (xdma2 == SNDRV_AUTO_DMA) {
2037 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 2042 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
2038 snd_card_free(card); 2043 snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
2039 snd_printk("unable to find a free DMA2\n"); 2044 err = -EBUSY;
2040 return -EBUSY; 2045 goto _err;
2041 } 2046 }
2042 } 2047 }
2043 2048
@@ -2046,10 +2051,8 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
2046 mpu_port[dev], 2051 mpu_port[dev],
2047 fm_port[dev], 2052 fm_port[dev],
2048 xirq, xdma1, xdma2, 2053 xirq, xdma1, xdma2,
2049 &chip)) < 0) { 2054 &chip)) < 0)
2050 snd_card_free(card); 2055 goto _err;
2051 return err;
2052 }
2053 2056
2054 sprintf(card->driver, "ES%x", chip->version); 2057 sprintf(card->driver, "ES%x", chip->version);
2055 sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version); 2058 sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version);
@@ -2064,23 +2067,18 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
2064 chip->port, 2067 chip->port,
2065 xirq, xdma1); 2068 xirq, xdma1);
2066 2069
2067 if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0) { 2070 if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0)
2068 snd_card_free(card); 2071 goto _err;
2069 return err; 2072
2070 } 2073 if ((err = snd_es18xx_mixer(chip)) < 0)
2071 if ((err = snd_es18xx_mixer(chip)) < 0) { 2074 goto _err;
2072 snd_card_free(card);
2073 return err;
2074 }
2075 2075
2076 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { 2076 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
2077 if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) { 2077 if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) {
2078 snd_printk(KERN_ERR PFX "opl3 not detected at 0x%lx\n", chip->fm_port); 2078 snd_printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->fm_port);
2079 } else { 2079 } else {
2080 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 2080 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
2081 snd_card_free(card); 2081 goto _err;
2082 return err;
2083 }
2084 } 2082 }
2085 } 2083 }
2086 2084
@@ -2088,25 +2086,28 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
2088 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, 2086 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX,
2089 chip->mpu_port, 0, 2087 chip->mpu_port, 0,
2090 xirq, 0, 2088 xirq, 0,
2091 &rmidi)) < 0) { 2089 &chip->rmidi)) < 0)
2092 snd_card_free(card); 2090 goto _err;
2093 return err;
2094 }
2095 chip->rmidi = rmidi;
2096 } 2091 }
2097 2092
2093 if ((err = snd_card_set_generic_dev(card)) < 0)
2094 goto _err;
2095
2098 /* Power Management */ 2096 /* Power Management */
2099 snd_card_set_isa_pm_callback(card, snd_es18xx_suspend, snd_es18xx_resume, chip); 2097 snd_card_set_isa_pm_callback(card, snd_es18xx_suspend, snd_es18xx_resume, chip);
2100 2098
2101 if ((err = snd_card_register(card)) < 0) { 2099 if ((err = snd_card_register(card)) < 0)
2102 snd_card_free(card); 2100 goto _err;
2103 return err; 2101
2104 }
2105 if (pcard) 2102 if (pcard)
2106 pnp_set_card_drvdata(pcard, card); 2103 pnp_set_card_drvdata(pcard, card);
2107 else 2104 else
2108 snd_audiodrive_legacy[dev] = card; 2105 snd_audiodrive_legacy[dev] = card;
2109 return 0; 2106 return 0;
2107
2108 _err:
2109 snd_card_free(card);
2110 return err;
2110} 2111}
2111 2112
2112static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport) 2113static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport)
@@ -2117,10 +2118,8 @@ static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport)
2117 for ( ; dev < SNDRV_CARDS; dev++) { 2118 for ( ; dev < SNDRV_CARDS; dev++) {
2118 if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) 2119 if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT)
2119 continue; 2120 continue;
2120#ifdef CONFIG_PNP 2121 if (is_isapnp_selected(dev))
2121 if (isapnp[dev])
2122 continue; 2122 continue;
2123#endif
2124 port[dev] = xport; 2123 port[dev] = xport;
2125 res = snd_audiodrive_probe(dev, NULL, NULL); 2124 res = snd_audiodrive_probe(dev, NULL, NULL);
2126 if (res < 0) 2125 if (res < 0)
@@ -2177,10 +2176,8 @@ static int __init alsa_card_es18xx_init(void)
2177 for (dev = 0; dev < SNDRV_CARDS; dev++) { 2176 for (dev = 0; dev < SNDRV_CARDS; dev++) {
2178 if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT) 2177 if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT)
2179 continue; 2178 continue;
2180#ifdef CONFIG_PNP 2179 if (is_isapnp_selected(dev))
2181 if (isapnp[dev])
2182 continue; 2180 continue;
2183#endif
2184 if (snd_audiodrive_probe(dev, NULL, NULL) >= 0) 2181 if (snd_audiodrive_probe(dev, NULL, NULL) >= 0)
2185 cards++; 2182 cards++;
2186 } 2183 }