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 printk(), and a stale sample can be heard at the end of playback. However, I believe this is a bug with the serial console driver (in that it disables IRQs for a long time) causing unbounded latencies, so the trigger doesn't get processed fast enough.
Yes, that will always be a problem with free running DMA - if it's not shut down quickly enough then it'll just keep processing data. Serial ports don't tend to play well with instrumenting it, sadly.
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 clear code cleanups and fixes. If they've introduced any problems we can fix them incrementally. I'll wait to see what the outcome of testing is for patch 6.
As I mentioned on IRC testing with PulseAudio would be good for this - it makes more demands on the quality of the DMA implementation than most applications.