All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <lrg@ti.com>
To: Ben Gardiner <bengardiner@nanometrics.ca>
Cc: Steven Faludi <stevenfaludi@nanometrics.ca>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	"Nori, Sekhar" <nsekhar@ti.com>,
	"davinci-linux-open-source@linux.davincidsp.com"
	<davinci-linux-open-source@linux.davincidsp.com>,
	Troy Kisky <troy.kisky@boundarydevices.com>
Subject: Re: [PATCH] ASoC: davinci-pcm: comments for the conversion to BATCH mode
Date: Wed, 25 May 2011 15:19:39 +0100	[thread overview]
Message-ID: <4DDD0FFB.1060405@ti.com> (raw)
In-Reply-To: <1306330042-16714-1-git-send-email-bengardiner@nanometrics.ca>

On 25/05/11 14:27, Ben Gardiner wrote:
> 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>
> 
> ---
>  sound/soc/davinci/davinci-pcm.c |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
> index fa8fc61..c9e0320 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)
>  		print_buf_info(prtd->asp_link[0], "asp_link[0]");
>  		print_buf_info(prtd->asp_link[1], "asp_link[1]");
>  
> +		/*
> +		 * There is a phase offset of 2 periods between the position
> +		 * used by dma setup and the position reported in the pointer
> +		 * function.
> +		 *
> +		 * The phase offset, when not using ping-pong buffers, is due to
> +		 * the two consecutive calls to davinci_pcm_enqueue_dma() below.
> +		 *
> +		 * Whereas here, with ping-pong buffers, the phase is due to
> +		 * there being an entire buffer transfer complete before the
> +		 * first dma completion event triggers davinci_pcm_dma_irq().
> +		 */
>  		davinci_pcm_period_elapsed(substream);
>  		davinci_pcm_period_elapsed(substream);
>  
> @@ -631,6 +643,13 @@ davinci_pcm_pointer(struct snd_pcm_substream *substream)
>  	int asp_count;
>  	unsigned int period_size = snd_pcm_lib_period_bytes(substream);
>  
> +	/*
> +	 * There is a phase offset of 2 periods between the position used by dma
> +	 * setup and the position reported in the pointer function. Either +2 in
> +	 * the dma setup or -2 here in the pointer function (with wrapping,
> +	 * both) accounts for this offset -- choose the latter since it makes
> +	 * the first-time setup clearer.
> +	 */
>  	spin_lock(&prtd->lock);
>  	asp_count = prtd->period - 2;
>  	spin_unlock(&prtd->lock);

Acked-by: Liam Girdwood <lrg@ti.com>

  reply	other threads:[~2011-05-25 14:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24 18:50 [PATCH 0/6] ASoC: davinci-pcm: some fixes and convert to BATCH Ben Gardiner
2011-05-24 18:50 ` [PATCH 1/6] ASoC: davinci-pcm: trivial: make ping-pong params setup symmetrical Ben Gardiner
2011-05-24 18:50 ` [PATCH 2/6] ASoC: davinci-pcm: expand the .formats Ben Gardiner
2011-05-24 18:50 ` [PATCH 3/6] ASoC: davinci-pcm: increase the maximum channels Ben Gardiner
2011-05-24 18:50 ` [PATCH 4/6] ASoC: davinci-pcm: fix audible glitch on 2nd ping-pong playback Ben Gardiner
2011-05-24 18:50 ` [PATCH 5/6] ASoC: davinci-pcm: extract period elapsed functions Ben Gardiner
2011-05-24 18:50 ` [PATCH 6/6] ASoC: davinci-pcm: convert to BATCH mode Ben Gardiner
2011-05-25  9:52   ` Liam Girdwood
2011-05-25 12:17     ` Ben Gardiner
2011-05-25 13:27     ` [PATCH] ASoC: davinci-pcm: comments for the conversion " Ben Gardiner
2011-05-25 14:19       ` Liam Girdwood [this message]
2011-05-25 15:00       ` Mark Brown
2011-05-25  9:54 ` [PATCH 0/6] ASoC: davinci-pcm: some fixes and convert to BATCH Liam Girdwood
2011-05-25 11:14 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DDD0FFB.1060405@ti.com \
    --to=lrg@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bengardiner@nanometrics.ca \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=nsekhar@ti.com \
    --cc=stevenfaludi@nanometrics.ca \
    --cc=troy.kisky@boundarydevices.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.