[PATCH 0/6] Fixups to MPC5200 ASoC drivers

2009-11-07 Thread Grant Likely
Hi everyone, Jon, as we talked about earlier today, I've spent some time working on the MPC5200 AC97 driver to try and get rid of some of the nagging bugs. The two big changes that I ended up making were to remove the tracking of appl_ptr (and all the race conditions that went with it), and to fi

[PATCH 1/6] ASoC/mpc5200: Track DMA position by period number instead of bytes

2009-11-07 Thread Grant Likely
All DMA blocks are lined up to period boundaries, but the DMA handling code tracks bytes instead. This patch reworks the code to track the period index into the DMA buffer instead of the physical address pointer. Doing so makes the code simpler and easier to understand. Signed-off-by: Grant Like

[PATCH 2/6] ASoC/mpc5200: get rid of the appl_ptr tracking nonsense

2009-11-07 Thread Grant Likely
Sound drivers PCM DMA is supposed to free-run until told to stop by the trigger callback. The current code tries to track appl_ptr, to avoid stale buffer data getting played out at the end of the data stream. Unfortunately it also results in race conditions which can cause the audio to stall. Si

[PATCH 3/6] ASoC/mpc5200: Improve printk debug output for trigger

2009-11-07 Thread Grant Likely
Signed-off-by: Grant Likely --- sound/soc/fsl/mpc5200_dma.c | 15 ++- sound/soc/fsl/mpc5200_dma.h |1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index 4e47586..658e3fa 100644 --- a/sound/soc/fsl/mp

[PATCH 4/6] ASoC/mpc5200: add to_psc_dma_stream() helper

2009-11-07 Thread Grant Likely
Move the resolving of the psc_dma_stream pointer to a helper function to reduce duplicate code Signed-off-by: Grant Likely --- sound/soc/fsl/mpc5200_dma.c |7 +-- sound/soc/fsl/mpc5200_dma.h |9 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sound/soc/fsl/

[PATCH 5/6] ASoC/mpc5200: fix enable/disable of AC97 slots

2009-11-07 Thread Grant Likely
The MPC5200 AC97 driver is disabling the slots when a stop trigger is received, but not reenabling them if the stream is started again without processing the hw_params again. This patch fixes the problem by caching the slot enable bit settings calculated at hw_params time so that they can be reapp

[PATCH 6/6] ASoC/mpc5200: Add fudge factor to value reported by .pointer()

2009-11-07 Thread Grant Likely
ALSA playback seems to be more reliable if the .pointer() hook reports a value slightly into the period, rather than right on the period boundary. This patch adds a fudge factor of 1/4 the period size to better estimate the actual position of the DMA engine in the audio buffer. Signed-off-by: Gra

Re: [alsa-devel] [PATCH 1/6] ASoC/mpc5200: Track DMA position by period number instead of bytes

2009-11-07 Thread Liam Girdwood
On Sat, 2009-11-07 at 01:33 -0700, Grant Likely wrote: > All DMA blocks are lined up to period boundaries, but the DMA > handling code tracks bytes instead. This patch reworks the code > to track the period index into the DMA buffer instead of the > physical address pointer. Doing so makes the co

Re: [PATCH 2/6] ASoC/mpc5200: get rid of the appl_ptr tracking nonsense

2009-11-07 Thread Jon Smirl
On Sat, Nov 7, 2009 at 3:34 AM, Grant Likely wrote: > Sound drivers PCM DMA is supposed to free-run until told to stop > by the trigger callback.  The current code tries to track appl_ptr, > to avoid stale buffer data getting played out at the end of the > data stream.  Unfortunately it also resul

Re: [alsa-devel] [PATCH 4/6] ASoC/mpc5200: add to_psc_dma_stream() helper

2009-11-07 Thread Mark Brown
On Sat, Nov 07, 2009 at 01:34:31AM -0700, Grant Likely wrote: > +/* Utility for retrieving psc_dma_stream structure from a substream */ > +inline struct psc_dma_stream * > +to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma > *psc_dma) > +{ > + if (substream->pstr->stream =

Re: [alsa-devel] [PATCH 0/6] Fixups to MPC5200 ASoC drivers

2009-11-07 Thread Mark Brown
On Sat, Nov 07, 2009 at 01:33:40AM -0700, Grant Likely wrote: > However, I was able to reproduce the noise problem when using aplay > if I have DEBUG #defined at the top of the mpc5200_dma.c file with > debug console logs being spit out the serial port. In that situation, > the STOP trigger calls

Re: [PATCH 2/6] ASoC/mpc5200: get rid of the appl_ptr tracking nonsense

2009-11-07 Thread Jon Smirl
On Sat, Nov 7, 2009 at 7:51 AM, Jon Smirl wrote: > On Sat, Nov 7, 2009 at 3:34 AM, Grant Likely > wrote: >> Sound drivers PCM DMA is supposed to free-run until told to stop >> by the trigger callback.  The current code tries to track appl_ptr, >> to avoid stale buffer data getting played out at

Re: [alsa-devel] [PATCH 1/6] ASoC/mpc5200: Track DMA position by period number instead of bytes

2009-11-07 Thread Grant Likely
On Sat, Nov 7, 2009 at 3:35 AM, Liam Girdwood wrote: > On Sat, 2009-11-07 at 01:33 -0700, Grant Likely wrote: >> All DMA blocks are lined up to period boundaries, but the DMA >> handling code tracks bytes instead.  This patch reworks the code >> to track the period index into the DMA buffer instea

Re: [alsa-devel] [PATCH 0/6] Fixups to MPC5200 ASoC drivers

2009-11-07 Thread Grant Likely
On Sat, Nov 7, 2009 at 5:57 AM, Mark Brown wrote: > On Sat, Nov 07, 2009 at 01:33:40AM -0700, Grant Likely wrote: >> So, please test.  Let me know if these work or not.  I've don't know >> if the last patch (Add fudge factor...) is needed or not. > > I've applied patches 1-5 since they seem fairly

Re: [alsa-devel] [PATCH 6/6] ASoC/mpc5200: Add fudge factor to value reported by .pointer()

2009-11-07 Thread Mark Brown
On Sat, Nov 07, 2009 at 01:34:55AM -0700, Grant Likely wrote: > ALSA playback seems to be more reliable if the .pointer() hook reports > a value slightly into the period, rather than right on the period > boundary. This patch adds a fudge factor of 1/4 the period size > to better estimate the actu

Re: [alsa-devel] [PATCH 6/6] ASoC/mpc5200: Add fudge factor to value reported by .pointer()

2009-11-07 Thread Grant Likely
On Sat, Nov 7, 2009 at 11:11 AM, Mark Brown wrote: > On Sat, Nov 07, 2009 at 01:34:55AM -0700, Grant Likely wrote: >> ALSA playback seems to be more reliable if the .pointer() hook reports >> a value slightly into the period, rather than right on the period >> boundary.  This patch adds a fudge fa

Re: [PATCH 2/6] ASoC/mpc5200: get rid of the appl_ptr tracking nonsense

2009-11-07 Thread Grant Likely
On Sat, Nov 7, 2009 at 5:51 AM, Jon Smirl wrote: > On Sat, Nov 7, 2009 at 3:34 AM, Grant Likely > wrote: >> Sound drivers PCM DMA is supposed to free-run until told to stop >> by the trigger callback.  The current code tries to track appl_ptr, >> to avoid stale buffer data getting played out at

Re: [PATCH 2/6] ASoC/mpc5200: get rid of the appl_ptr tracking nonsense

2009-11-07 Thread Grant Likely
On Sat, Nov 7, 2009 at 6:04 AM, Jon Smirl wrote: > On Sat, Nov 7, 2009 at 7:51 AM, Jon Smirl wrote: >> On Sat, Nov 7, 2009 at 3:34 AM, Grant Likely >> wrote: >>> Sound drivers PCM DMA is supposed to free-run until told to stop >>> by the trigger callback.  The current code tries to track appl_p

Re: [alsa-devel] [PATCH 6/6] ASoC/mpc5200: Add fudge factor to value reported by .pointer()

2009-11-07 Thread Mark Brown
On Sat, Nov 07, 2009 at 11:19:54AM -0700, Grant Likely wrote: > On Sat, Nov 7, 2009 at 11:11 AM, Mark Brown > > It occurs to me that in terms of dealing with what's going on here this > > probably is achieving exactly the same effect as Jon's code in that it > > tells ALSA that things are a bit ah

Re: [alsa-devel] [PATCH 6/6] ASoC/mpc5200: Add fudge factor to value reported by .pointer()

2009-11-07 Thread Grant Likely
On Sat, Nov 7, 2009 at 12:33 PM, Mark Brown wrote: > On Sat, Nov 07, 2009 at 11:19:54AM -0700, Grant Likely wrote: >> On Sat, Nov 7, 2009 at 11:11 AM, Mark Brown > >> > It occurs to me that in terms of dealing with what's going on here this >> > probably is achieving exactly the same effect as Jon

Re: [alsa-devel] [PATCH 2/6] ASoC/mpc5200: get rid of the appl_ptr tracking nonsense

2009-11-07 Thread Mark Brown
On Sat, Nov 07, 2009 at 11:51:16AM -0700, Grant Likely wrote: > On Sat, Nov 7, 2009 at 5:51 AM, Jon Smirl wrote: > current period. My understanding of ALSA is that the application is > supposed to make sure there is enough silence in the buffer to handle > the lag between notification that the l

Re: [patch 09/16] powerpc: Replace old style lock initializer

2009-11-07 Thread Stephen Rothwell
Hi Ben, On Sat, 07 Nov 2009 09:55:44 +1100 Benjamin Herrenschmidt wrote: > > Looks reasonable. But iseries can be a bitch, so we do need to test it > on monday. It should be safe as the spinlocks cannot be access until after the following ppc_md pointer initialisations are done (and all this ha