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.

McASP0 interface with tlv320aic3101

Other Parts Discussed in Thread: TLV320AIC3101

Hi,

We are design custom board  AM335x.
McASP0 interface with codec tlv320aic3101 chip.

I am modified dts file as below.

sound {
                compatible = "ti,da830-evm-audio";
                ti,model = "AM335x-EDGE";
                ti,audio-codec = <&tlv320aic310x>;
                ti,mcasp-controller = <&mcasp0>;
                ti,codec-clock-rate = <24000000>;
                ti,audio-routing =
                        "Headphone Jack",       "HPLOUT",
                        "Headphone Jack",       "HPROUT";
        };
&i2c0 {
        pinctrl-names = "default";
        pinctrl-0 = <&i2c0_pins>;
        status = "okay";
        clock-frequency = <400000>
        tlv320aic310x: tlv320aic310x@18 {
                compatible = "ti,tlv320aic310x";
                reg = <0x18>;
                status = "okay";
                /* Regulators */
                DVDD-supply = <&vbat>;
        };
};

Which codec driver support for tlv320aic3101 chip ?  ti,codec-clock-rate = <24000000>; how to find clock rate ?

Thanks
Tejas

  • Hi Tejas,

    The driver that supports this codec is: sound/soc/codecs/tlv320aic31xx.c

    For guidance on how to port your audio codec to linux kernel see the following wiki article: processors.wiki.ti.com/.../Sitara_Linux_Audio_DAC_Example

    Hope this helps.

    Best Regards,
    Yordan
  • Hi Yordan,

    I am using MCASP0_AXR0 for TX pin & MCASP0_AXR1 pin for Rx.
    I am setting mcasp0 for my board configuration.below serial-dir is correct or not ?

    serial-dir = < /* 1: TX-AXR0, 2: RX-AXR1*/

    1 2 0 0
    >;
    &mcasp0 {
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&mcasp0_pins>;
    pinctrl-1 = <&mcasp0_pins_sleep>;

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

    Thanks
    Tejas
  • Hi Tejas,
    Yes, the above serial-dir is correct.
    Set this way AXR0 is TX and AXR1 is RX.

    Best Regards,
    Yordan
  • Hi,

    I am changes in sound audio-codec & mcasp-controller .but i dont understand Codec-clock-rate  bec i dont use external crystal use internal clock it is correct 24MHz.

          sound {
                    compatible = "ti,da830-evm-audio";
                    ti,model = "AM335x-EDGE";
                    ti,audio-codec = <&tlv320aic310x>;
                    ti,mcasp-controller = <&mcasp0>;
                    ti,codec-clock-rate = <24000000>;
                    ti,audio-routing =
                            "Headphone Jack",       "HPLOUT",
                            "Headphone Jack",       "HPROUT";
            };

    but my sound card not register i m test on evm bec our hardware is not ready.

    Thanks

    Tejas

  • Hi,
    root@am335x-evm:~# aplay dummarodum.wav
    Playing WAVE 'dummarodum.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Ster[ 35.500447] sysclk=24000000
    eo
    aplay: pcm_write:1939: write error: Input/output error
    any chnage needed.
  • Hi Tejas,

    tejas patil said:

    but i dont understand Codec-clock-rate  bec i dont use external crystal use internal clock it is correct 24MHz.

          sound {
                    compatible = "ti,da830-evm-audio";
                    ti,model = "AM335x-EDGE";
                    ti,audio-codec = <&tlv320aic310x>;
                    ti,mcasp-controller = <&mcasp0>;
                    ti,codec-clock-rate = <24000000>;
                    ti,audio-routing =
                            "Headphone Jack",       "HPLOUT",
                            "Headphone Jack",       "HPROUT";
            };

    but my sound card not register i m test on evm bec our hardware is not ready.

    You need to configure the <codec>_hw_params function correctly, you have to use: 

    ret = snd_soc_dai_set_sysclk(cpu_dai, 0, sysclk, SND_SOC_CLOCK_OUT);

    Which tells the ALSA that internal 24MHz clock will be used. See: http://processors.wiki.ti.com/index.php/Sitara_Linux_Audio_DAC_Example#Creating_pcm5102a_hw_params_Function 

    Best Regards,

    Yordan

  • Hi VISWANATH,

    We are design custom board  AM335x.
    McASP0 interface with codec tlv320aic3106 chip. We are using linux kernel 3.14 & codec driver use sound/soc/codecs/tlv320aic31xx.c

    my configuration in davinci-evm.c file :-

    static struct snd_soc_dai_link evm_dai_tlv320aic3x = {
            .name           = "TLV320AIC3X",
            .stream_name    = "AIC3X",
            .codec_dai_name = "tlv320aic31xx-hifi",
            //.codec_dai_name       = "tlv320aic3x-hifi",
            .ops            = &evm_ops,
            .init           = evm_aic3x_init,
            .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS |
                       SND_SOC_DAIFMT_NB_NF,
    };

    & dts file :-

      sound {
                    compatible = "ti,da830-evm-audio";
                    ti,model = "AM335x-EDGE";
                    ti,audio-codec = <&tlv320aic310x>;
                    ti,mcasp-controller = <&mcasp0>;
                    ti,codec-clock-rate = <24000000>;
                    ti,audio-routing =
                            "Headphone Jack",       "HPLOUT",
                            "Headphone Jack",       "HPROUT";
            };

    mcasp0_pins: mcasp0_pins {
                    pinctrl-single,pins = <
                            0x120 (PIN_OUTPUT | MUX_MODE6)  /* K15 MII1_TXD2 mcasp0_ahclkx-MCLK */
                            0x12C (PIN_OUTPUT | MUX_MODE6)  /* K18 MII1_TX_CLK mcasp0_aclkx-BCLK */
                            0x130 (PIN_OUTPUT | MUX_MODE6) /* L18 MII1_RX_CLK mcasp0_fsx-WCLK */
                            0x118 (PIN_INPUT | MUX_MODE6)  /* J17 MII1_RX_DV mcasp0_aclkr-BCLK */
                            0x11C (PIN_INPUT | MUX_MODE6)   /* J18 MII1_TXD3 mcasp0_fsr-WCLK */
                            0x134 (PIN_OUTPUT| MUX_MODE6)  /* L17 MII1_RXD3 mcasp0_axr0-TXD */
                            0x138 (PIN_INPUT | MUX_MODE6)  /* L16 MII1_RXD2 mcasp0_axr1-RXD */
                    >;
            };

            mcasp0_pins_sleep: mcasp0_pins_sleep {
                    pinctrl-single,pins = <
                            0x120 (PIN_OUTPUT | MUX_MODE7)  /* K15 MII1_TXD2 mcasp0_ahclkx-MCLK */
                            0x12C (PIN_OUTPUT | MUX_MODE7)  /* K18 MII1_TX_CLK mcasp0_aclkx-BCLK */
                            0x130 (PIN_OUTPUT | MUX_MODE7) /* L18 MII1_RX_CLK mcasp0_fsx-WCLK */
                            0x118 (PIN_INPUT | MUX_MODE7)  /* J17 MII1_RX_DV mcasp0_aclkr-BCLK */
                            0x11C (PIN_INPUT | MUX_MODE7)   /* J18 MII1_TXD3 mcasp0_fsr-WCLK */
                            0x134 (PIN_OUTPUT | MUX_MODE7)  /* L17 MII1_RXD3 mcasp0_axr0-TXD */
                            0x138 (PIN_INPUT | MUX_MODE7)  /* L16 MII1_RXD2 mcasp0_axr1-RXD */
                    >;
            };
    &mcasp0 {
            pinctrl-names = "default", "sleep";
            pinctrl-0 = <&mcasp0_pins>;
            pinctrl-1 = <&mcasp0_pins_sleep>;

            status = "okay";

            op-mode = <0>;  /* MCASP_IIS_MODE */
            tdm-slots = <2>;
            /* 4 serializers */
            serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX  AXR0-TXD AXR1-RXD */
                    1 2 0 0
            >;
            tx-num-evt = <32>;
            rx-num-evt = <32>;
    };


    &i2c0 {
            pinctrl-names = "default";
            pinctrl-0 = <&i2c0_pins>;

            status = "okay";
            clock-frequency = <400000>;

            tlv320aic310x: tlv320aic310x@18 {
                    compatible = "ti,tlv320aic310x";
                    reg = <0x18>;
                    status = "okay";
                    gpio-reset = <&gpio3 13 GPIO_ACTIVE_LOW>; /*GPIO3_13*/
                    /* Regulators */
                    AVDD-supply = <&vaux2_reg>;
                    IOVDD-supply = <&vaux2_reg>;
                    DRVDD-supply = <&vaux2_reg>;

                    DVDD-supply = <&vaux2_reg1>;
            };
    };

    aplay test.wav
    Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    [   47.821634] sysclk=24000000
    [   47.839602] davinci-mcasp 48038000.mcasp: Inaccurate BCLK: 24000000 Hz / 16 != 1536000 Hz

    any changes is need in davinci-evm.c file ?

    MCLK is comes proper but BCLK & WCLK is not proper .

    Thanks

    Tejas

  • root@edge-shelf:~# aplay test.wav
    Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, [ 113.132343] sysclk=12000000
    Stereo
    [ 113.142438] davinci-mcasp 48038000.mcasp: Inaccurate BCLK: 12000000 Hz / 8 != 1536000 Hz
    [ 114.205135] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x8 (0, 0x8, 500000 us)
    [ 114.215411] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: DAC Right event failed: -1
    [ 115.247437] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x80 (0, 0x80, 500000 us)
    [ 115.257880] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: DAC Left event failed: -1
    [ 116.288313] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x2 (0, 0x2, 500000 us)
    [ 116.298590] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: HPR Driver event failed: -1
    [ 117.328371] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x20 (0, 0x20, 500000 us)
    [ 117.338814] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: HPL Driver event failed: -1

    i am setting amixer

    amixer sset 'DAC' 127
    amixer sset 'HP Analog' 66
    amixer sset 'HP Driver' 0 on
    amixer sset 'HP Left' on
    amixer sset 'HP Right' on
    amixer sset 'Output Left From Left DAC' on
    amixer sset 'Output Right From Right DAC' on

    above errror comes how to solve it
  • tejas patil said:
    [ 113.142438] davinci-mcasp 48038000.mcasp: Inaccurate BCLK: 12000000 Hz / 8 != 1536000 Hz

    You are trying to play a 48kHz 16-bit stereo file. This needs a 48 000 * 16 *2 = 1 536 000Hz bit clock. This clock cannot be derived from the internal master clock of 24MHz. You need an external master clock source of 1 536 000 * 16 = 24 576 000Hz.

  • Hi ,
    this is my logs are comes
    root@edge-shelf:~# dmesg | grep sound
    [ 2.471917] davinci_evm sound.11: ASoC: CODEC (null) not registered
    [ 2.479943] davinci_evm sound.11: snd_soc_register_card failed (-517)
    [ 2.488355] platform sound.11: Driver davinci_evm requests probe deferral
    [ 2.873347] davinci_evm sound.11: tlv320aic31xx-hifi <-> 48038000.mcasp mapping ok
    [ 2.881080] davinci_evm sound.11: ASoC: no source widget found for HPLOUT
    [ 2.887930] davinci_evm sound.11: ASoC: Failed to add route HPLOUT -> direct -> Headphone Jack
    [ 2.896594] davinci_evm sound.11: ASoC: no source widget found for HPROUT
    [ 2.903428] davinci_evm sound.11: ASoC: Failed to add route HPROUT -> direct -> Headphone Jack
    root@edge-shelf:~#
    root@edge-shelf:~# dmesg | grep tlv
    [ 2.851390] tlv320aic31xx-codec 0-0018: ASoC: DAPM unknown pin MONO_LOUT
    [ 2.858236] tlv320aic31xx-codec 0-0018: ASoC: DAPM unknown pin HPLCOM
    [ 2.865485] tlv320aic31xx-codec 0-0018: ASoC: DAPM unknown pin HPRCOM
    [ 2.873347] davinci_evm sound.11: tlv320aic31xx-hifi <-> 48038000.mcasp mapping ok
    [ 2.912082] tlv320aic31xx-codec 0-0018: Invalid DAI master/slave interface
    [ 2.919002] tlv320aic31xx-codec 0-0018: ASoC: Failed to set DAI format: -22
    [ 114.205135] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x8 (0, 0x8, 500000 us)
    [ 114.215411] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: DAC Right event failed: -1
    [ 115.247437] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x80 (0, 0x80, 500000 us)
    [ 115.257880] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: DAC Left event failed: -1
    [ 116.288313] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x2 (0, 0x2, 500000 us)
    [ 116.298590] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: HPR Driver event failed: -1
    [ 117.328371] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x20 (0, 0x20, 500000 us)
    [ 117.338814] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: HPL Driver event failed: -1
    root@edge-shelf:~#
  • Hi Biser,

    We are design our board AM335x board . We are using tlv320aic3101 chip with mcasp0 port .
    I have enabled debug in tlv320aic31xx.c
    this is my logs are comes
    root@edge-shelf:~# dmesg | grep sound
    [ 2.471917] davinci_evm sound.11: ASoC: CODEC (null) not registered
    [ 2.479943] davinci_evm sound.11: snd_soc_register_card failed (-517)
    [ 2.488355] platform sound.11: Driver davinci_evm requests probe deferral
    [ 2.873347] davinci_evm sound.11: tlv320aic31xx-hifi <-> 48038000.mcasp mapping ok
    [ 2.881080] davinci_evm sound.11: ASoC: no source widget found for HPLOUT
    [ 2.887930] davinci_evm sound.11: ASoC: Failed to add route HPLOUT -> direct -> Headphone Jack
    [ 2.896594] davinci_evm sound.11: ASoC: no source widget found for HPROUT
    [ 2.903428] davinci_evm sound.11: ASoC: Failed to add route HPROUT -> direct -> Headphone Jack
    root@edge-shelf:~#
    root@edge-shelf:~# dmesg | grep tlv
    [ 2.851390] tlv320aic31xx-codec 0-0018: ASoC: DAPM unknown pin MONO_LOUT
    [ 2.858236] tlv320aic31xx-codec 0-0018: ASoC: DAPM unknown pin HPLCOM
    [ 2.865485] tlv320aic31xx-codec 0-0018: ASoC: DAPM unknown pin HPRCOM
    [ 2.873347] davinci_evm sound.11: tlv320aic31xx-hifi <-> 48038000.mcasp mapping ok
    [ 2.912082] tlv320aic31xx-codec 0-0018: Invalid DAI master/slave interface
    [ 2.919002] tlv320aic31xx-codec 0-0018: ASoC: Failed to set DAI format: -22
    [ 114.205135] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x8 (0, 0x8, 500000 us)
    [ 114.215411] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: DAC Right event failed: -1
    [ 115.247437] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x80 (0, 0x80, 500000 us)
    [ 115.257880] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: DAC Left event failed: -1
    [ 116.288313] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x2 (0, 0x2, 500000 us)
    [ 116.298590] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: HPR Driver event failed: -1
    [ 117.328371] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x20 (0, 0x20, 500000 us)
    [ 117.338814] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: HPL Driver event failed: -1
    root@edge-shelf:~#

    i am setting amixer

    amixer sset 'DAC' 127
    amixer sset 'HP Analog' 66
    amixer sset 'HP Driver' 0 on
    amixer sset 'HP Left' on
    amixer sset 'HP Right' on
    amixer sset 'Output Left From Left DAC' on
    amixer sset 'Output Right From Right DAC' on


    I am trying to play test.wav file but no sound comes above error comes when aplay . how to solve above errors. i am checked pin muxing is correct .Master clock is comes proper 24MHz waveform but BCLK and WCLK waveform is shifted. my dai fmt is correct or not ?
    .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBS_CFS |
    SND_SOC_DAIFMT_IB_NF,

    & also checked the audio device list is aplay -l sound card is register AM335x-EDGE
    Any idea why sound is not coming ?
    change in dts file HPLOUT & HPROUT
    ti,audio-routing =
    - "Headphone Jack", "HPLOUT",
    - "Headphone Jack", "HPROUT";
    + "Headphone Jack", "HPL",
    + "Headphone Jack", "HPR";
    [ 2.896594] davinci_evm sound.11: ASoC: no source widget found for HPROU this is error is gone.
    but still
    aplay test.wav
    Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, [ 408.868191] evm_hw_params hw params
    Stereo
    [ 408.874981] sysclk=24000000
    [ 408.878440] bclk_freq=1536000
    [ 409.933555] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x8 (0, 0x8, 500000 us)
    [ 409.943834] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: DAC Right event failed: -1
    [ 410.978665] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x80 (0, 0x80, 500000 us)
    [ 410.989110] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: DAC Left event failed: -1
    [ 412.021723] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x2 (0, 0x2, 500000 us)
    [ 412.032003] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: HPR Driver event failed: -1
    [ 413.062586] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x20 (0, 0x20, 500000 us)
    [ 413.073029] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: HPL Driver event failed: -1

    i want use internal clock 24MHz . i add in hw parmas

    + unsigned int bclk_freq = snd_soc_params_to_bclk(params);
    + ret = snd_soc_dai_set_clkdiv(cpu_dai, 1, sysclk/bclk_freq);
    + if (ret < 0) {
    + printk("can't set CPU DAI clock divider %d\n",
    + ret);
    + return ret;
    + }
    +
    + printk("evm_hw_params hw params\n");
    printk("sysclk=%d\n", sysclk);
    + printk("bclk_freq=%d\n", bclk_freq);

    Thanks
    Tejas
  • The AM335x does not have PLLs to produce the necessary clocks for the standard sampling rates. However, the tlv320aic31xx codec does have the necessary PLLs, so it can produce the necessary bit clock and frame clock from the provided 24MHz MCLK. This is one of the main selling points and features of the tlv320aic31xx! In other words, the tlv320aic31xx must be configured as the bit clock and frame clock master: SND_SOC_DAIFMT_CBM_CFM.

    You really should read the datasheet for the tlv320aic31xx and McASP more thoroughly before attempting to write a driver. You will waste less time debugging.
  • Also, you should not have to write any code to make this work since the tlv320aic31xx codec driver already exists.  An entry like this will make everything work assuming you have your other codec node defined correct:

     sound {
        compatible = "simple-audio-card";
        simple-audio-card,format = "i2s";
    
        simple-audio-card,cpu {
          sound-dai = <&mcasp0>;
          system-clock-frequency = <24000000>;
          system-clock-direction = "out";
        };
    
        simple-audio-card,codec {
          sound-dai = <&tlv320aic310x>;      
          bitclock-master;
          frame-master;
        };
        
      };

    Take a look at simple-card.c and 

    http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/sound/simple-card.txt?v=3.14

  • Hi,
    I am setting below configuration in my dts file but no soundcard found any mistake below code .
    [ 2.982098] ALSA device list:
    [ 2.985228] No soundcards found.
    sound {
    compatible = "ti,da830-evm-audio";
    ti,model = "AM335x-EDGE";
    ti,format = "dsp_b";
    ti,routing =
    "Headphone Jack", "HPL",
    "Headphone Jack", "HPR";
    ti,cpu {
    sound-dai = <&mcasp0>;
    system-clock-frequency = <24000000>;
    system-clock-direction = "out";
    };

    ti,codec {
    sound-dai = <&tlv320aic310x>;
    bitclock-master;
    frame-master;
    };
    };
    thanks
    Tejas
  • That is wrong. Also it shows that you are trying to write kernel/driver code without understanding how a device tree works! Do yourself a favor and at least understand how the "compatible" field works. ;-)

    lxr.free-electrons.com/.../usage-model.txt

    So do not change the compatible fields arbitrarily. It should look more like this:

    sound {
    compatible = "simple-audio-card";
    simple-audio-card,format = "dsp_b";
    simple-audio-card,routing =
    "Headphone Jack", "HPL",
    "Headphone Jack", "HPR";

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

    simple-audio-card,codec {
    sound-dai = <&tlv320aic310x>;
    bitclock-master;
    frame-master;
    };

    };

    You might need to also add

    #sound-dai-cells = <0>;

    to both your mcasp0 node and tlv320aic310x node.

  • Also, please understand that by using the simple-card interface you do not need any of the code in davinci-evm.c. The purpose of davinci-evm.c is to dai-link together McASP and the codec. For simple cases like this, you do not need to write your own link, you can just use the simple-card driver to create the link (which was added after the Sitara Audio DAC tutorial was created).
  • Hi
    Thank you for information card is register but still no sound comes

    root@edge-shelf:~# aplay test.wav
    Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    [ 111.105881] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x8 (0, 0x8, 500000 us)
    [ 111.116176] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: DAC Right event failed: -1
    [ 112.147080] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x80 (0, 0x80, 500000 us)
    [ 112.157525] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: DAC Left event failed: -1
    [ 113.188873] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x2 (0, 0x2, 500000 us)
    [ 113.199143] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: HPR Driver event failed: -1
    [ 114.230340] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x20 (0, 0x20, 500000 us)
    [ 114.240781] tlv320aic31xx-codec 0-0018: ASoC: POST_PMU: HPL Driver event failed: -1
    aplay: pcm_write:1939: write error: Input/output error
    root@edge-shelf:~# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: AM335xEDGE [AM335x-EDGE], device 0: davinci-mcasp.0-tlv320aic31xx-hifi tlv320aic31xx-hifi-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0

    above error comes

    Thanks you
    Tejas
  • Those error messages mean that you are unable to communicate with the codec over the i2c bus.

    [ 111.105881] tlv320aic31xx-codec 0-0018: aic31xx_wait_bits: Failed! 0x25 was 0x0 expected 0x8 (0, 0x8, 500000 us)

    aic31xx_wait_bits() is trying to read a register (at address 0x25) on the codec but it is always getting zero (0x0) no matter how many times it tries to set it to something else.

    Remember audio is sent over i2s but the control messages that configure the codec are sent over i2c. Please read:

    lxr.free-electrons.com/.../tlv320aic3x.txt

    for how to properly setup the device tree node for your codec. Also check to make sure your i2c pin control nodes are correct.
  • Hi,

    I am setting i2c is correct in dts file .

    &i2c0 {
            pinctrl-names = "default";
            pinctrl-0 = <&i2c0_pins>;

            status = "okay";
            clock-frequency = <400000>;

            tlv320aic310x: tlv320aic310x@18 {
                    #sound-dai-cells = <0>;
                    compatible = "ti,tlv320aic310x";
                    reg = <0x18>;
                    status = "okay";
                    gpio-reset = <&gpio3 13 GPIO_ACTIVE_LOW>; /*GPIO3_13*/
                    /* Regulators */
                    AVDD-supply = <&vaux2_reg>;
                    IOVDD-supply = <&vaux2_reg>;
                    DRVDD-supply = <&vaux2_reg>;

                    DVDD-supply = <&vaux2_reg1>;
            };
    };

    how to solve above error ? i have no idea.

    Thanks

    Tejas

  • It looks right, I guess. However, on all of the TI EVMs that I know of the i2c0 is usually being used for the PMIC but you said you are using a custom board right? Have you verified your hardware? I'd say it is time to check the i2c pins with an oscilloscope and see what is happening there.
  • Hi,
    We are using custom board . We are not using PMIC .i Checked i2c clock & data pin using CRO. i2c clock comes is proper.

    Thnaks
    Tejas
  • Have you taken the codec out of reset using gpio3.13?

  • Hi,

    Yes,

    gpio-reset = <&gpio3 13 GPIO_ACTIVE_LOW>; /*GPIO3_13*/

    I am using gpio3.13 for reset tlv.

    thanks

    Tejas

  • That line does not do anything. It is just a mapping of the gpio pin to a string: "gpio-reset". In your codec's probe() function, you need to call devm_gpiod_get(&pdev->dev,"reset") to get access to that gpio pin and then manipulate the gpio pin to bring your codec out of reset as according to the TLV320AIC3101 datasheet.

    I'm going to stop helping you here. Please spend more time reading the documentation and code. Good luck.