Unable to enable TLV320AIC3104 codec driver with SAI2 BCLK/MCLK provided with external clock

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

Unable to enable TLV320AIC3104 codec driver with SAI2 BCLK/MCLK provided with external clock

2,282件の閲覧回数
Amrun
Contributor I
Hi,

I am trying to access codec driver (TLV320AIC3104) connected to iMX8M over I2C3 and SAI2 lines. The codec clocks bclk is 4096000 and it is provided from an FPGA and its mclk is grounded. iMx8M SOM SAI2 BCLk& MCLK is connected to clock line provided by FPGA and it frequency is 4.096 Mhz.Unable to register simple sound card or the driver get enabled. I have to configure the CODEC in tdm mode with 16 slots and capture audio at 16khz.

Here is my dts file changes

sound {
compatible = "simple-audio-card";
simple-audio-card,name = "tdm-audio";
simple-audio-card,format = "tdm";
simple-audio-card,routing =
"Headphone Jack", "HPOUTL",
"Headphone Jack", "HPCOMR",
"IN2L", "Line In Jack",
"IN2R", "Line In Jack",
"IN1L", "Mic Jack",
"Playback", "CPU-Playback",
"CPU-Capture", "Capture";
status = "okay";

simple-audio-card,cpu {
sound-dai = <&sai2>;
dai-tdm-slot-num = <16>;
dai-tdm-slot-width = <16>;
};

 

simple-audio-card,codec {
audio-codec = <&codec>;
clocks = <&clk IMX8MM_CLK_SAI2_ROOT>;
clock-names = "bclk";
};
};

pinctrl_i2c3: i2c3grp {
fsl,pins = <
MX8MM_IOMUXC_I2C3_SCL_I2C3_SCL 0x400001c3
MX8MM_IOMUXC_I2C3_SDA_I2C3_SDA 0x400001c3
>;
};

pinctrl_sai2: sai2grp {
fsl,pins = <
MX8MM_IOMUXC_SAI2_RXFS_SAI2_RX_SYNC 0xd6
MX8MM_IOMUXC_SAI2_RXC_SAI2_RX_BCLK 0xd6
MX8MM_IOMUXC_SAI2_RXD0_SAI2_RX_DATA0 0xd6
MX8MM_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC 0xd6
MX8MM_IOMUXC_SAI2_TXC_SAI2_TX_BCLK 0xd6
MX8MM_IOMUXC_SAI2_TXD0_SAI2_TX_DATA0 0xd6
MX8MM_IOMUXC_SAI2_MCLK_SAI2_MCLK 0xd6
>;
};

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

codec: tlv320aic3x@18 {
/* ai3x-micbias-vg = <2>; */
compatible = "ti,tlv320aic3104";
reg = <0x18>;
/* gpio-reset = <&gpio5 0 GPIO_ACTIVE_LOW>; */
#sound-dai-cells = <0>;
clocks = <&clk IMX8MM_CLK_SAI2_ROOT>;
clock-names = "bclk";
AVDD-supply = <&reg_audio>;
IOVDD-supply = <&reg_audio>;
DRVDD-supply = <&reg_audio>;
DVDD-supply = <&ldo5_reg>;
status = "okay";
};

};

&sai2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai2>;

assigned-clocks = <&clk IMX8MM_CLK_SAI2_ROOT>;
assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
assigned-clock-rates = <4096000>;
/* assigned-clock-rates = <0>, <4096000>; tlv320aic3104 */
status = "okay";
};

And also I have updated Makefile and added imx-tlv320aic3x.c in sound/soc/fsl and patched clk-imx8mm.c for CLK_EXT3

  • pr_info("i.MX*MM clock driver before setting CLK_EXT3");
  • clk_set_parent(clks[IMX8MM_CLK_SAI2_ROOT], clks[IMX8MM_CLK_EXT3]);
  • pr_info("i.MX*MM clock driver after setting CLK_EXT3");

I am getting the following error

OF: /sound/simple-audio-card,cpu: could not get #sound-dai-cells for /sai@30020000 asoc-simple-card sound: parse error -22 asoc-simple-card: probe of sound failed with error -22 clk: failed to reparent sai2_root_clk to audio_pll1_out: -22

Any help or guidance to update the dts appropriately to get the codec working is appreciated.

ラベル(1)
0 件の賞賛
返信
5 返答(返信)

2,277件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Amrun

 

one can look at solution provided in similar case

https://community.nxp.com/t5/i-MX-Processors/SAI-on-i-MX8M-Mini/m-p/959805

 

Best regards
igor

0 件の賞賛
返信

2,270件の閲覧回数
Amrun
Contributor I

Hi,

I have tried as per in the link. But I didnt get sai mapping message also. can you help me why that sai mapping is not happening with codec driver?

0 件の賞賛
返信

2,266件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

please look at Chapter 16 Porting Audio Codecs  i.MX Porting Guide

 

Best regards
igor

 

0 件の賞賛
返信

2,243件の閲覧回数
Amrun
Contributor I

Hi,

Still facing the same issue. I think there is some issue with SAI mapping. I cant able to view any sai related information in the log file. And also I tried modinfo for i2c. It doesnt show any information for i2c but i have loaded the i2c in the kernel configuration. It is not reflecting in the yocto image. But I got i2c bus information from the /sys/bus and tlv320aic3104 is mapped to i2c chip. Kindly provide your inputs.

Thanks,

Amrun

0 件の賞賛
返信

2,238件の閲覧回数
igorpadykov
NXP Employee
NXP Employee
0 件の賞賛
返信