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/TDA2SX: tlv320aic3x-codec 2-001a: ASoC: Failed to set DAI format: -22

Part Number: TDA2SX
Other Parts Discussed in Thread: TLV320AIC34

Tool/software: Linux

Hello all,

 We are working on a custom board based on tda2sx.We are trying to interface tlv320aic34 through mscap4 and mcasp7.The codec is being deteced as i2c device but I'm getting the followig log:

asoc-simple-card sound@0: tlv320adc3101-hifi <-> 48474000.mcasp mapping ok
tlv320aic3x-codec 2-001a: ASoC: Failed to set DAI format: -22
asoc-simple-card sound@1: tlv320aic3x-hifi <-> 48478000.mcasp mapping ok
tlv320aic3x-codec 2-001b: ASoC: Failed to set DAI format: -22
asoc-simple-card sound@2: tlv320aic3x-hifi <-> 4846c000.mcasp mapping ok

                                                Why is its failing to set DAI format?I made the following modification in davinci-evm.c

static struct snd_soc_dai_link evm_dai_tlv320aic3x = {
        .name           = "TLV320AIC3X",
        .stream_name    = "AIC3X",
        .codec_dai_name = "tlv320aic3x-hifi",
        .ops            = &evm_ops,
        .init           = evm_aic3x_init,
        /*.dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM |
                   SND_SOC_DAIFMT_IB_NF,*//*commented by murugan.s@fossilshale.com*/
/*      .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM |
                   SND_SOC_DAIFMT_IB_NF,*/
        .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_NB_NF,

};

My dts configuration related to sound and mcasp:

snd2: sound@1 {
               compatible = "simple-audio-card";
               simple-audio-card,name = "DRA7xx-EVM-snd2";
               simple-audio-card,widgets =
                       "Microphone",            "Mic Jack",
                       "Line",                  "Line In",
                       "Line",                  "Line Out",
                       "Headphone",             "HP Jack",
                       "Speaker",               "Speaker External";
               simple-audio-card,routing =
                       "HP Jack",               "HPLOUT",
                       "HP Jack",               "HPROUT",
                       "HP Jack",               "HPLCOM",
                       "HP Jack",               "HPRCOM",
                       "Speaker External",      "LLOUT",
                       "Speaker External",      "RLOUT",
                       "LINE2L",                "Line In",
                       "LINE2R",                "Line In";

               simple-audio-card,format = "i2s";
               simple-audio-card,bitclock-master = <&sound1_master>;
               simple-audio-card,frame-master = <&sound1_master>;
               simple-audio-card,bitclock-inversion;        /*uncommented  to make soc master*/
               sound1_master: simple-audio-card,cpu {
                        sound-dai = <&mcasp7>;
                        system-clock-direction = "out";
                      system-clock-frequency = <19200000>;
               };

               simple-audio-card,codec {
                       sound-dai = <&tlv320aic34_a>;
                    /*   bitclock-master;
                       frame-master;
                       bitclock-inversion;*/
                       system-clock-frequency = <19200000>;
                    /*  system-clock-frequency = <19200000>;*/
               };

  snd3: sound@2 {
               compatible = "simple-audio-card";
               simple-audio-card,name = "DRA7xx-EVM-snd3";
               simple-audio-card,widgets =
                       "Microphone", "Mic Jack",
                       "Line",                  "Line In",
                       "Line",                  "Line Out",
                       "Headphone",             "HP Jack",
                       "Speaker",               "Speaker External";
               simple-audio-card,routing =
                       "Line Out",              "MONO_LOUT",
                       "Speaker External",      "LLOUT",
                       "Speaker External",      "RLOUT",
                       "LINE1L",                "Line In",
                       "LINE1R",                "Line In",
                       "MIC3L",                 "Mic Jack",
                       "MIC3R",                 "Mic Jack";
               simple-audio-card,format = "i2s";
               simple-audio-card,bitclock-master = <&sound2_master>;
               simple-audio-card,frame-master = <&sound2_master>;
               simple-audio-card,bitclock-inversion; /*uncommented  to set SoC as master*/

               sound2_master: simple-audio-card,cpu {
                        sound-dai = <&mcasp4>;
                        system-clock-direction = "out";
                      system-clock-frequency = <19200000>;
               };

               simple-audio-card,codec {
                       sound-dai = <&tlv320aic34_b>;
                     /*  bitclock-master;
                       frame-master;
                       bitclock-inversion;*/ /*commented to make SoC master*/
                       system-clock-frequency = <19200000>;
                    /*  system-clock-frequency = <19200000>;*/
               };
        };

Pinmuxing for mcasp4 and 7:

 aic34_mcasp7: aic34_mcasp7 {
                 pinctrl-single,pins = <
                        0x29C (PIN_OUTPUT | MUX_MODE4) /*default ws 3*/ /* xref_clk2.mcasp7_ahclkx - MCLK */
                        0x2EC (PIN_INPUT | MUX_MODE1)  /* mcasp1_axr14.mcasp7_aclkx - BCLK */
                        0x2F0 (PIN_INPUT | MUX_MODE1)  /* mcasp1_axr15.mcasp7_fsx - WCLK */
                        0x2E8 (PIN_INPUT_PULLUP | MUX_MODE1)  /* mcasp1_axr13.mcasp7_axr1 - DIN */
                        0x2E4 (PIN_OUTPUT | MUX_MODE1)  /* mcasp1_axr12.mcasp7_axr0 - DOUT */
                        >;
        };

        aic34_mcasp4: aic34_mcasp4 {
                 pinctrl-single,pins = <
                        0x2A0 (PIN_OUTPUT | MUX_MODE3)  /* xref_clk3.mcasp4_ahclkx - MCLK */
                        0x334 (PIN_INPUT | MUX_MODE0)  /* mcasp4_aclkx.mcasp4_aclkx - BCLK */
                        0x338 (PIN_INPUT | MUX_MODE0)  /* mcasp4_fsx.mcasp4_fsx - WCLK */
                        0x340 (PIN_INPUT_PULLUP | MUX_MODE0)  /* mcasp4_axr1.mcasp4_axr1 - DIN */
                        0x33C (PIN_OUTPUT | MUX_MODE0)  /* mcasp4_axr0.mcasp4_axr0 - DOUT */
                        0x3C0 (PIN_OUTPUT_PULLUP | MUX_MODE14)  /* gpio7_14 */
                        0x158 (PIN_OUTPUT_PULLUP | MUX_MODE14)  /* .gpio3_29  */
                        0x190 (PIN_OUTPUT_PULLUP | MUX_MODE14)  /* gpio4_11 */
                >;
        };

&i2c3 {
        status = "okay";
        clock-frequency = <400000>;

        /*      Audio Codec for ITS, FS:NIRAJ   */

        tlv320aic34_a: tlv320aic34_a@1a {
                #sound-dai-cells = <0>;
                compatible = "ti,tlv320aic3x";
                reg = <0x1a>;
                adc-settle-ms = <40>;
                ai3x-micbias-vg = <1>;          /* 2.0V */
                gpio-reset = <&gpio2 26 GPIO_ACTIVE_LOW>;
                status = "okay";

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

        tlv320aic34_b: tlv320aic34_b@1b {
                #sound-dai-cells = <0>;
                compatible = "ti,tlv320aic3x";
                reg = <0x1b>;
                adc-settle-ms = <40>;
                ai3x-micbias-vg = <1>;          /* 2.0V */
                gpio_reset = <&gpio2 27 GPIO_ACTIVE_LOW>;
                status = "okay";

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

&mcasp7 {
        #sound-dai-cells = <0>;

        status = "okay";

        pinctrl-names = "default";
        pinctrl-0 = <&aic34_mcasp7>;

        op-mode = <0>;          /* MCASP_IIS_MODE */
        tdm-slots = <2>;
        /* 4 serializer */
        serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
                1 2 0 0
        >;
        tx-num-evt = <32>;
        rx-num-evt = <32>;
};
/* Mcasp 7 ITS end */

/* Mcasp 4 ITS */
&mcasp4 {
        #sound-dai-cells = <0>;

        status = "okay";

        pinctrl-names = "default";
        pinctrl-0 = <&aic34_mcasp4>;

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

Regards,

Murugan S

  • Hi,

                        This issue was fixed after commenting "simple-audio-card,bitclock-inversion;" part.But Im not sure why this was causing the error.

    Regards,

    Murugan S

  • Murugan,

    Where is evm_dai_tlv320aic3x structure defined at? I'm not sure I understand why you have that structure and also have a "simple card" (which you configure via dts).

    Re "bitblock-inversion", as per tlv320aic3x.c codec, "SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF" normal bit-clock and normal frame-sync is required for I2S. That explains why removing bitclock-inversion helped.