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.

Linux/TLV320AIC3101: McASP with audio codec TLV320AIC3101 fails to play wav file with AM437x based custom board with error "aplay: pcm_write:2011: write error: Input/output error"

Part Number: TLV320AIC3101
Other Parts Discussed in Thread: TPS63031

Tool/software: Linux

Hi,

We have custom board based on AM437x and we are using Audio codec tlv320aic3101 with McAsp0 over i2c1. We are not able to play wav file and getting error "aplay: pcm_write:2011: write error: Input/output error" .

Dts configurations for 1) sound node   2) i2c1 node  3) McASP0 node  are as follow :

sound0: sound@0 {
                compatible = "simple-audio-card";
                simple-audio-card,name = "AM437x-GP-EVM";
                simple-audio-card,widgets =
                        "Headphone", "Headphone Jack",
                        "Line", "Line In";
                simple-audio-card,routing =
                        "Headphone Jack",       "HPL",
                        "Headphone Jack",       "HPR",
                        "LINE1L",               "Line In",
                        "LINE1R",               "Line In";
                simple-audio-card,format = "dsp_b";
                simple-audio-card,bitclock-master = <&sound0_master>;
                simple-audio-card,frame-master = <&sound0_master>;
                simple-audio-card,bitclock-inversion;

                simple-audio-card,cpu {
                        sound-dai = <&mcasp0>;
                        system-clock-frequency = <24000000>;
                };

                sound0_master: simple-audio-card,codec {
                        sound-dai = <&tlv320aic3101>;
                        system-clock-frequency = <24000000>;
                };
        };


        audio_mstrclk: mclk_osc {
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency = <24000000>;
        };


&i2c1 {
        status = "okay";
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&i2c1_pins_default>;
        pinctrl-1 = <&i2c1_pins_sleep>;
        clock-frequency = <100000>;

     /* Audio Codec placed on I2C1 */
    tlv320aic3101: tlv320aic3101@18 {
        #sound-dai-cells = <0>;
        compatible = "ti,tlv320aic310x";
        reg = <0x18>;
        status = "okay";

        /* Regulators */
        IOVDD-supply = <&evm_v3_3d>; /* V3_3D -> <tps63031> EN: V1_8D -> VBAT */
        AVDD-supply = <&evm_v3_3d>; /* v3_3AUD -> V3_3D -> ... */
        DRVDD-supply = <&evm_v3_3d>; /* v3_3AUD -> V3_3D -> ... */
        DVDD-supply = <&evm_v1_8d>; /* V1_8D -> LDO1 */
    };

};


&mcasp0 {
        #sound-dai-cells = <0>;
        pinctrl-names = "default", "sleep";
        pinctrl-0 = <&mcasp0_pins>;
        pinctrl-1 = <&mcasp0_sleep_pins>;

        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>;
};


While booting I am getting logs like :

[    1.809972] asoc-simple-card sound@0: tlv320aic31xx-hifi <-> 48038000.mcasp mapping ok
[    1.818076] asoc-simple-card sound@0: ASoC: no source widget found for HPLOUT
[    1.825275] asoc-simple-card sound@0: ASoC: Failed to add route HPLOUT -> direct -> Headphone Jack
[    1.834342] asoc-simple-card sound@0: ASoC: no source widget found for HPROUT
[    1.841572] asoc-simple-card sound@0: ASoC: Failed to add route HPROUT -> direct -> Headphone Jack
[    1.850613] asoc-simple-card sound@0: ASoC: no sink widget found for LINE1L
[    1.857641] asoc-simple-card sound@0: ASoC: Failed to add route Line In -> direct -> LINE1L
[    1.866049] asoc-simple-card sound@0: ASoC: no sink widget found for LINE1R
[    1.873079] asoc-simple-card sound@0: ASoC: Failed to add route Line In -> direct -> LINE1R
[    1.886691] mmc2: queuing unknown CIS tuple 0x91 (3 bytes)
[    1.892894] mmc2: new high speed SDIO card at address 0001
[    1.901025] backlight supply power not found, using dummy regulator
[    1.908654] hctosys: unable to open rtc device (rtc0)
[    1.987185] ALSA device list:
[    1.990191]   #0: AM437x-GP-EVM

ALSA: Restoring mixer settings...
No state is present for card AM437xGPEVM
Found hardware: "AM437x-GP-EVM" "" "" "" ""
Hardware is initialized using a generic method
No state is present for card AM437xGPEVM


After Booting up with aplay command I have successfully get Codec chip :

root@edge-shelf:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AM437xGPEVM [AM437x-GP-EVM], device 0: davinci-mcasp.0-tlv320aic31xx-hifi tlv320aic31xx-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

But when I play Audio using aplay :

root@edge-shelf:~# aplay Casio-CZ-5000-Human-Voice-C4.wav
Playing WAVE 'Casio-CZ-5000-Human-Voice-C4.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
aplay: pcm_write:2011: write error: Input/output error.

Can anyone help me in this now What's wrong with my configuration. I have got some help from this : https://e2e.ti.com/support/arm/sitara_arm/f/791/p/435079/1650921

Thank you,
Chintan



  • Hi Chintan,

    Looking at the boot log you provide:
    [ 1.818076] asoc-simple-card sound@0: ASoC: no source widget found for HPLOUT
    [ 1.825275] asoc-simple-card sound@0: ASoC: Failed to add route HPLOUT -> direct -> Headphone Jack
    [ 1.834342] asoc-simple-card sound@0: ASoC: no source widget found for HPROUT
    [ 1.841572] asoc-simple-card sound@0: ASoC: Failed to add route HPROUT -> direct -> Headphone Jack
    [ 1.850613] asoc-simple-card sound@0: ASoC: no sink widget found for LINE1L
    [ 1.857641] asoc-simple-card sound@0: ASoC: Failed to add route Line In -> direct -> LINE1L
    [ 1.866049] asoc-simple-card sound@0: ASoC: no sink widget found for LINE1R
    [ 1.873079] asoc-simple-card sound@0: ASoC: Failed to add route Line In -> direct -> LINE1R

    I think you need to add a correct routing in your dts file & check your alsa machine layer, see the following wiki:
    processors.wiki.ti.com/.../Sitara_Linux_Audio_DAC_Example

    Best Regards,
    Yordan
  • Hi,

    I'm using TLV320AIC3101 soc, and the link you've shared is for TLV320DAC socs.

    And now I've corrected headphone jack and line routings as per tlv320aic31xx.c driver.
    Please verify if I'm setting other parameters right or not.


    Also, I'm not getting mclk from the processor. What could be the reason?

  • Chintan Jobanputra said:
    Also, I'm not getting mclk from the processor. What could be the reason?

    On AM437x TI EVM, Audio Codec MCLK comes from external 12MHz clock source, not from AM437x device pin. What about your custom board?

  • In our custom board, We want to generate mclk from processor.

    What changes I have to make in dts / tvl320aic3x driver / processor register to generate mclk from processor for Audio codec ?
  • Chintan,

    Which AM437x pin you are using to supply MCLK to AIC3x codec?

    You can take as reference the AM437x SK (Starter Kit), where AIC3x codec MCLK is supplied by AM437x xdma_event_intr0
    .clkout1 pin (D24, muxmode=0x3). This is programmed in am437x-sk-evm.dts file.

    Regards,
    Pavel