ASoC: MPC5200: Support for buffer wrap around
PATCH 1/1 ASoC: MPC5200: Support for buffer wrap around
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.
---
sound/soc/fsl/mpc5200_dma.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
sound/soc/fsl/mpc5200_dma.c +17 -0
@@ -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))
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
Quoted 51 lines · John Bonesio
Here's another
appl_ptrrelated patch to the alsa soc mpc5200 ac97 driver. This time the patch is to fix a problem with not correctly handlingappl_ptrwrapping 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 thats->runtime->control->appl_ptrcan wrap around to the beginning of the buffer. This change fixes this problem.Signed-off-by John Bonesio <[email protected]>---
sound/soc/fsl/mpc5200_dma.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)sound/soc/fsl/mpc5200_dma.c +17
-0@@ -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))
Quoted 1 line
From
4df451365d98bd33b27fc61896fad32bcbc5692bMon Sep 17 00:00:00 2001
From: John Bonesio <[email protected]>
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.
--- sound/soc/fsl/mpc5200_dma.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
sound/soc/fsl/mpc5200_dma.c +17 -0
@@ -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))
Signature · 1 line
1.6.0.4
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 8 lines · John Bonesio
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_ptrwrapping back around to the beginning of the buffer.I've attached the patch, for your convenience.
I've been waiting for one of the driver maintainers (Grant or Jon) to comment on it.
Grant Likely
Acked-byQuoted 5 lines · Mark Brown
Quoted 2 lines · John Bonesio
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.
Quoted 8 lines
Quoted 5 lines
Since I've submitted the patch to the list, we've been able to test it, and audio continues to play right through
appl_ptrwrapping back around to the beginning of the buffer.I've attached the patch, for your convenience.
I've been waiting for one of the driver maintainers (Grant or Jon) to comment on it.
Heh.... helps if I post my approval publicly instead of just talking to John over IM.
The patch looks correct and I know that it works because John got me to help with testing.
An Ack from Jon would be nice too.
Quoted 6 lines · Grant Likely
The patch looks correct and I know that it works because John got me to help with testing.
Acked-by Grant Likely <[email protected]>An Ack from Jon would be nice too.
It looks ok to me. I have my hardware torn up so I can't run anything. I am rebuilding it to work on I2S.
I wish the upper layers would deal with appl_ptr instead of making the drivers do it.
Signature · 2 lines
Jon Smirl [email protected]
Mark Brown
AppliedQuoted 6 lines · Jon Smirl
Quoted 1 line · Grant Likely
Acked-by Grant Likely <[email protected]>It looks ok to me. I have my hardware torn up so I can't run anything. I am rebuilding it to work on I2S.
Applied, thanks.
Quoted 2 lines
I wish the upper layers would deal with
appl_ptrinstead of making the drivers do it.
wv :)