AnsweredAssumed Answered

TLV320AIC3105 on i.MX6Q: no clock on BLCK, WCLK

Question asked by Nguyen Mr on Sep 21, 2017
Latest reply on Oct 7, 2017 by Nguyen Mr

I use TI Audio Codec TLV320AIC3105 on our custom boards (iMX6Q, kernel 4.1.15, android 6.0.1). 

I tried to use the  /sound/soc/codecs/tlv320aic3x.c  codec and the /sound/soc/fsl/imx-tlv320aic3x.c machine driver.

In the DTS file, the codec was configured to be compatible with ti,tlv320aic3x. We using gpio to control power supply and reset pin.

In fuction "aic3x_i2c_probe" tlv320aic3x.c, i try to add code read/write some registers of TLV320AIC3105 ic, and show some information. When booting, i see messages show:

tlv320aic3x-codec 2-0018: AIC3x model: 0

tlv320aic3x-codec 2-0018: ai3x-micbias-vg: 2

tlv320aic3x-codec 2-0018: Register 0: 0x 0

tlv320aic3x-codec 2-0018: Register 15: 0x80
tlv320aic3x-codec 2-0018: Register 17: 0xff
tlv320aic3x-codec 2-0018: Register 19: 0x78
tlv320aic3x-codec 2-0018: Register 27: 0xfe

fsl-asrc 2034000.asrc: driver registered

imx-tlv320aic3x sound: data->codec_clk: 24000000

imx-tlv320aic3x sound: tlv320aic3x-hifi <-> 202c000.ssi mapping ok

....

ALSA device list:
 #0: tlv320-audio

 

That's mean I2C interface is OK, and machine driver is mapping ok.

 

But when i try to play music file, i use oscilloscope to check clock on MCLK, BLCK, WCLK, CODEC_DIN and  see that only have clock on MCLK, no clock on BLCK, WCLK, DIN pin.

 

My schematic: 

AUD3_TXFS - WCLK

AUD3_TCX - BLK

AUD3_TXD - CODEC_DIN

AUD3_RDX - CODEC_DOUT

MX6QDL_PAD_GPIO_0__CCM_CLKO1 -> CODEC_MCLK

 

in device tree:

 

pinctrl_i2c3: i2c3grp {
fsl,pins = <
   MX6QDL_PAD_GPIO_3__I2C3_SCL 0x4001b8b1
   MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b8b1

 

   /* Audio Codec RESET pin */
   MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x0001b0b0

   >;
};

 

reg_audio: regulator@2 {
   compatible = "regulator-fixed";
   reg = <2>;
   regulator-name = "tlv320aic3105-supply";
   gpio = <&gpio4 10 0>; /* control power supply for audio codec */
   enable-active-high;
};

 

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


   codec_tlv320: tlv320aic3x@18 {
   compatible = "ti,tlv320aic3x";
   reg = <0x18>;
   clocks = <&clks IMX6QDL_CLK_CKO>;
   ai3x-micbias-vg = <2>;
   gpio-reset = <&gpio1 2 GPIO_ACTIVE_LOW>;
   status = "okay";

   /* Regulators */
   AVDD-supply = <&reg_audio>;
   IOVDD-supply = <&reg_audio>;
   DVDD-supply = <&reg_audio>;
   DRVDD-supply = <&reg_audio>;
};
};

 

sound {
   compatible = "fsl,imx-audio-tlv320aic3x"; 
   model = "tlv320-audio"; 
   cpu-dai = <&ssi2>;
   audio-codec = <&codec_tlv320>;
   ssi-controller = <&ssi2>;

   /* routing of sink, source */
   audio-routing =
      "LINE1L", "Mic Jack",
      "Headphone Jack", "HPLOUT",
      "Headphone Jack", "HPROUT",
      "Ext Spk", "LLOUT",
      "Ext Spk", "LROUT",
      "Mic Jack", "Mic Bias";

   mux-int-port = <2>; 
   mux-ext-port = <3>; 
};

 

&ssi2 {
   fsl,mode = "i2s-master";
   status = "okay";
};

 

pinctrl_audmux: audmuxgrp {
fsl,pins = <
   MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0
   MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0
   MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x110b0
   MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0
   MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0       /* Audio codec clock */
>;
};

 

/* Audio for TLV320AIC3105 */
&audmux {
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_audmux>;
   status = "okay";
};

 

My machine driver and my codec driver is attached.

Anyone has experience onTLV320 can help me?

 

BR/Nguyen

Original Attachment has been moved to: tlv320aic3x.h.zip

Original Attachment has been moved to: tlv320aic3x.c.zip

Original Attachment has been moved to: imx-tlv320aic3x.c.zip

Outcomes