On Mon, May 18, 2020 at 7:48 AM Daniel Baluta <daniel.baluta@xxxxxxx> wrote: > > Hi Tim, > > <snip> > Daniel, Thanks for the reply! > > >> I'm trying to get imx8mm sai working with a tlv320aic3x codec on a new board > >> and am finding that the sai3 bus clock is getting derived from the wrong source > >> leading hw_params() to fail with 'fsl-sai > >> 30030000.sai: failed to derive required Tx rate: 3072000' > >> > >> In comparison to the imx8mm-evk I find it's clock gets configured as desired yet > >> I have the same device-tree configuration for sai3. > > It is strange that setting sai3 works with wolfson codec but not yours. > > It should either work for both or for none. Well... it doesn't 'work' for the imx8mm-evk wm8524-audio as it hangs during playback (see below) yet it does get past negotiating the sai master clock. > > Anyhow, can you please try to create a more specific clock hierarchy > > similar with the on for 8mq (see imx8mq-evk.dts). > > > &sai2 { > » pinctrl-names = "default"; > » pinctrl-0 = <&pinctrl_sai2>; > » assigned-clocks = <&clk IMX8MQ_AUDIO_PLL1_BYPASS>, <&clk > IMX8MQ_CLK_SAI2>; > » assigned-clock-parents = <&clk IMX8MQ_AUDIO_PLL1>, <&clk > IMX8MQ_AUDIO_PLL1_OUT>; > » assigned-clock-rates = <0>, <24576000>; > » status = "okay"; > }; > Note that even though the imx8mm-evk appears to configure its clock > correctly I > > >> still have not been able to play audio out the wm8524 and the system appears > >> to hang during playback as if BCLK/MCLK were not clocking. > >> > >> Perhaps there is something not supported yet upstream with regards to > >> IMX8MM SAI? > >> > > > > I remember that wm8524 worked for me both with imx8mm/imx8mq. Can you sync > > at commit > > > commit 13f3b9fdef6c7d9ad069ae617707e5a10a685074 > Author: Daniel Baluta <daniel.baluta@xxxxxxx> > Date: Tue Jun 4 20:32:57 2019 +0800 > > and give it a try. looks like fsl-sai isn't supported yet in 13f3b9fdef6c7d9ad069ae617707e5a10a685074... used a860fac420971c5a90d4f78959b44ead793aee4f instead which has the sai driver but fails with: [ 2.579234] wm8524-codec audio-codec: simple-card: set_sysclk error [ 2.585512] asoc-simple-card sound-wm8524: ASoC: failed to init 30030000.sai-wm8524-hifi: -22 [ 2.594050] asoc-simple-card sound-wm8524: ASoC: failed to instantiate card -22 [ 2.601467] asoc_simple_probe err:-22 [ 2.605161] asoc-simple-card: probe of sound-wm8524 failed with error -22 Can you please sync up with mainline and take a look? > > > Also, what SDMA firmware are you using? That might be a problem. I don't > remember > > if the default ROM firmware worked. > I've tried the default as well as that from https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.0.bin which shows as firmware 4.4: # dmesg | grep imx-sdma [ 2.037854] imx-sdma 302c0000.dma-controller: loaded firmware 4.4 [ 2.042705] imx-sdma 302b0000.dma-controller: loaded firmware 4.4 [ 2.049132] imx-sdma 30bd0000.dma-controller: loaded firmware 4.4 I ended up working around this on my board by making the tlv320aic3x the master. I do recall reading someplace that using the codec as the master is a better choice anyway as it provides better clk per sample-rate matching... is this true? I'm not clear which option to pick in general. So in summary I have my imx8mm board working using codec as master but imx8mm-evk in mainline does not work currently, at least 5.7-rc4 which is what I tested. Thanks, Tim