From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Likely Subject: Re: [PATCH] ASoC: MPC5200: Support for buffer wrap around Date: Fri, 31 Jul 2009 19:57:34 -0600 Message-ID: References: <20090731230311.17686.46431.stgit@riker> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-yw0-f188.google.com (mail-yw0-f188.google.com [209.85.211.188]) by alsa0.perex.cz (Postfix) with ESMTP id 2AD98247D7 for ; Sat, 1 Aug 2009 03:57:35 +0200 (CEST) Received: by ywh26 with SMTP id 26so2842765ywh.5 for ; Fri, 31 Jul 2009 18:57:34 -0700 (PDT) In-Reply-To: <20090731230311.17686.46431.stgit@riker> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: John Bonesio Cc: Grant Likely , alsa-devel@alsa-project.org, Mark Brown , Eric Millbrandt List-Id: alsa-devel@alsa-project.org On Friday, July 31, 2009, John Bonesio wrote: > We've encountered strange behavior in the alsamixer settings using the wm= 9712 > 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 poi= nt > 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 out= side > of any code path that would call the ac97_write() routine. As best as I c= an > 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 Hey John, It would appear that you've attached the wrong patch. g. > --- > > =A0sound/soc/fsl/mpc5200_dma.c | =A0 17 +++++++++++++++++ > =A01 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 ps= c_dma_stream *s) > > =A0static void psc_dma_bcom_enqueue_tx(struct psc_dma_stream *s) > =A0{ > + =A0 =A0 =A0 if (s->appl_ptr > s->runtime->control->appl_ptr) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* In this case s->runtime->control->appl= _ptr has wrapped around. > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* Play the data to the end of the bounda= ry, then wrap our own > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* appl_ptr back around. > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 while (s->appl_ptr < s->runtime->boundary) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (bcom_queue_full(s->bcom= _task)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 s->appl_ptr +=3D s->period_= size; > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 psc_dma_bcom_enqueue_next_b= uffer(s); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 s->appl_ptr -=3D s->runtime->boundary; > + =A0 =A0 =A0 } > + > =A0 =A0 =A0 =A0while (s->appl_ptr < s->runtime->control->appl_ptr) { > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (bcom_queue_full(s->bcom_task)) > > -- = Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.