I'm trying to get the SAI3 working with ALSA compatible under Linux 5.4.70.
The plan is that SAI3 will be a master (generate mclk, bclk and frame sync) and I can use aplay to list the sound card and play the wav file.
Not yet go far to check the mclk, but I face lot of probing simple audio card issue.
Below shows my configuration in DTS & DTSI
sound-tas2562 {
compatible = "simple-audio-card";
simple-audio-card,name = "tas2562 sound card";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-inversion;
simple-audio-card,frame-master = <&tas2562cpu>;
simple-audio-card,bitclock-master = <&tas2562cpu>;
tas2562cpu: simple-audio-card,cpu {
sound-dai = <&sai3 1>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <16>;
};
simple-audio-card,codec {
sound-dai = <&audio_amp>;
};
};
audio_amp: tas2562@4c {
#sound-dai-cells = <0>;
compatible = "ti,tas2562";
reg = <0x4c>;
ti,imon-slot-no = <0>;
};
&sai3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
assigned-clocks = <&clk IMX8MN_CLK_SAI3>;
assigned-clock-parents = <&clk IMX8MN_AUDIO_PLL1_OUT>;
assigned-clock-rates = <24576000>;
status = "okay";
};
sai3: sai@30030000 {
#sound-dai-cells = <1>;
compatible = "fsl,imx8mm-sai", "fsl,imx8mq-sai", "fsl,imx6sx-sai";
reg = <0x30030000 0x10000>;
interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX8MN_CLK_SAI3_IPG>,
<&clk IMX8MN_CLK_DUMMY>,
<&clk IMX8MN_CLK_SAI3_ROOT>,
<&clk IMX8MN_CLK_DUMMY>, <&clk IMX8MN_CLK_DUMMY>;
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
dmas = <&sdma2 4 2 0>, <&sdma2 5 2 0>;
dma-names = "rx", "tx";
};
Question1. if i.mx8m nano is the mclk master, does the frame-master & bitclock-master point to cpu or codec ?
simple-audio-card,frame-master = <&tas2562cpu>;
simple-audio-card,bitclock-master = <&tas2562cpu>;
tas2562cpu: simple-audio-card,cpu {
sound-dai = <&sai3 1>;
simple-audio-card,codec {
sound-dai = <&audio_amp>;
Question2. I noted lots of different combinations discussion, but I got different error of simple sound card insertion.
Below shows 3 cases.
What is the relationship of #sound-dai-cells between SAI3 and TAS2562 ?
Also, what is the relationship between "SAI3 #sound-dai-cells = <1>" and "simple-audio-card,cpu sound-dai = <&sai3 1>"
CASE#1. cpu sound-dai=0, sai3 #sound-dai-cells = <0>
sound-tas2562 {
tas2562cpu: simple-audio-card,cpu {
sound-dai = <&sai3>;
simple-audio-card,codec {
sound-dai = <&audio_amp>;
audio_amp: tas2562@4c {
#sound-dai-cells = <0>;
sai3: sai@30030000 {
#sound-dai-cells = <0>;
root@imx8mnevk:~# dmesg|grep tas2562
[ 1.993960] asoc-simple-card sound-tas2562: simple_for_each_link failed: -517
[ 2.579746] tas2562 1-004c: probe()
[ 2.583267] tas2562 1-004c: Property ti,imon-slot-no is missing setting default slot
[ 2.591029] tas2562 1-004c: Property ti,vmon-slot-no is missing setting default slot
[ 2.598861] tas2562 1-004c: tas2562_probe() success
[ 2.928771] tas2562 1-004c: ASoC: failed to probe component -6
[ 2.934711] asoc-simple-card sound-tas2562: ASoC: failed to instantiate card -6
CASE#2. cpu sound-dai=0, sai3 #sound-dai-cells = <1>
sound-tas2562 {
tas2562cpu: simple-audio-card,cpu {
sound-dai = <&sai3 0>;
simple-audio-card,codec {
sound-dai = <&audio_amp>;
audio_amp: tas2562@4c {
#sound-dai-cells = <0>;
sai3: sai@30030000 {
#sound-dai-cells = <1>;
root@imx8mnevk:~# dmesg|grep tas2562
[ 1.979364] asoc-simple-card sound-tas2562: simple_for_each_link failed: -517
[ 2.801384] tas2562 1-004c: probe()
[ 2.804915] tas2562 1-004c: Property ti,imon-slot-no is missing setting default slot
[ 2.812667] tas2562 1-004c: Property ti,vmon-slot-no is missing setting default slot
[ 2.820492] tas2562 1-004c: tas2562_probe() success
[ 3.142192] tas2562 1-004c: ASoC: failed to probe component -6
[ 3.148135] asoc-simple-card sound-tas2562: ASoC: failed to instantiate card -6
CASE#3. cpu sound-dai=1, sai3 #sound-dai-cells = <1>
sound-tas2562 {
tas2562cpu: simple-audio-card,cpu {
sound-dai = <&sai3 1>;
simple-audio-card,codec {
sound-dai = <&audio_amp>;
audio_amp: tas2562@4c {
#sound-dai-cells = <0>;
sai3: sai@30030000 {
#sound-dai-cells = <1>;
root@imx8mnevk:~# dmesg|grep tas2562
[ 1.991739] asoc-simple-card sound-tas2562: simple_for_each_link failed: -517
[ 2.581015] tas2562 1-004c: probe()
[ 2.584545] tas2562 1-004c: Property ti,imon-slot-no is missing setting default slot
[ 2.592308] tas2562 1-004c: Property ti,vmon-slot-no is missing setting default slot
[ 2.600133] tas2562 1-004c: tas2562_probe() success
[ 2.930762] asoc-simple-card sound-tas2562: simple_for_each_link failed: -22
[ 2.937832] asoc-simple-card sound-tas2562: parse error -22
[ 2.943437] asoc-simple-card: probe of sound-tas2562 failed with error -22
已解决! 转到解答。
Hi Igor,
I see the sound card on my target board after HW i2c issue was fixed.
Keep going working on i2s MCLK, BCLK reviews.
root@imx8mnddr4evk:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: tas2562sound [tas2562-sound], device 0: 30030000.sai-tas2562-amplifier tas2562-amplifier-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
Hi Luke
for simple-audio-card example one can look at
https://community.nxp.com/t5/i-MX-Processors/SAI-on-i-MX8M-Mini/m-p/959805
Seems "sound-dai-cells" parameter is specific to used codec as one can find in linux documentation:
https://bootlin.com/blog/eight-channels-audio-on-i-mx7-with-pcm3168/
Best regards
igor
Hi Igor,
Thanks for the INFO.
I had reviewed the tas2562 i2c was not working properly, so simple-audio-card couldn't recognize codec INFO when it's trying to rebind the codec.
It seems simple-audio-card has done the job well so far.
Let me fix the hardware issue before look into the simple-audio-card configuration again!
I will get back to feedback soon!
Thank you!
Hi Igor,
I see the sound card on my target board after HW i2c issue was fixed.
Keep going working on i2s MCLK, BCLK reviews.
root@imx8mnddr4evk:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: tas2562sound [tas2562-sound], device 0: 30030000.sai-tas2562-amplifier tas2562-amplifier-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0