I'm having a hard time correctly configuring the sai link between the imx and the codec under linux.
The codec is an AK4619, used in 4 channels TDM mode. Playback is ok at 48KHz / 32 bits TDM mode, MSB first and MSB justified.
For capture, the AK4619 only supports 24 bits. The data is MSB justified, which means that non significant bits comes after the relevant bits (significative bits are 8-31). On the other side, the sai sets the FBT to 23, which means that the significative bits are 0-23.
I tried to find the relevant settings, but could not. I understand that FBT tells where the relevant data starts, but i can't find which register sets the data size (which, in my case, is 24, as opposed to the word size which is 32).
What register needs to be set, or what config must be set in the device tree ? Here's the relevant config i actually use :
&sai3 {
#sound-dai-cells = <0>;
clocks = <&clk IMX93_CLK_SAI3_IPG>, <&clk IMX93_CLK_DUMMY>,
<&clk IMX93_CLK_SAI3_GATE>, <&clk IMX93_CLK_DUMMY>,
<&clk IMX93_CLK_DUMMY>, <&clk IMX93_CLK_AUDIO_PLL>;
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3", "pll8k";
assigned-clocks = <&clk IMX93_CLK_SAI3>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
assigned-clock-parents = <&clk IMX93_CLK_AUDIO_PLL>;
assigned-clock-rates = <24576000>;
fsl,sai-mclk-direction-output;
fsl,sai-asynchronous;
status = "okay";
};
simple-audio-card,dai-link {
link-name = "AK-4CHANNELS";
format = "i2s";
dai-tdm-slot-num = <4>;
dai-tdm-slot-width = <32>;
fsl,mclk-equal-bclk;
cpu {
sound-dai = <&sai3>;
dai-tdm-slot-num = <4>;
dai-tdm-slot-width = <32>;
assigned-clocks = <&clk IMX93_CLK_SAI3>;
};
codec {
sound-dai = <&ak4619>;
system-clock-frequency = <24576000>;
assigned-clocks = <&clk IMX93_CLK_SAI3>;
dai-tdm-slot-num = <4>;
dai-tdm-slot-width = <32>;
};
};I've checked with a scope, and the data on the sai line looks correct.
Any hints on this would be really appreciated.