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.

AM5718: Linux/AM5718: Audio CodecTLV320AIC3206 by using MCASP, I2C

Part Number: AM5718
Other Parts Discussed in Thread: TMDXIDK5718, TLV320AIC3206

Hi,

I'm using our custom board based on TMDXIDK5718 with TLV320AIC3206 audio codec and tlv320aic32x4 linux driver.

TLV320AIC3206 is Bit and Frame Master.

Hardware connection is as below.

I'm trying to playback, but does not work.

root@am57xx-evm:~# arecord -Dplughw:0,0 -d 8 -fS16_LE -c2 -r48000 -t wav /tmp/test.wav
Recording WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
root@am57xx-evm:~# aplay -Dplughw:0,0 /tmp/test.wav
Playing WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
aplay: pcm_write:2051: write error: Input/output error

BCLK output and WCLK output(48kHz) are OK at "arecord" command.

But at "aplay" command they are always high level.

I'm using:

SDK-LINUX-AM57X 06_03_00_106

In tisdk_am57xx-evm_defconfig file:

CONFIG_SND_SOC_TLV320AIC32X4_I2C=m

In am571x-idk.dts file:

        sound0: sound0 {
                compatible = "simple-audio-card";
                simple-audio-card,name = "AM57x-Sound-Card";
                simple-audio-card,format = "i2s";
                simple-audio-card,widgets =
                        "Line", "Line Out",
                        "Line", "Line In";
                simple-audio-card,routing =
                        "Line Out",     "LLOUT",
                        "Line Out",     "RLOUT",
                        "MIC2L",        "Line In",
                        "MIC2R",        "Line In";
                simple-audio-card,bitclock-master = <&sound0_master>;
                simple-audio-card,frame-master = <&sound0_master>;

                simple-audio-card,cpu {
                        sound-dai = <&mcasp8>;
                };

                sound0_master: simple-audio-card,codec {
                        sound-dai = <&tlv320aic3206>;
                };
        };

        tlv320aic3206_mclk: tlv320aic3206_mclk {
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency = <12000000>;
        };

&mcasp8 {
        #sound-dai-cells = <0>;
        status = "okay";
        op-mode = <0>;  /* MCASP_IIS_MODE */
        tdm-slots = <2>;
        /* 4 serializers */
        serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
                1 2 0 0
        >;
        tx-num-evt = <32>;
        rx-num-evt = <32>;
};

&i2c5 {
        status = "okay";
        clock-frequency = <100000>;

        tlv320aic3206: tlv320aic3206@18 {
                #sound-dai-cells = <0>;
                reg = <0x18>;
                compatible = "ti,tlv320aic32x6";
                reset-gpios = <&gpio6 14 GPIO_ACTIVE_LOW>;
                clock-names = "mclk";
                clocks = <&tlv320aic3206_mclk>;
                dv-supply = <&ldo2_reg>;
                av-supply = <&ldo2_reg>;
                iov-supply = <&v3_3d>;
                status = "okay";
        };

};

Please teach me how to playback wave file.

Regards,

Toshio Masuchi

  • Hi Masuchi-san,

    The support for this is quite limited, can you please check if this page can help you resolve the problem?

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/640645/am5728-8-audio-channels-from-1-mcasp

    Regards

    Karthik

  • Hi Karthik,

    Tahnks for your reply.

    I checked this URL and refered "am572xx-beagle-x15-common.dtsi".

    But the codec could not playback.

    I changed simple-audio-card,routing "in "am571x-idk.dts" for tlv320aic32x4 linux driver.

    ====

                    simple-audio-card,routing =
                            "Line Out",     "LOL",
                            "Line Out",     "LOR",
                            "IN1_L",        "Line In",
                            "IN1_R",        "Line In";

    ====

    "dmesg"s are as below.

    ==

    root@am57xx-evm:~# dmesg | grep -i tlv  
    [   74.814213] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/ocp/i2c@4807c000/tlv320aic3206@18[0]' - status (0)
    [   74.814343] tlv320aic32x4 4-0018: Linked as a consumer to regulator.2
    [   74.932791] tlv320aic32x4 4-0018: Linked as a consumer to regulator.12
    [   77.708397] asoc-simple-card sound0: tlv320aic32x4-hifi <-> 4847c000.mcasp mapping ok

    root@am57xx-evm:~# dmesg | grep -i audio
    [   77.611746] of_get_named_gpiod_flags: can't parse 'simple-audio-card,hp-det-gpio' property of node '/sound0[0]'
    [   77.611760] of_get_named_gpiod_flags: can't parse 'simple-audio-card,mic-det-gpio' property of node '/sound0[0]'

    root@am57xx-evm:~# dmesg | grep -i sound
    [   67.397756] Advanced Linux Sound Architecture Driver Initialized.
    [   70.711850]   No soundcards found.
    [   77.611746] of_get_named_gpiod_flags: can't parse 'simple-audio-card,hp-det-gpio' property of node '/sound0[0]'
    [   77.611760] of_get_named_gpiod_flags: can't parse 'simple-audio-card,mic-det-gpio' property of node '/sound0[0]'
    [   77.708397] asoc-simple-card sound0: tlv320aic32x4-hifi <-> 4847c000.mcasp mapping ok
    [   77.771383] asoc-simple-card sound0: ASoC: no DMI vendor name!
    root@am57xx-evm:~#

    ==

    "arecord" and"aplay" are as below.

    ==

    root@am57xx-evm:~# arecord -Dhw:0,0 -t wav -f S16_LE -r 48000 -c 2 -d 15 /tmp/test.wav
    Recording WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    root@am57xx-evm:~# aplay -Dhw:0,0 /tmp/test.wav                                                                                                                  
    Playing WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    aplay: pcm_write:2051: write error: Input/output error

    ==

    Please suggest if any thing change is required.

    Regards,

    Toshio Masuchi

  • I found the reason.
    All output settings are "Off". So aplay did not work.
    After setting as below, aplay can work.

    == Commands for Line Out ==
    amixer -c 0 sset 'LO DAC' on
    amixer -c 0 sset 'LOL Output Mixer L_DAC' on
    amixer -c 0 sset 'LOR Output Mixer R_DAC' on
    ====


    And arecord can work too.

    == Commands for Line In ==
    amixer -c 0 sset 'IN1_L to Left Mixer Positive Resistor' '10 kOhm'
    amixer -c 0 sset 'IN1_R to Right Mixer Positive Resistor' '10 kOhm'
    amixer -c 0 sset 'ADCFGA Left Mute' off
    amixer -c 0 sset 'ADCFGA Right Mute' off

    arecord -Dhw:0,0 -t wav -f S16_LE -r 48000 -c 2 -d 15 /tmp/test.wav                                                                                                                     
    Recording WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    root@am57xx-evm:~# aplay -Dplughw:0,0 /tmp/test.wav
    Playing WAVE '/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    ====

    Thanks.