[alsa-devel] [PATCH] ALSA: ASoC V2: report error if DMA doesn't start in FSL MPC8610 sound drivers

Timur Tabi timur at freescale.com
Thu Aug 7 18:22:31 CEST 2008


Return an error if the DMA's current pointer is not within the bounds of the
DMA buffer.  This can happen if the DMA controller is not programmed correctly,
or if the SSI doesn't communicate with the DMA controller correctly.

Signed-off-by: Timur Tabi <timur at freescale.com>
---

This patch is for ASoC V2.

 sound/soc/fsl/fsl_dma.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index cb1e5ae..b4ae486 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -689,6 +689,15 @@ static snd_pcm_uframes_t fsl_dma_pointer(struct snd_pcm_substream *substream)
 	else
 		position = in_be32(&dma_channel->dar);
 
+	if ((position < dma_private->dma_buf_phys) ||
+	    (position > dma_private->dma_buf_end)) {
+		dev_err(substream->pcm->card->dev,
+			"DMA(%u,%u) pointer is out of range, halting stream\n",
+			dma_private->dma_info->controller_id,
+			dma_private->dma_info->channel_id);
+		return SNDRV_PCM_POS_XRUN;
+	}
+
 	frames = bytes_to_frames(runtime, position - dma_private->dma_buf_phys);
 
 	/*
-- 
1.5.5



More information about the Alsa-devel mailing list