TLV320AIC34 audio codec with IMX8MP SoM

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

TLV320AIC34 audio codec with IMX8MP SoM

Jump to solution
1,560 Views
mathad22
Contributor III

Hi,

I would like to connect my Variscite DT8M Custom Board with the TLV320AIC34 Evaluation Module by using an I2S connection.

For an unknow reason I cannot see SAI2_MCLK1 working properly, the value is always '0' on my oscilloscope, therefore when I try to play audio, aplay seems to be blocked.

HW configuration :

 

SAI vs Codec
SAI2_TXC <-> BCLK
SAI2_TXFS <-> WCLK
SAI2_MCLK <-> MCLK
SAI2_RXD0 <-> DIN
SAI2_TXD0 <-> DOUT

 

 

My device tree configuration :

 

	reg_audio_1v8: regulator-1p8v {
		compatible = "regulator-fixed";
		regulator-name = "1P8V";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		regulator-always-on;
	};

	sound-tlv320aic34 {
	compatible = "simple-audio-card";
		simple-audio-card,name = "HTC2-Sound-Card";
		simple-audio-card,format = "i2s";
		simple-audio-card,bitclock-master = <&dailink0_master>;
		simple-audio-card,frame-master = <&dailink0_master>;
		simple-audio-card,widgets =
			"Microphone", "Microphone Jack",
			"Line", "Line In Jack",
			"Line", "Line Out Jack",
			"Headphone", "Headphone Jack",
			"Speaker", "Speaker External";
		simple-audio-card,routing =
			"MIC3L", "Microphone Jack",
			"MIC3R", "Microphone Jack",
			"Headphone Jack", "HPLOUT",
			"Headphone Jack", "HPROUT";
		simple-audio-card,cpu {
			sound-dai = <&sai2 0>;
		};
		dailink0_master: simple-audio-card,codec {
			sound-dai = <&tlv320aic34>;
		};
	};
};

&sai2 {
	#sound-dai-cells = <1>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_sai2>;
	clocks = <&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI2_IPG>, <&clk IMX8MP_CLK_DUMMY>, <&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI2_MCLK1>, <&clk IMX8MP_CLK_DUMMY>, <&clk IMX8MP_CLK_DUMMY>, <&clk IMX8MP_AUDIO_PLL1_OUT>, <&clk IMX8MP_AUDIO_PLL2_OUT>;
	clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3", "pll1", "pll2";
	assigned-clocks = <&clk IMX8MP_CLK_SAI2>;
	assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL2_OUT>;
	assigned-clock-rates = <12000000>;
	fsl,sai-asynchronous;
	fsl,sai-mclk-direction-output;
 	status = "okay";
};

pinctrl_sai2: sai2grp {
	fsl,pins = <
		MX8MP_IOMUXC_SAI2_TXFS__AUDIOMIX_SAI2_TX_SYNC			0xd6
		MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI2_TX_BCLK			0xd6
		MX8MP_IOMUXC_SAI2_RXD0__AUDIOMIX_SAI2_RX_DATA00			0xd6
		MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI2_TX_DATA00			0xd6
		MX8MP_IOMUXC_SAI2_MCLK__AUDIOMIX_SAI2_MCLK			 0xd6
	>;
};

 

 

i2cdump :

 

root@imx8mp-var-dart:~# i2cdump -y -f 2 0x18
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 00 10 04 00 00 00 00 00 00 01 00 00 00 80    ...??......?...?
10: 80 ff ff 78 78 78 78 78 78 06 00 fe 00 00 fe 00    ?..xxxxxx?.?..?.
20: 00 00 00 00 00 00 00 00 00 00 00 80 80 00 00 00    ...........??...
30: 00 00 00 04 00 00 00 00 00 00 04 00 00 00 00 00    ...?......?.....
40: 00 04 00 00 00 00 00 00 04 00 00 00 00 00 00 00    .?......?.......
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00    ......?.........
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
80: 00 00 00 10 04 00 00 00 00 00 00 01 00 00 00 80    ...??......?...?
90: 80 ff ff 78 78 78 78 78 78 06 00 fe 00 00 fe 00    ?..xxxxxx?.?..?.
a0: 00 00 00 00 00 00 00 00 00 00 00 80 80 00 00 00    ...........??...
b0: 00 00 00 04 00 00 00 00 00 00 04 00 00 00 00 00    ...?......?.....
c0: 00 04 00 00 00 00 00 00 04 00 00 00 00 00 00 00    .?......?.......
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
e0: 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00    ......?.........
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

 

 

/sys/clk/kernel/debug/clk_summary :

 

    audio_pll2_ref_sel                0        0        0    24000000          0     0  50000
       audio_pll2                     0        0        0   361267200          0     0  50000
          audio_pll2_bypass           0        0        0   361267200          0     0  50000
             audio_pll2_out           0        0        0   361267200          0     0  50000
                sai2                  0        0        0    12042240          0     0  50000
                   sai2_mclk1_sel       0        0        0    12042240          0     0  50000
                      sai2_mclk1_clk       0        0        0    12042240          0     0  50000

 

 

Any idea that could help ? I've tried many things but the SAI2_MCLK1 is still not moving.

0 Kudos
1 Solution
1,545 Views
mathad22
Contributor III

sound-tlv320aic34 {
compatible = "simple-audio-card";
simple-audio-card,name = "HTC2-Sound-Card";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&dailink_master>;
simple-audio-card,frame-master = <&dailink_master>;
simple-audio-card,mclk-fs = <256>;
simple-audio-card,widgets =
"Microphone", "Microphone Jack",
"Line", "Line In Jack",
"Line", "Line Out Jack",
"Headphone", "Headphone Jack",
"Speaker", "Speaker External";
simple-audio-card,routing =
"Headphone Jack", "HPLOUT",
"Headphone Jack", "HPROUT";
dailink_master: simple-audio-card,cpu {
sound-dai = <&sai2>;
};
simple-audio-card,codec {
sound-dai = <&tlv320aic34>;
clocks = <&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI2_MCLK1>;
};
};
};

&sai2 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai2>;
assigned-clocks = <&clk IMX8MP_CLK_SAI2>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <12288000>;
clocks = <&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI2_IPG>, <&clk IMX8MP_CLK_DUMMY>,
<&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI2_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
<&clk IMX8MP_CLK_DUMMY>, <&clk IMX8MP_AUDIO_PLL1_OUT>,
<&clk IMX8MP_AUDIO_PLL2_OUT>;
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3", "pll8k", "pll11k";
fsl,sai-synchronous-rx;
status = "okay";
};

 

&i2c3 {
tlv320aic34: tlv320aic34@18 {
#sound-dai-cells = <0>;
compatible = "ti,tlv320aic3x";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_tlv320>;
reg = <0x18>;
reset-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
IOVDD-supply = <&reg_audio>; /* 3V3 */
DVDD-supply = <&reg_audio_1v8>; /* 1V8 */
AVDD-supply = <&reg_audio>; /* 3V3 */
DRVDD-supply = <&reg_audio>; /* 3V3 */
};
};

pinctrl_sai2: sai2grp {
fsl,pins = <
MX8MP_IOMUXC_SAI2_MCLK__AUDIOMIX_SAI2_MCLK 0xd6
MX8MP_IOMUXC_SAI2_RXD0__AUDIOMIX_SAI2_RX_DATA00 0xd6
MX8MP_IOMUXC_SAI2_RXFS__AUDIOMIX_SAI2_RX_SYNC 0xd6
MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI2_TX_BCLK 0xd6
MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI2_TX_DATA00 0xd6
>;
};

pinctrl_tlv320: tlv320grp {
fsl,pins = <
MX8MP_IOMUXC_GPIO1_IO06__GPIO1_IO06 0x16
>;
};

View solution in original post

0 Kudos
1 Reply
1,546 Views
mathad22
Contributor III

sound-tlv320aic34 {
compatible = "simple-audio-card";
simple-audio-card,name = "HTC2-Sound-Card";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&dailink_master>;
simple-audio-card,frame-master = <&dailink_master>;
simple-audio-card,mclk-fs = <256>;
simple-audio-card,widgets =
"Microphone", "Microphone Jack",
"Line", "Line In Jack",
"Line", "Line Out Jack",
"Headphone", "Headphone Jack",
"Speaker", "Speaker External";
simple-audio-card,routing =
"Headphone Jack", "HPLOUT",
"Headphone Jack", "HPROUT";
dailink_master: simple-audio-card,cpu {
sound-dai = <&sai2>;
};
simple-audio-card,codec {
sound-dai = <&tlv320aic34>;
clocks = <&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI2_MCLK1>;
};
};
};

&sai2 {
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai2>;
assigned-clocks = <&clk IMX8MP_CLK_SAI2>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <12288000>;
clocks = <&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI2_IPG>, <&clk IMX8MP_CLK_DUMMY>,
<&audiomix_clk IMX8MP_CLK_AUDIOMIX_SAI2_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
<&clk IMX8MP_CLK_DUMMY>, <&clk IMX8MP_AUDIO_PLL1_OUT>,
<&clk IMX8MP_AUDIO_PLL2_OUT>;
clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3", "pll8k", "pll11k";
fsl,sai-synchronous-rx;
status = "okay";
};

 

&i2c3 {
tlv320aic34: tlv320aic34@18 {
#sound-dai-cells = <0>;
compatible = "ti,tlv320aic3x";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_tlv320>;
reg = <0x18>;
reset-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
IOVDD-supply = <&reg_audio>; /* 3V3 */
DVDD-supply = <&reg_audio_1v8>; /* 1V8 */
AVDD-supply = <&reg_audio>; /* 3V3 */
DRVDD-supply = <&reg_audio>; /* 3V3 */
};
};

pinctrl_sai2: sai2grp {
fsl,pins = <
MX8MP_IOMUXC_SAI2_MCLK__AUDIOMIX_SAI2_MCLK 0xd6
MX8MP_IOMUXC_SAI2_RXD0__AUDIOMIX_SAI2_RX_DATA00 0xd6
MX8MP_IOMUXC_SAI2_RXFS__AUDIOMIX_SAI2_RX_SYNC 0xd6
MX8MP_IOMUXC_SAI2_TXC__AUDIOMIX_SAI2_TX_BCLK 0xd6
MX8MP_IOMUXC_SAI2_TXD0__AUDIOMIX_SAI2_TX_DATA00 0xd6
>;
};

pinctrl_tlv320: tlv320grp {
fsl,pins = <
MX8MP_IOMUXC_GPIO1_IO06__GPIO1_IO06 0x16
>;
};

0 Kudos