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/PROCESSOR-SDK-AM437X: Audio not working

Part Number: PROCESSOR-SDK-AM437X
Other Parts Discussed in Thread: TLV320AIC3106, TPS63031, AM4372

Tool/software: Linux

I am using last release of rt-linux sdk "ti-processor-sdk-linux-rt-am437x-evm-04.01.00.06". I have a custom board based on am437x-gp-evm. we are using "TLV320AIC3106IRGZT" audio codec.

I have done pin-muxing changes for mcasp0, and its proper as it is working on linux sdk  "ti-processor-sdk-linux-am437x-evm-02.00.01.07".

Here is the 'sound' node and 'tlv320aic3106' node in dts file i am using:

sound0: sound@0 {
compatible = "simple-audio-card";
simple-audio-card,name = "AM437x-GP-EVM";
simple-audio-card,widgets =
"Microphone", "Microphone Jack",
"Headphone", "Headphone Jack",
"Line", "Line In";
simple-audio-card,routing =
"Mono Out", "MONO_LOUT",
"LINE1L", "Mic Bias";
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 = <&mcasp1>;
system-clock-frequency = <12000000>;
};

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

tlv320aic3106: tlv320aic3106@1b {
#sound-dai-cells = <0>;
compatible = "ti,tlv320aic3106";
reg = <0x1b>;
status = "okay";
ai3x-micbias-vg = <MICBIAS_2_0V>;
gpio = <&gpio2 3 GPIO_ACTIVE_LOW>;

/* 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 = <&ldo1>; /* V1_8D -> LDO1 */
};

&mcasp1 {
#sound-dai-cells = <0>;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&mcasp1_pins>;
pinctrl-1 = <&mcasp1_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>;
};

In dmesg  i can see the driver is loading properly and codec mapping is ok.

[    1.714138] asoc-simple-card sound0: tlv320aic3x-hifi <-> 4803c000.mcasp mapping ok

[ 4.052082]  ALSA device list:

[ 4.055267]  #0: AM437x-GP-EVM

But there is no audio output when I am trying to play wav file using "aplay" or "AAC*" examples given in multimedia tab of matrix gui.

Any help what could be the problem. 

  • Hi Vimal,

    vimal kumar56 said:
    I am using last release of rt-linux sdk "ti-processor-sdk-linux-rt-am437x-evm-04.01.00.06".

    The latest rt-linux sdk release is "ti-processor-sdk-linux-rt-am437x-evm-04.02.00.09"

    vimal kumar56 said:
    I have a custom board based on am437x-gp-evm. we are using "TLV320AIC3106IRGZT" audio codec.

    Please describe the exact differences you have between your custom board and AM437x EVM regarding McASP, I2C and audio codec.

    vimal kumar56 said:
    But there is no audio output when I am trying to play wav file using "aplay" or "AAC*" examples given in multimedia tab of matrix gui.

    Please provide the full console output you have from the below commands:

      aplay -l

    aplay -Dplughw:0,0 <path to wav file>


    Pavel

  • vimal kumar56 said:
    I have done pin-muxing changes for mcasp0

    Do you actually mean McASP1? Can you clarify which McASP instance you are using on your custom board, McASP0 or McASP1? On AM437x TI EVM, McASP1 is used.

    vimal kumar56 said:
    simple-audio-card,widgets =
    "Microphone", "Microphone Jack",

    vimal kumar56 said:
    simple-audio-card,routing =
    "Mono Out", "MONO_LOUT",
    "LINE1L", "Mic Bias";

    Do you have Microphone on your custom board? On AM437x TI EVM, we do not have Micriphone, we have headphone out and line in.

    vimal kumar56 said:
    system-clock-frequency = <12000000>;

    Do you have an external 12MHz crystal oscillator on your custom board, to be used to generate the source clock for the audio codec?

    vimal kumar56 said:
    serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
    1 2 0 0

    On AM437x EVM we use mcasp1_axr2 and mcasp1_axr3, while on your custom board you are using mcasp1_axr0 and mcasp1_axr1, is that correct?

    Regards,
    Pavel

  • Hi Pavel,

    Thanks for looking into this. 

    We do have some changes with respect to am437x-evm. As for i2c1_scl and i2c1_sda in gp-evm they are using T20(spi0_cs0 in mode 2), T21(spi0_d1 in mode 2), But we are using B13, and B14 lines from the processor.

    i2c1_pins_default: i2c1_pins_default {
    pinctrl-single,pins = <
    AM4372_IOPAD(0x910, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE3) /* (B13) mii1_rx_er.I2C1_SCL */
    AM4372_IOPAD(0x90c, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE3) /* (B14) mii1_crs.I2C1_SDA */
    >;
    };

    we are using the same "tlv320aic3106" audio codec. We do have a microphone on our board.

    For MCASP, we are also using MCASP1 and MCASP1_AXR0 and MCASP1_AXR1 for audio out and mic respectively.

    There is difference between mcasp1 lines we are using from processor as what we are using is :

    mcasp1_pins: mcasp1_pins {
    pinctrl-single,pins = <
    AM4372_IOPAD(0x9a0, PIN_INPUT_PULLDOWN | MUX_MODE3) /* (L23) mcasp0_aclkr.mcasp1_aclkx */
    AM4372_IOPAD(0x9a4, PIN_INPUT_PULLDOWN | MUX_MODE3) /* (K23) mcasp0_fsr.mcasp1_fsx */
    AM4372_IOPAD(0x9a8, PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* (M25) mcasp0_axr1.mcasp1_axr0 */
    AM4372_IOPAD(0x9ac, PIN_INPUT_PULLDOWN | MUX_MODE3) /* (L24) mcasp0_ahclkx.mcasp1_axr1 */
    >;
    };

    But in am437x-gp-evm they are using:

    mii1_col.mcasp1_axr2

    mii1_crs.mcasp1_aclkx

    mii1_rxerr.mcasp1_fsx

    rmii1_ref_clk.mcasp1_axr3

     

    These are the output of the aplay command you have asked in your previous reply.

    root@am437x-evm:~#
    root@am437x-evm:~# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: AM437xGPEVM [AM437x-GP-EVM], device 0: davinci-mcasp.0-tlv320aic3x-hifi tlv320aic3x-hifi-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    root@am437x-evm:~#
    root@am437x-evm:~#
    root@am437x-evm:~# aplay -Dplughw:0,0 iphone_6_original.wav
    Playing WAVE 'iphone_6_original.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
    root@am437x-evm:~#
    root@am437x-evm:~#

    Warm Regards,

    Vimal Kumar

  • vimal kumar56 said:

    We do have some changes with respect to am437x-evm. As for i2c1_scl and i2c1_sda in gp-evm they are using T20(spi0_cs0 in mode 2), T21(spi0_d1 in mode 2), But we are using B13, and B14 lines from the processor.

    i2c1_pins_default: i2c1_pins_default {
    pinctrl-single,pins = <
    AM4372_IOPAD(0x910, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE3) /* (B13) mii1_rx_er.I2C1_SCL */
    AM4372_IOPAD(0x90c, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE3) /* (B14) mii1_crs.I2C1_SDA */
    >;
    };

    You have "i2c1_pins_default", while by default we have "i2c1_pins" in am437x-gp-evm.dts file. Do you update this DTS file as below?

    &i2c1 {
        status = "okay";
        pinctrl-names = "default";
        -pinctrl-0 = <&i2c1_pins>;
        +pinctrl-0 = <&i2c1_default>;

    You can also check if AIC3106 codec is properly detected on I2C1 pins B13/B14. You can use i2c user space tools. Check below wikis for more info:

    http://processors.wiki.ti.com/index.php/Linux_Core_I2C_User's_Guide

    vimal kumar56 said:

    We do have a microphone on our board.

    For MCASP, we are also using MCASP1 and MCASP1_AXR0 and MCASP1_AXR1 for audio out and mic respectively.

    In AM437x EVM, for audio playback/output we use mcasp1_axr2 pin and Headphone (J16). Do you have headphone on your custom board? If not, how do you verify that you do not have audio playback? You can measure with scope if mcasp1_axr0 pin have audio data during audio playback.

    In am437x-gp-evm.dts file we have the below Headphone code, which is missing from your DTS:

    simple-audio-card,routing =
                "Headphone Jack",    "HPLOUT",
                "Headphone Jack",    "HPROUT",

    Regards,
    Pavel

  • Hi Pavel,

    The pin-muxing and audio- codec routing is all proper. I am getting the sound from HDMI when booted with HDMI connected. we have a audio amplifier connected to codec which has a AMP_OFF gpio ( gpio2_3) which we shoud drive low for making the audio amplifier work.

    we are doing it through dts as:

    gpio_pins: gpio_pins {
    pinctrl-single,pins = <
    AM4372_IOPAD(0x894, PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* (E10) gpmc_oen_ren.gpio2_3 */
    AM4372_IOPAD(0x944, PIN_INPUT_PULLUP | MUX_MODE7) /* (A16) rmii1_ref_clk.gpio0_29 */
    >;
    };

    tlv320aic3106: tlv320aic3106@1b {
    #sound-dai-cells = <0>;
    compatible = "ti,tlv320aic3106";
    reg = <0x1b>;
    status = "okay";
    ai3x-micbias-vg = <MICBIAS_2_0V>;
    gpio = <&gpio2 3 GPIO_ACTIVE_LOW>;

    /* 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 = <&ldo1>; /* V1_8D -> LDO1 */
    };

    &gpio2 {
    status = "okay";
    p3 {
    gpio-hog;
    gpios = <3 GPIO_ACTIVE_HIGH>;
    output-low;
    line-name = "AMP_OFF";
    };
    };


    But after this also gpio2_3 is not going low, it is in high state. If i am making that gpio go low by hardware means sound is working.

    Any Idea why that gpio is still high with these changes?
    If I am missing any defconfig or something else? It seems he dts configuration for gpio pins is not working?

    warm regards,
    vimal
  • Vimal,

    Can you check what value you have in register CTRL_CONF_GPMC_OEN_REN/0x44E10894 in user space? You can use devmem2 tool.

    Your DTS gpio2_3 pinmux settings might be overwritten by the below DTS entry:

    am437x-gp-evm.dts

    nand_flash_x8: nand_flash_x8 {

    pinctrl-single,pins = <

    ......

    AM4372_IOPAD(0x894, PIN_OUTPUT | MUX_MODE0) /* gpmc_oen_ren.gpmc_oen_ren */

    ......

    >;

    };

     

    vimal kumar56 said:
    &gpio2 {
    status = "okay";
    p3 {
    gpio-hog;
    gpios = <3 GPIO_ACTIVE_HIGH>;
    output-low;
    line-name = "AMP_OFF";
    };
    };

     

    You need to add gpio_pins in gpio2 node. See for example gpio0 node:

    &gpio0 {
        pinctrl-names = "default";
        pinctrl-0 = <&gpio0_pins>;
        status = "okay";

     

    gpio0_pins: gpio0_pins {
            pinctrl-single,pins = <
                AM4372_IOPAD(0xa6c, PIN_OUTPUT | MUX_MODE9) /* spi2_cs0.gpio0_23 SEL_eMMCorNANDn */
            >;
        };

     

    See also below e2e thread for gpio-hog usage:

    Regards,
    Pavel

  • Hi Pavel,

    I changed the gpio2 node as you suggested and also disabled the nand_flash_x8 pin-muxing. Now I am getting the audio properly.

    Thanks
    vimal