Skip to content

Commit

Permalink
ASoC: MPC5200: Support for buffer wrap around
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
John Bonesio authored and Mark Brown committed Aug 5, 2009
1 parent 4bc4c9a commit b0a2712
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sound/soc/fsl/mpc5200_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit b0a2712

Please sign in to comment.