I have ported the LT9611UXC for audio with simple-sound-card in device tree.
The kernel device tree
\ {
sound-hdmi {
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,name = "lt9611uxc-hdmi";
simple-audio-card,bitclock-master = <&sound_master>;
simple-audio-card,frame-master = <&sound_master>;
sound_master: simple-audio-card,cpu {
sound-dai = <&sai3>;
};
simple-audio-card,codec {
sound-dai = <<9611uxc_codec>;
clocks = <&clk IMX93_CLK_SAI3_GATE>;
};
};
};
&sai3 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
assigned-clocks = <&clk IMX93_CLK_SAI3>;
assigned-clock-parents = <&clk IMX93_CLK_AUDIO_PLL>;
assigned-clock-rates = <24576000>;
fsl,sai-mclk-direction-output;
fsl,mode = "i2s-master";
status = "okay";
};
&iomuxc {
pinctrl_sai3: sai3grp {
fsl,pins = <
MX93_PAD_GPIO_IO26__SAI3_TX_SYNC 0x31e
MX93_PAD_GPIO_IO16__SAI3_TX_BCLK 0x31e
MX93_PAD_GPIO_IO17__SAI3_MCLK 0x31e
MX93_PAD_GPIO_IO19__SAI3_TX_DATA00 0x31e
MX93_PAD_GPIO_IO20__SAI3_RX_DATA00 0x31e
>;
};
};
while booting up and I can get the sound card device in aplay -l command
root@imx93evk:/music# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: lt9611uxchdmi [lt9611uxc-hdmi], device 0: 42660000.sai-i2s-hifi i2s-hifi-0 [42660000.sai-i2s-hifi i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
But I got this error when I want to play an audio file
root@imx93evk:/music# aplay Field_Day.wav
[ 866.394401] fsl-sai 42660000.sai: failed to derive required Tx rate: 1411200
[ 866.401478] fsl-sai 42660000.sai: ASoC: error at snd_soc_dai_hw_params on 42660000.sai: -22
ALSA lib /usr/src/debug/alsa-lib/1.2.10-r0/src/pcm/pcm_direct.c:1337:(snd1_pcm_direct_initialize_slave) unable to ins tall hw params
ALSA lib /usr/src/debug/alsa-lib/1.2.10-r0/src/pcm/pcm_dmix.c:1012:(snd_pcm_dmix_open) unable to initialize slave
aplay: main:834: audio open error: Invalid argument
What happened with this error ?
How can I change the SCLK value in the device tree ? Currently, I measured the value of SCLK is 1.536MHz, but I need it to be 3.072Mhz.
Please try to add like below:
sound_master: simple-audio-card,cpu {
sound-dai = <&sai3>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <16>;
};
Please try this:
&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>;
assigned-clock-parents = <&clk IMX93_CLK_AUDIO_PLL>;
assigned-clock-rates = <24576000>;
status = "okay";
};
There is still no sound while playing audio
root@imx93evk:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: lt9611uxchdmi [lt9611uxc-hdmi], device 0: 42660000.sai-i2s-hifi i2s-hifi-0 [42660000.sai-i2s-hifi i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
root@imx93evk:~# aplay -f dat /music/Field_Day.wav
Playing raw data '/music/Field_Day.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
root@imx93evk:~#
Please double check the setting in alsamixer.