aboutsummaryrefslogtreecommitdiffstats
path: root/sound/mips/au1x00.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/mips/au1x00.c')
-rw-r--r--sound/mips/au1x00.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c
index 6d8f8b3eabd0..cf476fe1ac56 100644
--- a/sound/mips/au1x00.c
+++ b/sound/mips/au1x00.c
@@ -43,6 +43,7 @@
43#include <sound/core.h> 43#include <sound/core.h>
44#include <sound/initval.h> 44#include <sound/initval.h>
45#include <sound/pcm.h> 45#include <sound/pcm.h>
46#include <sound/pcm_params.h>
46#include <sound/ac97_codec.h> 47#include <sound/ac97_codec.h>
47#include <asm/mach-au1x00/au1000.h> 48#include <asm/mach-au1x00/au1000.h>
48#include <asm/mach-au1x00/au1000_dma.h> 49#include <asm/mach-au1x00/au1000_dma.h>
@@ -153,6 +154,7 @@ au1000_setup_dma_link(struct audio_stream *stream, unsigned int period_bytes,
153{ 154{
154 struct snd_pcm_substream *substream = stream->substream; 155 struct snd_pcm_substream *substream = stream->substream;
155 struct snd_pcm_runtime *runtime = substream->runtime; 156 struct snd_pcm_runtime *runtime = substream->runtime;
157 struct au1000_period *pointer;
156 unsigned long dma_start; 158 unsigned long dma_start;
157 int i; 159 int i;
158 160
@@ -559,12 +561,13 @@ snd_au1000_ac97_new(struct snd_au1000 *au1000)
559 .read = snd_au1000_ac97_read, 561 .read = snd_au1000_ac97_read,
560 }; 562 };
561 563
562 if ((au1000->ac97_res_port = request_region(AC97C_CONFIG, 564 if ((au1000->ac97_res_port = request_mem_region(CPHYSADDR(AC97C_CONFIG),
563 sizeof(struct au1000_ac97_reg), "Au1x00 AC97")) == NULL) { 565 0x100000, "Au1x00 AC97")) == NULL) {
564 snd_printk(KERN_ERR "ALSA AC97: can't grap AC97 port\n"); 566 snd_printk(KERN_ERR "ALSA AC97: can't grap AC97 port\n");
565 return -EBUSY; 567 return -EBUSY;
566 } 568 }
567 au1000->ac97_ioport = (struct au1000_ac97_reg *) au1000->ac97_res_port->start; 569 au1000->ac97_ioport = (struct au1000_ac97_reg *)
570 KSEG1ADDR(au1000->ac97_res_port->start);
568 571
569 spin_lock_init(&au1000->ac97_lock); 572 spin_lock_init(&au1000->ac97_lock);
570 573
@@ -610,14 +613,17 @@ snd_au1000_free(struct snd_card *card)
610 release_and_free_resource(au1000->ac97_res_port); 613 release_and_free_resource(au1000->ac97_res_port);
611 } 614 }
612 615
613 if (au1000->stream[PLAYBACK]->dma >= 0) 616 if (au1000->stream[PLAYBACK]) {
614 free_au1000_dma(au1000->stream[PLAYBACK]->dma); 617 if (au1000->stream[PLAYBACK]->dma >= 0)
615 618 free_au1000_dma(au1000->stream[PLAYBACK]->dma);
616 if (au1000->stream[CAPTURE]->dma >= 0) 619 kfree(au1000->stream[PLAYBACK]);
617 free_au1000_dma(au1000->stream[CAPTURE]->dma); 620 }
618 621
619 kfree(au1000->stream[PLAYBACK]); 622 if (au1000->stream[CAPTURE]) {
620 kfree(au1000->stream[CAPTURE]); 623 if (au1000->stream[CAPTURE]->dma >= 0)
624 free_au1000_dma(au1000->stream[CAPTURE]->dma);
625 kfree(au1000->stream[CAPTURE]);
626 }
621} 627}
622 628
623 629
@@ -636,15 +642,19 @@ au1000_init(void)
636 642
637 card->private_free = snd_au1000_free; 643 card->private_free = snd_au1000_free;
638 au1000 = card->private_data; 644 au1000 = card->private_data;
639 /* so that snd_au1000_free will work as intended */
640 au1000->card = card; 645 au1000->card = card;
641 au1000->stream[PLAYBACK]->dma = -1; 646
642 au1000->stream[CAPTURE]->dma = -1;
643 au1000->ac97_res_port = NULL;
644 au1000->stream[PLAYBACK] = kmalloc(sizeof(struct audio_stream), GFP_KERNEL); 647 au1000->stream[PLAYBACK] = kmalloc(sizeof(struct audio_stream), GFP_KERNEL);
645 au1000->stream[CAPTURE] = kmalloc(sizeof(struct audio_stream), GFP_KERNEL); 648 au1000->stream[CAPTURE ] = kmalloc(sizeof(struct audio_stream), GFP_KERNEL);
649 /* so that snd_au1000_free will work as intended */
650 au1000->ac97_res_port = NULL;
651 if (au1000->stream[PLAYBACK])
652 au1000->stream[PLAYBACK]->dma = -1;
653 if (au1000->stream[CAPTURE ])
654 au1000->stream[CAPTURE ]->dma = -1;
655
646 if (au1000->stream[PLAYBACK] == NULL || 656 if (au1000->stream[PLAYBACK] == NULL ||
647 au1000->stream[CAPTURE] == NULL) { 657 au1000->stream[CAPTURE ] == NULL) {
648 snd_card_free(card); 658 snd_card_free(card);
649 return -ENOMEM; 659 return -ENOMEM;
650 } 660 }