AnsweredAssumed Answered

Cannot have working SAI on iMX7D

Question asked by Jean-Baptiste MARIE on Jul 20, 2020
Latest reply on Jul 22, 2020 by Jean-Baptiste MARIE

Hello, 

 

I am trying to configure SAI1 of the iMX7 to be used with an external codec.

 

Interesting part of my device tree is shown below:

sound {
compatible = "simple-audio-card";
status = "okay";
simple-audio-card,name = "My sound card";
simple-audio-card,format = "i2s";
clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
assigned-clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_SRC>,
<&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
assigned-clock-rates = <0>, <24576000>;
mclk-fs = <512>;
simple-audio-card,cpu {
sound-dai = <&sai1>;
};
simple-audio-card,codec {
sound-dai = <&my_external_codec>;
};
};

...

&sai1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai1>;
assigned-clocks = <&clks IMX7D_SAI1_ROOT_SRC>,
<&clks IMX7D_SAI1_ROOT_CLK>;
assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
assigned-clock-rates = <0>, <24576000>;
status = "okay";
};

 

I am trying to play a 48kHz audio file with aplay and it always fails with this error:

aplay: set_params:1403: Unable to install hw params:

Going deeper into the code, it seems the problem comes in clk.c:

clk_calc_new_rates

That function is called when the DAI is configured:

ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk,
SND_SOC_CLOCK_OUT);

The clk_calc_new_rates fails as "parent" is not defined when the function is called, and no callback are defined for the "derterminate_rate" and "round_rate" functions for the clock. 

 

Kernel version is 4.14

 

I do not see what is wrong in my configuration, am i missing something?

 

Thanks for your help.

Outcomes