X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sound%2Fpci%2Fau88x0%2Fau88x0_pcm.c;h=066e6c698a7217344f973b378d5c1b25fe908a80;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=8e6322158858d1e89f4c41ec90130f1cf58089fc;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index 8e6322158..066e6c698 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c @@ -206,6 +206,7 @@ snd_vortex_pcm_hw_params(snd_pcm_substream_t * substream, printk(KERN_INFO "Vortex: periods %d, period_bytes %d, channels = %d\n", params_periods(hw_params), params_period_bytes(hw_params), params_channels(hw_params)); */ + spin_lock_irq(&chip->lock); // Make audio routes and config buffer DMA. if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) { int dma, type = VORTEX_PCM_TYPE(substream->pcm); @@ -243,6 +244,7 @@ snd_vortex_pcm_hw_params(snd_pcm_substream_t * substream, params_periods(hw_params)); } #endif + spin_unlock_irq(&chip->lock); return 0; } @@ -252,6 +254,7 @@ static int snd_vortex_pcm_hw_free(snd_pcm_substream_t * substream) vortex_t *chip = snd_pcm_substream_chip(substream); stream_t *stream = (stream_t *) (substream->runtime->private_data); + spin_lock_irq(&chip->lock); // Delete audio routes. if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) { if (stream != NULL) @@ -266,6 +269,7 @@ static int snd_vortex_pcm_hw_free(snd_pcm_substream_t * substream) } #endif substream->runtime->private_data = NULL; + spin_unlock_irq(&chip->lock); return snd_pcm_lib_free_pages(substream); } @@ -284,6 +288,7 @@ static int snd_vortex_pcm_prepare(snd_pcm_substream_t * substream) else dir = 0; fmt = vortex_alsafmt_aspfmt(runtime->format); + spin_lock_irq(&chip->lock); if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) { vortex_adbdma_setmode(chip, dma, 1, dir, fmt, 0 /*? */ , 0); @@ -298,6 +303,7 @@ static int snd_vortex_pcm_prepare(snd_pcm_substream_t * substream) vortex_wtdma_setstartbuffer(chip, dma, 0); } #endif + spin_unlock_irq(&chip->lock); return 0; } @@ -308,13 +314,16 @@ static int snd_vortex_pcm_trigger(snd_pcm_substream_t * substream, int cmd) stream_t *stream = (stream_t *) substream->runtime->private_data; int dma = stream->dma; + spin_lock(&chip->lock); switch (cmd) { case SNDRV_PCM_TRIGGER_START: // do something to start the PCM engine //printk(KERN_INFO "vortex: start %d\n", dma); stream->fifo_enabled = 1; - if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) + if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) { + vortex_adbdma_resetup(chip, dma); vortex_adbdma_startfifo(chip, dma); + } #ifndef CHIP_AU8810 else { printk(KERN_INFO "vortex: wt start %d\n", dma); @@ -355,8 +364,10 @@ static int snd_vortex_pcm_trigger(snd_pcm_substream_t * substream, int cmd) #endif break; default: + spin_unlock(&chip->lock); return -EINVAL; } + spin_unlock(&chip->lock); return 0; }