On Thu, Sep 17, 2015 at 4:00 PM, James Cameron quozl@laptop.org wrote:
On Thu, Sep 17, 2015 at 03:40:33PM -0700, Caleb Crome wrote:
The more I think of this channel synchronization issue, the thorinier it gets.
Basically, with the TLV320AIC series of codecs, whenever any of the DAC or ADC channels are powered up on any codec, the MCLK needs to be stopped, all DACs/ADCs turned off, then configuration can happen, then all DACs/ADCs can be turned back on, then MCLK starts again. That's the only way to ensure phase/delay accuracy among several codecs.
So, going from play-only to play+record requires MCLK be stopped, then restarted.
Aye. Lots of clocks in lots of domains. Also pay penalty of any delays needed to stabilise ADCs.
Same general issue with many single codecs though, if capture vs playback synchronisation required.
Maybe it's not too terrible. Any thoughts?
In this scenario my preference would be to always configure the codecs and DMA for playback and capture, and do any gating higher in the stack; e.g. send zero samples if there is no playback stream, and discard samples if there is no capture stream.
Yes, this makes sense to me. This is for this sort of special case that I have where we have many synchronized codecs on the same bus. It's really just 1 clock that needs to be gated -- the MCLK.
Is there any way for the machine driver to handle this? Currently, the AIC3x driver uses a dapm control to turn the ADCs and DACs on and off. Can the machine driver currently get some sort of pre and post callback whenever particular controls are enabled?
I think to get through the day, I need to remove the SND_SOC_DAPM_ADC("Left ADC", ...) SND_SOC_DAPM_ADC("Right ADC", ...) SND_SOC_DAPM_DAC("Left ...") SND_SOC_DAPM_DAC("Right" lines in tlv320aic3x, and just hard-wire them somewhere so they are all always turned on. Then I can make sure to turn on the clocks only after all the codecs have been powered up and alsa thinks they are configured. I guess in the machine driver's trigger callback?
-Caleb
-- James Cameron http://quozl.linux.org.au/