aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci
diff options
context:
space:
mode:
authorBen Gardiner <bengardiner@nanometrics.ca>2011-05-25 09:27:22 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-05-25 10:59:07 -0400
commitbb5b5fd4d49e5902840874cf60b51714bd51a30a (patch)
tree085acbb1ff93969f87550a565dd56128bd68fea3 /sound/soc/davinci
parent52e2c5d38ea6f13a19c29da7ba5183e6fac55400 (diff)
ASoC: davinci-pcm: comments for the conversion to BATCH mode
In the previous commit 'ASoC: davinci-pcm: convert to BATCH mode', the phase offset of 2 was mentioned in the commit message but not well commented in the source. Add descriptive comments of the phase offset with and without ping-pong buffers enabled. Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r--sound/soc/davinci/davinci-pcm.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index fa8fc617c0db..c9e0320f6289 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -605,6 +605,18 @@ static int davinci_pcm_prepare(struct snd_pcm_substream *substream)
605 print_buf_info(prtd->asp_link[0], "asp_link[0]"); 605 print_buf_info(prtd->asp_link[0], "asp_link[0]");
606 print_buf_info(prtd->asp_link[1], "asp_link[1]"); 606 print_buf_info(prtd->asp_link[1], "asp_link[1]");
607 607
608 /*
609 * There is a phase offset of 2 periods between the position
610 * used by dma setup and the position reported in the pointer
611 * function.
612 *
613 * The phase offset, when not using ping-pong buffers, is due to
614 * the two consecutive calls to davinci_pcm_enqueue_dma() below.
615 *
616 * Whereas here, with ping-pong buffers, the phase is due to
617 * there being an entire buffer transfer complete before the
618 * first dma completion event triggers davinci_pcm_dma_irq().
619 */
608 davinci_pcm_period_elapsed(substream); 620 davinci_pcm_period_elapsed(substream);
609 davinci_pcm_period_elapsed(substream); 621 davinci_pcm_period_elapsed(substream);
610 622
@@ -631,6 +643,13 @@ davinci_pcm_pointer(struct snd_pcm_substream *substream)
631 int asp_count; 643 int asp_count;
632 unsigned int period_size = snd_pcm_lib_period_bytes(substream); 644 unsigned int period_size = snd_pcm_lib_period_bytes(substream);
633 645
646 /*
647 * There is a phase offset of 2 periods between the position used by dma
648 * setup and the position reported in the pointer function. Either +2 in
649 * the dma setup or -2 here in the pointer function (with wrapping,
650 * both) accounts for this offset -- choose the latter since it makes
651 * the first-time setup clearer.
652 */
634 spin_lock(&prtd->lock); 653 spin_lock(&prtd->lock);
635 asp_count = prtd->period - 2; 654 asp_count = prtd->period - 2;
636 spin_unlock(&prtd->lock); 655 spin_unlock(&prtd->lock);