diff options
author | Lionel Xu <Lionel.Xu@freescale.com> | 2010-09-13 17:34:54 +0800 |
---|---|---|
committer | Alejandro Gonzalez <alex.gonzalez@digi.com> | 2011-01-17 14:56:46 +0100 |
commit | 0c6655fdfecd529628da85459dbda28d4b27d40c (patch) | |
tree | 7e20d4a9f0141ab4b0dc6d75d18f840ce1186be3 /sound | |
parent | bd2272539f32b5f95963cf7673cc653249b70131 (diff) |
ENGR00131404 MXS DMA: Fix occasional system panic when playback finish
System got panic sometimes when a playback stops, this patch is used to
fix the problem.
Signed-off-by: Lionel Xu <r63889@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/mxs/mxs-pcm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c index 12c90309bd7a..198f1e5201fa 100644 --- a/sound/soc/mxs/mxs-pcm.c +++ b/sound/soc/mxs/mxs-pcm.c @@ -170,12 +170,18 @@ static void mxs_pcm_stop(struct snd_pcm_substream *substream) struct mxs_dma_info dma_info; int desc; + int periods_num = prtd->dma_totsize / prtd->dma_period; /* Freez DMA channel for a moment */ mxs_dma_freeze(prtd->dma_ch); mxs_dma_get_info(prtd->dma_ch, &dma_info); desc = (dma_info.buf_addr - runtime->dma_addr) / prtd->dma_period; + if (desc >= periods_num) + desc = 0; + else if (desc < 0) + desc = 0; + /* Set up the next descriptor to decrement DMA channel sempahore */ prtd->dma_desc_array[(desc + 1)%8]->cmd.cmd.bits.bytes = 0; prtd->dma_desc_array[(desc + 1)%8]->cmd.cmd.bits.pio_words = 0; |