aboutsummaryrefslogtreecommitdiffstats
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.c70
1 files changed, 28 insertions, 42 deletions
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 0797ca441a37..19706b0d8497 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -33,11 +33,7 @@
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/dma.h> 34#include <asm/dma.h>
35#include <sound/core.h> 35#include <sound/core.h>
36#if defined(CS4231) || defined(OPTi93X) 36#include <sound/wss.h>
37#include <sound/cs4231.h>
38#else
39#include <sound/ad1848.h>
40#endif /* CS4231 */
41#include <sound/mpu401.h> 37#include <sound/mpu401.h>
42#include <sound/opl3.h> 38#include <sound/opl3.h>
43#ifndef OPTi93X 39#ifndef OPTi93X
@@ -139,7 +135,7 @@ struct snd_opti9xx {
139 unsigned long mc_base_size; 135 unsigned long mc_base_size;
140#ifdef OPTi93X 136#ifdef OPTi93X
141 unsigned long mc_indir_index; 137 unsigned long mc_indir_index;
142 struct snd_cs4231 *codec; 138 struct snd_wss *codec;
143#endif /* OPTi93X */ 139#endif /* OPTi93X */
144 unsigned long pwd_reg; 140 unsigned long pwd_reg;
145 141
@@ -148,9 +144,7 @@ struct snd_opti9xx {
148 long wss_base; 144 long wss_base;
149 int irq; 145 int irq;
150 int dma1; 146 int dma1;
151#if defined(CS4231) || defined(OPTi93X)
152 int dma2; 147 int dma2;
153#endif /* CS4231 || OPTi93X */
154 148
155 long fm_port; 149 long fm_port;
156 150
@@ -225,9 +219,7 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
225 chip->wss_base = -1; 219 chip->wss_base = -1;
226 chip->irq = -1; 220 chip->irq = -1;
227 chip->dma1 = -1; 221 chip->dma1 = -1;
228#if defined(CS4231) || defined (OPTi93X)
229 chip->dma2 = -1; 222 chip->dma2 = -1;
230#endif /* CS4231 || OPTi93X */
231 chip->fm_port = -1; 223 chip->fm_port = -1;
232 chip->mpu_port = -1; 224 chip->mpu_port = -1;
233 chip->mpu_irq = -1; 225 chip->mpu_irq = -1;
@@ -562,7 +554,7 @@ __skip_mpu:
562 554
563static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id) 555static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id)
564{ 556{
565 struct snd_cs4231 *codec = dev_id; 557 struct snd_wss *codec = dev_id;
566 struct snd_opti9xx *chip = codec->card->private_data; 558 struct snd_opti9xx *chip = codec->card->private_data;
567 unsigned char status; 559 unsigned char status;
568 560
@@ -570,7 +562,7 @@ static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id)
570 if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream) 562 if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream)
571 snd_pcm_period_elapsed(codec->playback_substream); 563 snd_pcm_period_elapsed(codec->playback_substream);
572 if ((status & OPTi93X_IRQ_CAPTURE) && codec->capture_substream) { 564 if ((status & OPTi93X_IRQ_CAPTURE) && codec->capture_substream) {
573 snd_cs4231_overrange(codec); 565 snd_wss_overrange(codec);
574 snd_pcm_period_elapsed(codec->capture_substream); 566 snd_pcm_period_elapsed(codec->capture_substream);
575 } 567 }
576 outb(0x00, OPTi93X_PORT(codec, STATUS)); 568 outb(0x00, OPTi93X_PORT(codec, STATUS));
@@ -691,7 +683,7 @@ static void snd_card_opti9xx_free(struct snd_card *card)
691 683
692 if (chip) { 684 if (chip) {
693#ifdef OPTi93X 685#ifdef OPTi93X
694 struct snd_cs4231 *codec = chip->codec; 686 struct snd_wss *codec = chip->codec;
695 if (codec && codec->irq > 0) { 687 if (codec && codec->irq > 0) {
696 disable_irq(codec->irq); 688 disable_irq(codec->irq);
697 free_irq(codec->irq, codec); 689 free_irq(codec->irq, codec);
@@ -706,14 +698,10 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
706 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; 698 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
707 int error; 699 int error;
708 struct snd_opti9xx *chip = card->private_data; 700 struct snd_opti9xx *chip = card->private_data;
709#if defined(CS4231) || defined(OPTi93X) 701 struct snd_wss *codec;
710 struct snd_cs4231 *codec;
711#ifdef CS4231 702#ifdef CS4231
712 struct snd_timer *timer; 703 struct snd_timer *timer;
713#endif 704#endif
714#else
715 struct snd_ad1848 *codec;
716#endif
717 struct snd_pcm *pcm; 705 struct snd_pcm *pcm;
718 struct snd_rawmidi *rmidi; 706 struct snd_rawmidi *rmidi;
719 struct snd_hwdep *synth; 707 struct snd_hwdep *synth;
@@ -731,38 +719,46 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
731 chip->dma1 = dma1; 719 chip->dma1 = dma1;
732#if defined(CS4231) || defined(OPTi93X) 720#if defined(CS4231) || defined(OPTi93X)
733 chip->dma2 = dma2; 721 chip->dma2 = dma2;
722#else
723 chip->dma2 = -1;
734#endif 724#endif
735 725
736 if (chip->wss_base == SNDRV_AUTO_PORT) { 726 if (chip->wss_base == SNDRV_AUTO_PORT) {
737 if ((chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4)) < 0) { 727 chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4);
728 if (chip->wss_base < 0) {
738 snd_printk("unable to find a free WSS port\n"); 729 snd_printk("unable to find a free WSS port\n");
739 return -EBUSY; 730 return -EBUSY;
740 } 731 }
741 } 732 }
742 if ((error = snd_opti9xx_configure(chip))) 733 error = snd_opti9xx_configure(chip);
734 if (error)
743 return error; 735 return error;
744 736
745#if defined(CS4231) || defined(OPTi93X) 737 error = snd_wss_create(card, chip->wss_base + 4, -1,
746 if ((error = snd_cs4231_create(card, chip->wss_base + 4, -1, 738 chip->irq, chip->dma1, chip->dma2,
747 chip->irq, chip->dma1, chip->dma2, 739#ifdef OPTi93X
748#ifdef CS4231 740 WSS_HW_OPTI93X, WSS_HWSHARE_IRQ,
749 CS4231_HW_DETECT, 0, 741#else
750#else /* OPTi93x */ 742 WSS_HW_DETECT, 0,
751 CS4231_HW_OPTI93X, CS4231_HWSHARE_IRQ,
752#endif 743#endif
753 &codec)) < 0) 744 &codec);
745 if (error < 0)
754 return error; 746 return error;
755#ifdef OPTi93X 747#ifdef OPTi93X
756 chip->codec = codec; 748 chip->codec = codec;
757#endif 749#endif
758 if ((error = snd_cs4231_pcm(codec, 0, &pcm)) < 0) 750 error = snd_wss_pcm(codec, 0, &pcm);
751 if (error < 0)
759 return error; 752 return error;
760 if ((error = snd_cs4231_mixer(codec)) < 0) 753 error = snd_wss_mixer(codec);
754 if (error < 0)
761 return error; 755 return error;
762#ifdef CS4231 756#ifdef CS4231
763 if ((error = snd_cs4231_timer(codec, 0, &timer)) < 0) 757 error = snd_wss_timer(codec, 0, &timer);
758 if (error < 0)
764 return error; 759 return error;
765#else /* OPTI93X */ 760#endif
761#ifdef OPTi93X
766 error = request_irq(chip->irq, snd_opti93x_interrupt, 762 error = request_irq(chip->irq, snd_opti93x_interrupt,
767 IRQF_DISABLED, DEV_NAME" - WSS", codec); 763 IRQF_DISABLED, DEV_NAME" - WSS", codec);
768 if (error < 0) { 764 if (error < 0) {
@@ -770,16 +766,6 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
770 return error; 766 return error;
771 } 767 }
772#endif 768#endif
773#else
774 if ((error = snd_ad1848_create(card, chip->wss_base + 4,
775 chip->irq, chip->dma1,
776 AD1848_HW_DETECT, &codec)) < 0)
777 return error;
778 if ((error = snd_ad1848_pcm(codec, 0, &pcm)) < 0)
779 return error;
780 if ((error = snd_ad1848_mixer(codec)) < 0)
781 return error;
782#endif
783 strcpy(card->driver, chip->name); 769 strcpy(card->driver, chip->name);
784 sprintf(card->shortname, "OPTi %s", card->driver); 770 sprintf(card->shortname, "OPTi %s", card->driver);
785#if defined(CS4231) || defined(OPTi93X) 771#if defined(CS4231) || defined(OPTi93X)