diff options
author | John Bonesio <bones@secretlab.ca> | 2009-07-29 08:38:55 -0700 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-08-05 22:10:14 +0100 |
commit | b0a2712ffdde139f95d3e78c359877b23709509a (patch) | |
tree | 6ce89ac1c71324f438b7869cef07c9c1066ade96 | |
parent | 4bc4c9a5f5206d795e9ee1af8b0b074d126354af (diff) | |
download | talos-obmc-linux-b0a2712ffdde139f95d3e78c359877b23709509a.tar.gz talos-obmc-linux-b0a2712ffdde139f95d3e78c359877b23709509a.zip |
ASoC: MPC5200: Support for buffer wrap around
The code in psc_dma_bcom_enqueue_tx() didn't account for the fact that
s->runtime->control->appl_ptr can wrap around to the beginning of the
buffer. This change fixes this problem.
Signed-off-by: John Bonesio <bones@secretlab.ca>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/fsl/mpc5200_dma.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index f0a2d4071998..9ff62e3a9b1d 100644 --- a/sound/soc/fsl/mpc5200_dma.c +++ b/sound/soc/fsl/mpc5200_dma.c @@ -69,6 +69,23 @@ static void psc_dma_bcom_enqueue_next_buffer(struct psc_dma_stream *s) static void psc_dma_bcom_enqueue_tx(struct psc_dma_stream *s) { + if (s->appl_ptr > s->runtime->control->appl_ptr) { + /* + * In this case s->runtime->control->appl_ptr has wrapped around. + * Play the data to the end of the boundary, then wrap our own + * appl_ptr back around. + */ + while (s->appl_ptr < s->runtime->boundary) { + if (bcom_queue_full(s->bcom_task)) + return; + + s->appl_ptr += s->period_size; + + psc_dma_bcom_enqueue_next_buffer(s); + } + s->appl_ptr -= s->runtime->boundary; + } + while (s->appl_ptr < s->runtime->control->appl_ptr) { if (bcom_queue_full(s->bcom_task)) |