IMX8MP TLV320AIC3101 codec issues

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

IMX8MP TLV320AIC3101 codec issues

415件の閲覧回数
petertseng
Contributor IV

Hi

I'm currently using i.MX Linux Yocto BSP (mickledore-6.1.22-2.0.0)

And I try to porting TLV320AIC3101 to IMX8MP processor.

In the hardware circuit, MCLK of TLV320AIC3101 is not used.

I can already detect the sound card

 $ cat /proc/asound/cards
 0 [TLV320AIC3101  ]: simple-card - TLV320AIC3101
                      TLV320AIC3101
 1 [audiohdmi      ]: audio-hdmi - audio-hdmi
                      audio-hdmi

When I am trying to play audio

 $ aplay -D hw:0 /usr/share/sounds/alsa/Front_Left.wav

I am getting following error :

[  138.854902] tlv320aic31xx-codec 1-0018: aic31xx_set_dai_sysclk: Unsupported frequency 0
[  138.865847] tlv320aic31xx-codec 1-0018: ASoC: error at snd_soc_dai_set_sysclk on tlv320aic31xx-hifi: -22

 

Here I attached my DTS tree

	sound-tlv320aic310x {
		compatible = "simple-audio-card";
		simple-audio-card,name = "TLV320AIC3101";
		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 =
			"Headphone", "Headphone Jack";

		simple-audio-card,routing =
			"Headphone Jack", "HPL",
			"Headphone Jack", "HPR";

		dailink_master: simple-audio-card,cpu {
			sound-dai = <&sai3>;
		};

		simple-audio-card,codec {
			sound-dai = <&codec>;
			clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>;
		};
	};

&i2c2 {
	clock-frequency = <400000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c2>;
	status = "okay";

	/* TLV320AIC3101 */
	codec: tlv320aic3101@18 {
		#sound-dai-cells = <0>;
		compatible = "ti,tlv320aic310x";
		reg = <0x18>;
		HPVDD-supply = <&buck4>;
		SPRVDD-supply = <&reg_audio_pwr>;
		SPLVDD-supply = <&reg_audio_pwr>;
		IOVDD-supply = <&buck5>;
		DVDD-supply = <&buck5>;
		AVDD-supply = <&buck4>;
	};
};

&sai3 {
	#sound-dai-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_sai3>;
	assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
	assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
	assigned-clock-rates = <12288000>;
	clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_IPG>, <&clk IMX8MP_CLK_DUMMY>,
			<&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_SAI3_MCLK1>, <&clk IMX8MP_CLK_DUMMY>,
			<&clk IMX8MP_CLK_DUMMY>;
	clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
	//fsl,sai-mclk-direction-output;
	status = "okay";
};


	pinctrl_sai3: sai3grp {
		fsl,pins = <
			MX8MP_IOMUXC_NAND_DATA01__AUDIOMIX_SAI3_TX_SYNC		0xd6	/* AUD_TXFS */
			MX8MP_IOMUXC_NAND_ALE__AUDIOMIX_SAI3_TX_BCLK		0xd6	/* AUD_TXC */
			MX8MP_IOMUXC_NAND_CE0_B__AUDIOMIX_SAI3_TX_DATA00	0xd6	/* AUD_TXD */
		>;
	};

 

Anything I am missing out in dts tree.

Please help me in resolving this error

Thanks in advance,

 

Best Regards
Peter

 

0 件の賞賛
返信
2 返答(返信)

395件の閲覧回数
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

 

The TLV320AIC3100 audio CODEC is not supported by default on our BSP. To use this CODEC to your system, you need to add a third-party driver provided by Texas Instruments and configure your device tree.

 

Unfortunately, there is no a guide to port this specific CODEC to the BSP. The references we have are the i.MX porting guide and EVK device tree (WM8960).

 

Maybe these threads could be helpful:

 

Verdin imx8mm with sound codec TLV320DAC3100

 

TLV320AIC3100: CLOCK Frequency issue

 

Best regards.

0 件の賞賛
返信

384件の閲覧回数
petertseng
Contributor IV

Hi JorgeCas,

Sorry I used the wrong driver before.

Here I attach my changed DTS tree

&i2c2 {
	clock-frequency = <400000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c2>;
	status = "okay";

	codec: tlv320aic3101@18 {
		#sound-dai-cells = <0>;
		compatible = "ti,tlv320aic3x";
		reg = <0x18>;
		AVDD-supply = <&buck4>;
		IOVDD-supply = <&buck5>;
		DRVDD-supply = <&reg_audio_pwr>;
		DVDD-supply = <&buck5>;
	};
};

 

Then I tried to add TLV320AIC3101 in /sound/soc/fsl/fsl-asoc-card.c

--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -807,6 +807,15 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
 		codec_dai_name = "tlv320aic32x4-hifi";
 		priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
 		priv->card_type = CARD_TLV320AIC32X4;
+	} else if (of_device_is_compatible(np, "fsl,imx-audio-tlv320aic3x")) {
+		codec_dai_name = "tlv320aic3x-hifi";
+		priv->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
+		priv->dai_link[1].dpcm_capture = 0;
+		priv->dai_link[2].dpcm_capture = 0;
+		priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT;
+		priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT;
+		priv->card.dapm_routes = audio_map_tx;
+		priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx);
 	} else if (of_device_is_compatible(np, "fsl,imx-audio-tlv320aic31xx")) {
 		codec_dai_name = "tlv320dac31xx-hifi";
 		priv->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
@@ -1186,6 +1195,7 @@ static const struct of_device_id fsl_asoc_card_dt_ids[] = {
 	{ .compatible = "fsl,imx-audio-cs42888", },
 	{ .compatible = "fsl,imx-audio-cs427x", },
 	{ .compatible = "fsl,imx-audio-tlv320aic32x4", },
+	{ .compatible = "fsl,imx-audio-tlv320aic3x", },
 	{ .compatible = "fsl,imx-audio-tlv320aic31xx", },
 	{ .compatible = "fsl,imx-audio-sgtl5000", },
 	{ .compatible = "fsl,imx-audio-wm8962", },

Device Tree

	sound-tlv320aic310x {
		compatible = "fsl,imx-audio-tlv320aic3x";
		model = "tlv320aic3x-hifi";
		audio-cpu = <&sai3>;
		audio-codec = <&codec>;
		audio-routing =
			"Headphone Jack", "HPLOUT",
			"Headphone Jack", "HPROUT";
		mclk-id = <2>;
	};

 

The sound card can also be detected after turning on.

 $ cat /proc/asound/cards
 0 [audiohdmi      ]: audio-hdmi - audio-hdmi
                      audio-hdmi
 1 [tlv320aic3xhifi]: tlv320aic3x-hif - tlv320aic3x-hifi
                      tlv320aic3x-hifi

 

When I am trying to play audio

 $ aplay -D hw:0 /usr/share/sounds/alsa/Front_Left.wav

I am getting following error :

Playing WAVE '/usr/share/sounds/alsa/Front_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: set_params:1358: Channels count non available

 

Where did the error occur?
please help me

 

Best Regards
Peter

0 件の賞賛
返信