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/AM3358: TLV320AIC3106 audio not working

Part Number: AM3358
Other Parts Discussed in Thread: TLV320AIC3104

Tool/software: Linux

Hi,

I am having beaglebone black,  I have connected the audio codec to beaglebone black pins as mentioned below,

            AM33XX_IOPAD(0x99c, PIN_INPUT_PULLDOWN | MUX_MODE2)                     /* mcasp0_axr2 */ pin - C12

            AM33XX_IOPAD(0x994, PIN_OUTPUT_PULLUP | MUX_MODE0)                       /* mcasp0_fsx */  pin - B13

            AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE0)                /*mcasp0_aclkx */ pin - A13

            AM33XX_IOPAD(0x998, PIN_OUTPUT_PULLUP | MUX_MODE0)                       /*mcasp0_axr0 */ pin -D12

I have given external clock to codec. I am getting BCLK,WCLK on scope.

I am able to list my device in ALSA.

root@am335x-evm:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Black [TI BeagleBone Black], device 0: davinci-mcasp.0-tlv320aic3x-hifi tlv320aic3x-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

But i am not able to read registers of the codec, when i try the i2cdetect

root@am335x-evm:~# i2cdetect -y -r 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- 

when i try to read register,

root@am335x-evm:~# i2cget -y -f 2 0x1b 0x0
Error: Read failed

What could be error, i am adding my dts nodes below please correct me.

&mcasp0    {
    #sound-dai-cells = <0>;
    pinctrl-names = "default";
    pinctrl-0 = <&mcasp0_pins>;
    status = "okay";
    op-mode = <0>;    /* MCASP_IIS_MODE */
    tdm-slots = <2>;
//    fck_parent = <&mcasp0_fck>;
    serial-dir = <    /* 0: INACTIVE, 1: TX, 2: RX */
            2 0 1 0 0
        >;
    tx-num-evt = <32>;
    rx-num-evt = <32>;
};

sound0:sound0 {
        compatible = "simple-audio-card";
        simple-audio-card,name = "TI BeagleBone Black";
        simple-audio-card,format = "i2s";
        simple-audio-card,widgets = "Line", "Line Out", "Line", "Line In", "Microphone", "Mic Jack";
        simple-audio-card,routing = "Line Out", "LLOUT", "LINE2R", "Line In", "LINE1L", "Line In", "LINE1R", "Line In", "MIC3L", "Mic Jack", "MIC3R", "Mic Jack", "Mic Jack", "Mic Bias";
        simple-audio-card,bitclock-master = <&dailink0_master>;
        simple-audio-card,frame-master = <&dailink0_master>;

        dailink0_master: simple-audio-card,cpu {
            sound-dai = <&mcasp0>;
            //system-clock-frequency = <&clk_mcasp0>;

        };

        simple-audio-card,codec {
            sound-dai = <&tlv320aic3104>;
            clocks = <&clk_mcasp0>;
        };
    };
};

i2c2_pins: pinmux_i2c2_pins {
        pinctrl-single,pins = <
            AM33XX_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE3)    /* uart1_ctsn.i2c2_sda */
            AM33XX_IOPAD(0x97c, PIN_INPUT_PULLUP | MUX_MODE3)    /* uart1_rtsn.i2c2_scl */
        >;
    };

&i2c2 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2c2_pins>;

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

    tlv320aic3104: tlv320aic3104@1b {
        #sound-dai-cells = <0>;
        compatible = "ti,tlv320aic3104";
        reg = <0x1b>;

        status = "okay";
        adc-settle-ms = <40>;

        ai3x-micbias-vg = <0x1>;
        AVDD-supply = <&ldo2_reg>;
        IOVDD-supply = <&ldo2_reg>;
        DRVDD-supply = <&ldo2_reg>;
        DVDD-supply = <&ldo2_reg>;        
    };

};

Thank You

  • Hi Vijay,

    Do you use AM335x TI PSDK Linux v5.02 (kernel v4.14.79)?

    I would suggest you to check your i2c2 pinmux in user space, thus verify that no other code has overwrite your DTS settings. You can use dveme2 tool to check registers conf_uart1_ctsn and conf_uart1_rtsn and verify they have the correct values.

    You should also measure with scope if tlv320aic3104 codec has MCLK input and frequency is with the range provided in datasheet.

    Regards,
    Pavel
  • Thanks for reply.

    I am using PSDK v5.01 .

    This are the devmem2 results,

    root@ngt:~# devmem2 0x44e10978
    /dev/mem opened.
    Memory mapped at address 0xbeff000.
    Read at address 0x44E10978 (0xb6eff978): 0x00000023

    root@ngt:~# devmem2 0x44e1097c
    /dev/mem opened.
    Memory mapped at address 0xb6f32000.
    Read at address 0x44E1097C (0xb6f3297c): 0x00000023

    I am giving external clock to codec of 18.38MHz, which i am getting on scope.

    Thanks,
    Vijay
  • Hi Pavel,

    Now i am able to read the register value.
    The reset was the pin of codec was the issue.

    Now i am not able to listen anything from the codec.

    root@am335x-evm:~# aplay Bandeya\ -\ Songs.pk\ -\ 128Kbps.wav
    Playing WAVE 'Bandeya - Songs.pk - 128Kbps.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
    aplay: pcm_write:2030: write error: Input/output error

    I am getting above error.
    I have checked with the scope i am getting WCLK,BCLK,MCLK(connected to codec externally).
    But when probed on DIN pin i am gettin high and when probed DOUT a low signal is coming (i have observed in audio file playing condition).

    BR,
    Vijay
  • Actually the problem is i am using mono lines, I have connected the jack to mono pins of codec. But when i probed the HPOUT line (in playing state) the data is coming, but not coming on mono pins.

    Will you please me guide how to configure mono in dts?

    BR,

    Vijay

  • Vijay,

    What is the console output when you play mono audio? Can you also attach the latest version of your DTS file?

    See also if below pointers will be in help:

    www.ti.com/.../sprac09a.pdf
    www.ti.com/.../sprac10.pdf

    e2e.ti.com/.../2231055
    e2e.ti.com/.../306253

    Regards,
    Pavel
  • If you have no more questions related to the subject of the e2e thread, please close/verify/resolve this thread.

    Regards,
    Pavel
  • I have a similar issue, I am not able to get audio on Line out. I can get audio on headphones on pins HPROUT and HPLOUT but not on MONO_LOP, MONO_LOM.

    I see in the device tree, audio is not routed to MONO_LOP or MONO_LOM. I added the route and widget in the device tree but still I just hear a noise on the speaker but no audio.

    simple-audio-card,widgets = "Headphone", "Headphone Jack", "Line", "Line In", "Ext Spk", "Line Out";
    simple-audio-card,routing = "Headphone Jack", "HPLOUT", "Headphone Jack", "HPROUT", "LINE1L", "Line In", "LINE1R", "Line In", "MONO_LOP", "Line Out", "MONO_LOM", "Line Out";

    During kernel boot I can see the error:

    asoc-simple-card sound: ASoC: DAPM widget 'Ext Spk' is not supported.

    How can I get audio from Mono line out?

    Thank you

  • Samer,

    Please open new e2e thread regarding your issue.

    Regards,
    Pavel