Currently, I am able to enable SAI0 and play audio at multiples of 48 kHz on it using this device tree overlay:
fragment@4000 {
target = <&sai0>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai0>;
#sound-dai-cells = <0>;
clocks = <&clk IMX8QM_AUD_SAI_0_IPG>,
<&clk IMX8QM_CLK_DUMMY>, // SAI does not have MCLK0 input
<&clk IMX8QM_AUD_SAI_0_MCLK>,
<&clk IMX8QM_CLK_DUMMY>,
<&clk IMX8QM_CLK_DUMMY>;
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
assigned-clocks = <&clk IMX8QM_AUD_PLL0_DIV>,
<&clk IMX8QM_AUD_ACM_AUD_PLL_CLK0_DIV>,
<&clk IMX8QM_AUD_ACM_AUD_REC_CLK0_DIV>,
<&clk IMX8QM_AUD_SAI_0_MCLK>;
assigned-clock-rates = <786432000>, <49152000>, <12288000>, <49152000>;
fsl,sai-asynchronous;
fsl,txm-rxs;
status = "okay";
};
};
I would also like to support multiples of 44.1 kHz. The SAI driver will choose the best MCLK among its 4 MCLK device tree entries, so this should be possible if I add the proper entry to the clocks list.
I tried using IMX8QM_AUD_ACM_AUD_PLL_CLK1_DIV (which I have set to be the appropriate frequency in the device tree) for "mclk2". When I try to play at 44.1 kHz, the SAI driver chooses that MCLK and I see that it is turned on and in use in /sys/kernel/debug/clk/clk_summary; however, the SAI hardware does not output anything and eventually ALSA times out with an input/output error.
QUESTIONS:
1. Is it the case that on the i.MX8QM, the SAI functional unit has only one of its 3 MCLK inputs actually connected to a clock source?
2. How can I configure the device tree so that the appropriate MCLK will be provided when requested?
3. Is there a way to have the driver automatically configure the IMX8QM_AUD_SAI_0_MCLK to choose either audio PLL 0 or audio PLL 1 as its source?
Thanks for your help!