All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: MPC5200: Support for buffer wrap around
@ 2009-07-31 23:08 John Bonesio
  2009-08-01  1:57 ` Grant Likely
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: John Bonesio @ 2009-07-31 23:08 UTC (permalink / raw)
  To: Grant Likely, Jon Smirl, Eric Millbrandt, Mark Brown, alsa-devel

We've encountered strange behavior in the alsamixer settings using the wm9712
codec. If we unmute the headphone output and then unmute the PCM output, the
headphone output gets reset to mute in the hardware register. At this point
the hardware register does not match the value in the register cache.

I've spent some time debugging this, and the headphone setting is set outside
of any code path that would call the ac97_write() routine. As best as I can
tell, there is something strange going on in hardware.

I've provided this patch that works around the problem.

Have any of you seen this before? Is this patch the right 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))

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-08-07 15:16 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-31 23:08 [PATCH] ASoC: MPC5200: Support for buffer wrap around 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
2009-08-05 16:30       ` [PATCH] ASoC: WM9712 Codec: Workaround an unmute problem (Was: Re: [PATCH] ASoC: MPC5200: Support for buffer wrap around) John Bonesio
2009-08-05 17:03         ` MPC5200/WM9712 mute problem Mark Brown
2009-08-06 17:28           ` John Bonesio
2009-08-07  9:56             ` Mark Brown
2009-08-07 14:48               ` John Bonesio
2009-08-07 15:16                 ` Jon Smirl
2009-08-05 17:16         ` [PATCH] ASoC: WM9712 Codec: Workaround an unmute problem (Was: Re: [PATCH] ASoC: MPC5200: Support for buffer wrap around) Jon Smirl
2009-08-05 17:27           ` Jon Smirl

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.