This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TLV320AIC3204: Linux TLV320AIC3204 using simple-audio-card Playback ok,but can not Record

Part Number: TLV320AIC3204

Hello, 

I am an embedded software engineer and recently working on a project bringing up a board based on the NXP i.MX8QM Arm processor with a TI TLV320AIC3204 Stereo Audio Codec running the Linux 5.4.47 Kernel. The Codec chip is connected via the SAI1 I2S bus. I am able to get the audio playing part working, however am currently facing some difficulties getting the recording function working and would appreciate your advice and help. Details are listed below. 

My development is based on the following framework as shown in the figure. I am currently using the “Codec Driver” (tlv320aic32x4-i2c.c/ tlv320aic32x4.c) that comes with the Linux Kernel-5.4.47 and the “Platform Driver” file “simple-sound.c” (linux-imx/sound/soc/generic/simple-card.c) from the same kernel release. The device tree (DTS) is configured as an audio device using the following steps:

the Schematic diagram is as flow:

After a fresh reboot, I confirmed that the TLV320AIC3204 codec chip was detected in the Kernel

 

1) by using the “aplay -L” command to list the newly added audio device:

sysdefault:CARD=tlv320audio
tlv320-audio,
Default Audio Device

2) by testing the audio playback: the audio clip can be played using the following command

aplay -D sysdefault:CARD=tlv320audio -f dat 1.wav

 

However, the recording function does not work.

I tried to use the following command:

arecord -vv -D sysdefault:CARD=tlv320audio foo.wav

When executing the recording command, the followings were observed:

1)      No change was observed on the MICBIAS signal,

2)      The PIN1 MCLK outputs is OK

3)      The Codec chip was not outputting PIN 2 BCLK and WCLK signals

After some preliminary debugging, I found that during the arecord call, the “dapm_power_widgets” function in sound/soc/soc-dapm.c was called. While going through each widget, all the capture widget’s “new_power” property had a “0” value and the “target_bias_level” remained at 0 (SND_SOC_BIAS_OFF). In turn, the recording failed.

I was wondering if anyone has experienced this issue before. Whether this is a DTS configuration issue or a kernel driver issue that requires a patch. Thanks in advance for your help!

  • the device tree of simple-sound-card is like this:

    sound-tlv320-simple {      
            compatible = "simple-audio-card";
            status = "okay";
            simple-audio-card,name = "tlv320-audio";
            simple-audio-card,format = "i2s";
            simple-audio-card,frame-master = <&codec_dai>;
            simple-audio-card,bitclock-master = <&codec_dai>;       
            simple-audio-card,hp-det-gpio = <&lsio_gpio0 31 GPIO_ACTIVE_HIGH>;
            simple-audio-card,mic-det-gpio = <&lsio_gpio0 31 GPIO_ACTIVE_HIGH>;

            simple-audio-card,widgets =
            "Microphone", "Mic Jack",
            "Microphone", "Main MIC",
            "Speaker", "Ext Spk",
            "Line","Line In",
            "Headphone", "Headphone Jack";

            audio-routing =
                "Headphone Jack", "HPL",    //left headphone routing
                "Headphone Jack", "HPR",    //right headphone routing
                "Ext Spk", "LOL",           //left speaker routing 
                "Ext Spk", "LOR",           //right speaker routing
                "IN2_L", "Mic Jack",        //input Mic routing         
                "IN3_L", "Mic Jack",        //input Mic routing
                "IN1_R", "Main Jack",       //input Mic routing
                "IN2_R", "Main Jack",       //input Mic routing
                "Mic Jack","Mic Bias",      //Mic bias routing          
                "Main Jack", "Mic Bias",    //Mic bias routing
                "IN1_L","Line In",
                "IN3_R","Line In",
                "Playback", "CPU-Playback",
                "CPU-Capture", "Capture";


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

            codec_dai: simple-audio-card,codec {
                    sound-dai = <&codec_tlv320>;                
                    clocks = <&mclkout0_lpcg 0>;
            };
        };
  • Hi Xie,

    We do not actively support queries on Linux drivers or Linux system integration. We'll be glad to help with any device-related queries.

    Best Regards.

  • I shall close this thread if you do not have any further queries.

    Best Regards.