SAI on i.MX8M Mini

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SAI on i.MX8M Mini

Jump to solution
9,985 Views
david_ochs1
Contributor III

Hi,

I am trying to interface a TI TLV320AIC3111 audio codec to an i.MX8M Mini EVK running Linux. I made a breakout board to get the SAI pins from the audio connector. The codec seems to register correctly as a sound card using the simple-card driver, but I can't see any activity on the SAI1_MCLK line, except during startup - maybe while it's being probed(?).

dmesg | grep "tlv":

[4.803023] tlv320aic31xx-codec 2-0018: ## aic31xx_i2c_probe: tlv320aic311x codec_type = 1
[ 4.803149] tlv320aic31xx-codec 2-0018: 2-0018 supply dummy not found, using dummy regulator
[ 4.811636] tlv320aic31xx-codec 2-0018: codec register 2-0018
[ 4.811652] tlv320aic31xx-codec 2-0018: ASoC: dai register 2-0018 #1
[ 4.811657] tlv320aic31xx-codec 2-0018: ASoC: dynamically register DAI 2-0018
[ 4.811662] tlv320aic31xx-codec 2-0018: ASoC: Registered DAI 'tlv320aic31xx-hifi'
[ 4.811668] tlv320aic31xx-codec 2-0018: ASoC: Registered codec 'tlv320aic31xx-codec.2-0018'
[ 5.696573] asoc-simple-card sound-tlv320aic311x: ASoC: binding 30010000.sai-tlv320aic31xx-hifi
[ 5.696686] tlv320aic31xx-codec 2-0018: ## aic31xx_codec_probe
[ 5.696813] asoc-simple-card sound-tlv320aic311x: ASoC: probe TI-TLV320AIC311x-Card dai link 0 late -2
[ 5.696820] asoc-simple-card sound-tlv320aic311x: ASoC: probe TI-TLV320AIC311x-Card dai link 0 late -1
[ 5.696825] asoc-simple-card sound-tlv320aic311x: ASoC: probe TI-TLV320AIC311x-Card dai link 0 late 0
[ 5.696840] asoc-simple-card sound-tlv320aic311x: ASoC: probe TI-TLV320AIC311x-Card dai link 0 late 1
[ 5.696844] asoc-simple-card sound-tlv320aic311x: ASoC: probe TI-TLV320AIC311x-Card dai link 0 late 2
[ 5.696853] tlv320aic31xx-codec 2-0018: ## aic31xx_set_dai_sysclk: clk_id = 0, freq = 12000000, dir = 0
[ 5.696871] tlv320aic31xx-codec 2-0018: ## aic31xx_set_dai_fmt: fmt = 0x1001
[ 5.696967] asoc-simple-card sound-tlv320aic311x: tlv320aic31xx-hifi <-> 30010000.sai mapping ok
[ 5.705813] asoc-simple-card sound-tlv320aic311x: ASoC: no source widget found for Microphone
[ 5.714360] asoc-simple-card sound-tlv320aic311x: ASoC: Failed to add route Microphone -> direct -> MIC1LM
[ 5.724038] asoc-simple-card sound-tlv320aic311x: ASoC: no DMI vendor name!
[ 5.731272] tlv320aic31xx-codec 2-0018: ## aic31xx_set_bias_level: 0 -> 1

dmesg | grep "sai":

[ 4.815854] fsl-sai 30010000.sai: ASoC: dai register 30010000.sai #1
[ 4.815861] fsl-sai 30010000.sai: ASoC: dynamically register DAI 30010000.sai
[ 4.815867] fsl-sai 30010000.sai: ASoC: Registered DAI '30010000.sai'
[ 4.815875] fsl-sai 30010000.sai: ASoC: platform register 30010000.sai
[ 4.815882] fsl-sai 30010000.sai: ASoC: Registered platform '30010000.sai'
[ 4.818087] fsl-sai 30030000.sai: ASoC: dai register 30030000.sai #1
[ 4.818093] fsl-sai 30030000.sai: ASoC: dynamically register DAI 30030000.sai
[ 4.818099] fsl-sai 30030000.sai: ASoC: Registered DAI '30030000.sai'
[ 4.818106] fsl-sai 30030000.sai: ASoC: platform register 30030000.sai
[ 4.818112] fsl-sai 30030000.sai: ASoC: Registered platform '30030000.sai'
[ 5.696573] asoc-simple-card sound-tlv320aic311x: ASoC: binding 30010000.sai-tlv320aic31xx-hifi
[ 5.696967] asoc-simple-card sound-tlv320aic311x: tlv320aic31xx-hifi <-> 30010000.sai mapping ok

aplay -l:

**** List of PLAYBACK Hardware Devices ****
card 0: TITLV320AIC311x [TI-TLV320AIC311x-Card], device 0: 30010000.sai-tlv320aic31xx-hifi tlv320aic31xx-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

aplay /unit_tests/ASRC/audio8k16S.wav:

Playing WAVE '/unit_tests/ASRC/audio8k16S.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo

There's nothing on the scope for the MCLK, or any other I2S lines, while the wav file is supposedly playing.

Here are the relevant entries from my device tree:

pinctrl_sai1: sai1grp {
fsl,pins = <
MX8MM_IOMUXC_SAI1_MCLK_SAI1_MCLK 0xd6
MX8MM_IOMUXC_SAI1_RXD7_SAI1_TX_DATA4 0xd6
MX8MM_IOMUXC_SAI1_TXC_SAI1_TX_BCLK 0xd6
MX8MM_IOMUXC_SAI1_TXD0_SAI1_TX_DATA0 0xd6
MX8MM_IOMUXC_SAI1_TXFS_SAI1_TX_SYNC 0xd6

>;
};

&sai1 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai1>;
assigned-clocks = <&clk IMX8MM_CLK_SAI1_SRC>,
<&clk IMX8MM_CLK_SAI1_DIV>;
assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
assigned-clock-rates = <0>, <12000000>;
/*fsl,sai-mclk-direction-output;*/
status = "okay";
};

sound-tlv320aic311x {
compatible = "simple-audio-card";
simple-audio-card,name = "TI-TLV320AIC311x-Card";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&codec_dai>;
simple-audio-card,frame-master = <&codec_dai>;
simple-audio-card,widgets =
"Microphone",
"Speaker";
simple-audio-card,routing =
"Speaker", "SPL", /*these are widget names mapped to options in the TI driver */
"Speaker", "SPR",
"MIC1LM","Microphone";
simple-audio-card,cpu {
sound-dai = <&sai1>;
};

codec_dai: simple-audio-card,codec {
sound-dai = <&tlv320aic311x>;
system-clock-frequency = <12000000>; /* this matches sai1 */
};
};

&i2c3 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c3>;
status = "okay";

...

tlv320aic311x: tlv320aic311x@18 {
#sound-dai-cells = <0>;
compatible = "ti,tlv320aic311x";
reg = <0x18>;
ai31xx-micbias-vg = <MICBIAS_2_0V>;
reset-gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>;
AVDD-supply = <&reg_audio_board>;
HPVDD-supply = <&reg_audio_board>;
SPRVDD-supply = <&reg_audio_board>;
SPLVDD-supply = <&reg_audio_board>;
IOVDD-supply = <&reg_audio_board>;
DVDD-supply = <&reg_audio_board>;
};
};

Any advice would be greatly appreciated!

Thanks,

Dave

Labels (1)
Tags (1)
0 Kudos
1 Solution
8,796 Views
david_ochs1
Contributor III

I figured this out: when I changed system-clock-frequency = <12000000>; to clocks = <&clk IMX8MM_CLK_SAI1_ROOT>; I started seeing activity on MCLK when I tried playing sound.

View solution in original post

0 Kudos
1 Reply
8,797 Views
david_ochs1
Contributor III

I figured this out: when I changed system-clock-frequency = <12000000>; to clocks = <&clk IMX8MM_CLK_SAI1_ROOT>; I started seeing activity on MCLK when I tried playing sound.

0 Kudos