Enabling fsl_sai MCLK before codec probe
![](https://secure.gravatar.com/avatar/d6ecf9a134dcc695d5609884953c8f01.jpg?s=120&d=mm&r=g)
So I have a tricky race condition that comes up with hardware that combines imx8 with a pcm1681 codec. The pcm1681 requires that MCLK be enabled for 65536 cycles before accessing the I2C management port.
The imx8 sai driver on the other hand does not start the built in MCLK until a confluence of events that is not triggered until just before streaming starts which is too late.
Is there a clean way to start the imx8 sai MCLK before the codec probe occurs? Or have it started and delayed during the codec probe before it tries to access i2c?
We have a working solution but it is a bit overreaching and adds a callback function to the snd_soc_dai_ops struct to start the clock, and adds the code to the fsl_sai.c to toggle the appropriate bits in the SoC sai driver to make a clock appear and registers to the new function callback.
Then the simple-card was amended to add the appropriate enabling through the new callback such that the clock is on long enough before the codec is probed.
There was some suggestion of caching the i2c registers until the clock is enabled but this would be difficult given the clock is not started until streaming starts and we don't want to stream until the codec is initialized.
I am looking for a solution that is minimal and robust.
Any pointers would be greatly appreciated.
participants (1)
-
Michael Welling