The TI E2E™ design support forums will undergo maintenance from Sept. 28 to Oct. 2. If you need design support during this time, contact your TI representative or open a new support request with our customer support center.

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.

TLV320AIC32X4SW-LINUX: TLV320aic32x4 : getting aplay: pcm_write: write error: Input/output error

Part Number: TLV320AIC32X4SW-LINUX
Other Parts Discussed in Thread: TDA4VM

Hi

Our project use TDA4vm  k3-j721e

audio codec : tlv320aic32x4

~# aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=tlv320aic32x4
tlv320aic32x4, davinci-mcasp.0-tlv320aic32x4-hifi tlv320aic32x4-hifi-0
Default Audio Device
sysdefault:CARD=tlv320aic32x4
tlv320aic32x4, davinci-mcasp.0-tlv320aic32x4-hifi tlv320aic32x4-hifi-0

Default Audio Device

~# aplay -D sysdefault:CARD=tlv320aic32x4 /usr/share/sounds/alsa/Side_Left.wav

Playing WAVE '/usr/share/sounds/alsa/Side_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: pcm_write:2059: write error: Input/output error

My device tree about audio is as below:

We use AUDIO_EXT_REFCLK0 for audio mclk and mcasp6 for i2s.

Could  this pinmux AUDIO_EXT_REFCLK0 for mclk ?

Does my settings be correct or something missed ?

sound {
compatible = "simple-audio-card";
simple-audio-card,name = "tlv320aic32x4";
simple-audio-card,widgets =
"Headphone", "Headphone Jack",
"Speaker", "Speaker",
"Line", "Line In",
"Line", "Line Out";
simple-audio-card,routing =
"IN2_L", "Line In",
"IN2_R", "Line In",
"Line Out", "LOL",
"Line Out", "LOR";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&sound_master>;
simple-audio-card,frame-master = <&sound_master>;
simple-audio-card,bitclock-inversion;

sound_master: simple-audio-card,cpu {
sound-dai = <&mcasp6>;
system-clock-frequency = <24576000>;
system-clock-direction = "out";
};

simple-audio-card,codec {
sound-dai = <&tlv320aic32x4_codec>;
system-clock-frequency = <24576000>;
};
};

audio_ext_refclk0_pins_default: audio-ext-refclk0-pins-default {
pinctrl-single,pins = <
J721E_IOPAD(0x1c, PIN_OUTPUT, 6) /* (AD22) PRG1_PRU0_GPO6.AUDIO_EXT_REFCLK0 */ /* mclk */
>;
};

mcasp6_pins_default: mcasp6-pins-default {
                pinctrl-single,pins = <
                        J721E_IOPAD(0x04, PIN_OUTPUT_PULLDOWN, 12) /* (AC23) PRG1_PRU0_GPO0.MCASP6_ACLKX */ /* bclk */
                        J721E_IOPAD(0x08, PIN_OUTPUT_PULLDOWN, 12) /* (AG22) PRG1_PRU0_GPO1.MCASP6_AFSX */ /* wclk */
                        J721E_IOPAD(0x0c, PIN_OUTPUT_PULLDOWN, 12) /* (AF22) PRG1_PRU0_GPO2.MCASP6_AXR0 */  /* CODEC_DIN  */
                        J721E_IOPAD(0x10, PIN_INPUT_PULLDOWN, 12)  /* (AJ23) PRG1_PRU0_GPO3.MCASP6_AXR1 */  /* CODEC_DOUT */
                >;
       };

&k3_clks {
pinctrl-names = "default";
pinctrl-0 = <&audio_ext_refclk0_pins_default>;
};


&main_i2c4 {
pinctrl-names = "default";
pinctrl-0 = <&main_i2c4_pins_default>;
clock-frequency = <400000>;

tlv320aic32x4_codec: tlv320aic32x4@18 {
compatible = "ti,tlv320aic32x4";
reg = <0x18>;
#sound-dai-cells = <0>;
clocks = <&k3_clks 157 371>;
clock-names = "mclk";
assigned-clocks = <&k3_clks 157 371>;
assigned-clock-parents = <&k3_clks 157 400>;
assigned-clock-rates = <24576000>;
pinctrl-names = "default";
pinctrl-0 = <&codec_reset_pins_default>;
reset-gpios = <&main_gpio0 40 GPIO_ACTIVE_LOW>;
iov-supply = <&vsys_3v3>;
ldoin-supply = <&vsys_3v3>;
};

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

        pinctrl-names = "default";
        pinctrl-0 = <&mcasp6_pins_default>;
        op-mode = <0>;          /* MCASP_IIS_MODE */
        tdm-slots = <16>;
        auxclk-fs-ratio = <256>;
        /* 16 serializers */
        serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
                1 2 0 0
                0 0 0 0
                0 0 0 0
                0 0 0 0
        >;
        tx-num-evt = <1>;
        rx-num-evt = <1>;
        status = "okay";
};

BR

Addis

  • Hi,

    We will get our Linux expert to comment on your settings.

    They are in China so likely it will be tomorrow before you can hear from them.

    Regards.

  • Hi

    Could you check if i2cdetect and i2cdump work?

    And if the soundcard register well?

  • Hi

    Yes, i2cdetec could detect codec at address 0x18.

    We could see the sound card : /proc/asound/card0 and aplay -L as well.

  • Who is the master and are you seeing the correct MCLK, WCLK and BCLK?

  • Hi,

    As the dts shows the TDA4vm  k3-j721e is master and J721E_IOPAD(0x1c, PIN_OUTPUT, 6) defines pinmux as AUDIO_EXT_REFCLK0 for mclk. I am not sure whether these settings are correct or not.

    Currently the mclk output is not correct.

  • The aplay error is normally due to clock, so please refer to your host guide of generating these clocks.

  • Hi Addis

    I wonder what's the matter with the bootup log. Would you be so kind and share with us? 

    One more thing, in this case whether tlv320aic32x4 is used as master, which will produce the bclk and WS clk, and TDA4vm offer it the MCLK?

    BR

    Shenghao Ding

  • Hi,

    I share the schematic of TDA4vm and tvl320aic32x4.

    As the hw design, the mclk is generated from TDA4vm : AUDIO_EXT_REFCLK0 and bckl and wclk is also outputed from TDA4vm.

    So TDA4vm should be the master.

    BR

    Addis

  • Hi Addis

    Since aic32x4 is the master device, so bitclock-master and frame-master must use the clk generated by aic32x4 

    We should modify as foollowing

    ..................................

    simple-audio-card,format = "i2s";
    simple-audio-card,bitclock-master = <&sound_master>;
    simple-audio-card,frame-master = <&sound_master>;
    simple-audio-card,bitclock-inversion;

    sound_master:simple-audio-card,cpu {
    sound-dai = <&mcasp6>;
    system-clock-frequency = <24576000>;
    system-clock-direction = "out";
    };

    sound_master:simple-audio-card,codec {
    sound-dai = <&tlv320aic32x4_codec>;
    system-clock-frequency = <24576000>;
    };

    .........................................

    following is the sample dts for your reference

  • Hi

    You mean the mclk must be generated from aic32x4 and bclk and wclk use the clk from aic32x4?

    BR

    Addis

  • Hi,

    I modify aic32x4 as master and refer the sample dts to configure mclk outputed from TDA4m

    simple-audio-card,format = "i2s";
    simple-audio-card,bitclock-master = <&sound_master>;
    simple-audio-card,frame-master = <&sound_master>;
    simple-audio-card,bitclock-inversion;

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

    sound_master: simple-audio-card,codec {
    sound-dai = <&tlv320aic32x4_codec>;
    system-clock-frequency = <12000000>;
    };

    mcasp6_pins_default: mcasp6-pins-default {
    pinctrl-single,pins = <
    J721E_IOPAD(0x04, PIN_INPUT_PULLDOWN, 12) /* (AC23) PRG1_PRU0_GPO0.MCASP6_ACLKX */ /* bclk */
    J721E_IOPAD(0x08, PIN_INPUT_PULLDOWN, 12) /* (AG22) PRG1_PRU0_GPO1.MCASP6_AFSX */ /* wclk */
    J721E_IOPAD(0x0c, PIN_OUTPUT_PULLDOWN, 12) /* (AF22) PRG1_PRU0_GPO2.MCASP6_AXR0 */ /* CODEC_DIN */
    J721E_IOPAD(0x10, PIN_INPUT_PULLDOWN, 12) /* (AJ23) PRG1_PRU0_GPO3.MCASP6_AXR1 */ /* CODEC_DOUT */
    >;
    };

    audio_ext_refclk0_pins_default: audio-ext-refclk0-pins-default {
    pinctrl-single,pins = <
    J721E_IOPAD(0x1c, PIN_OUTPUT_PULLDOWN, 6) /* (AD22) PRG1_PRU0_GPO6.AUDIO_EXT_REFCLK0 */ /* mclk */
    >;
    };

    &k3_clks {
    pinctrl-names = "default";
    pinctrl-0 = <&audio_ext_refclk0_pins_default>;
    };

    But the mck still has no output. Could k3_clks generate the mclk ? 

  • Kindly consult the Platform vendor. Thanks.