All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Bonesio <bones@secretlab.ca>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	alsa-devel@alsa-project.org,
	Eric Millbrandt <emillbrandt@dekaresearch.com>
Subject: Re: [PATCH] ASoC: MPC5200: Support for buffer wrap around
Date: Wed, 05 Aug 2009 09:44:32 -0700	[thread overview]
Message-ID: <1249490672.4582.65.camel@riker> (raw)
In-Reply-To: <20090729153844.18131.68062.stgit@riker>

[-- Attachment #1: Type: text/plain, Size: 2230 bytes --]

Hi Mark,

This is another patch for ALSA on the MPC5200 that was sent to the ALSA
devel list. I'm not sure if you noticed it.

Since I've submitted the patch to the list, we've been able to test it,
and audio continues to play right through appl_ptr wrapping back around
to the beginning of the buffer.

I've attached the patch, for your convenience.

- John

On Wed, 2009-07-29 at 08:38 -0700, John Bonesio wrote:
> Here's another appl_ptr related patch to the alsa soc mpc5200 ac97 driver. This 
> time the patch is to fix a problem with not correctly handling appl_ptr
> wrapping back around to the beginning of the buffer.
> 
> I haven't yet seen a symptom related to this. This came up when I was chatting
> with Jon Smirl about another bug I was examining. Right now there is another
> problem that is preventing me from playing really long audio streams. 
> 
> Let me know if this is the wrong approach.
> 
> - John
> 
> 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>
> ---
> 
>  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 cfe0ea4..2551c58 100644
> --- a/sound/soc/fsl/mpc5200_dma.c
> +++ b/sound/soc/fsl/mpc5200_dma.c
> @@ -70,6 +70,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))
> 

[-- Attachment #2: 0001-ASoC-MPC5200-Support-for-buffer-wrap-around.patch --]
[-- Type: text/x-patch, Size: 1451 bytes --]

>From 4df451365d98bd33b27fc61896fad32bcbc5692b Mon Sep 17 00:00:00 2001
From: John Bonesio <bones@secretlab.ca>
Date: Tue, 28 Jul 2009 15:51:07 -0700
Subject: [PATCH] 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>
---
 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 cfe0ea4..2551c58 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -70,6 +70,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))
-- 
1.6.0.4


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2009-08-05 16:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29 15:38 [PATCH] ASoC: MPC5200: Support for buffer wrap around John Bonesio
2009-08-05 16:44 ` John Bonesio [this message]
2009-08-05 17:05   ` Mark Brown
2009-08-05 18:05     ` Grant Likely
2009-08-05 18:34       ` Jon Smirl
2009-08-05 21:11         ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2009-07-31 23:08 John Bonesio
2009-08-01  1:57 ` Grant Likely
2009-08-01  9:57 ` Mark Brown
2009-08-01 13:47 ` Jon Smirl
2009-08-01 15:04   ` John Bonesio
2009-08-01 16:30     ` Jon Smirl
2009-08-02 11:49     ` 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=1249490672.4582.65.camel@riker \
    --to=bones@secretlab.ca \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=emillbrandt@dekaresearch.com \
    --cc=grant.likely@secretlab.ca \
    /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.