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.

Audio by MCASP0 on BeagleBone

Hello all,

I need some help about audio on beaglebone. I have done some changes on kernel but I couldn't hear anything. But with same changes on linux sdk, there is no problem, I can hear audio.

We use tlv320aic3x codec with beaglebone-dvi-d card. We used I2C1 and there is no problem on communication with codec.  In spite of communication, codec doesn't run properly. There is no bit clock and frame sync. clock on codec. 

I can see below debugs while linux booting;

[    1.379332] asoc: tlv320aic3x-hifi <-> davinci-mcasp.0 mapping ok            
[ 1.386528] ALSA device list:
[ 1.389665] #0: AM335X EVM

And We used MCASP0 like below pinmuxs

/* Module pin mux for mcasp0 */
static struct pinmux_config mcasp0_pin_mux[] = {
{"mcasp0_aclkx.mcasp0_aclkx", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN},
{"mcasp0_fsx.mcasp0_fsx", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN},
{"mcasp0_ahclkr.mcasp0_axr2", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLDOWN},
{"mcasp0_ahclkx.mcasp0_axr3", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},
{NULL, 0},
};

 

  • Could you attach the full changes in patch format for us to analyze.

    Please note that we use a separate defconfig file for android on beaglebone. It may not be possible to use the kernel generated with the am335x_evm defconfig.

  • Sorry for delay in the response. I was on vacation and returned today morning.

    I didn't use am335x_evm_defconfig, I used am335x_evm_android_defconfig. I did below changes. Sorry it is not in patch format.

    arch/arm/mach-omap2/board-am335xevm.c

    static u8 am335x_iis_serializer_direction0[] = {
            INACTIVE_MODE,  INACTIVE_MODE,  TX_MODE,        RX_MODE,
            INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
            INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
            INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,  INACTIVE_MODE,
    };


    static struct snd_platform_data am335x_evm_snd_data0 = {
            .tx_dma_offset  = 0x46000000,   /* McASP0 */
            .rx_dma_offset  = 0x46000000,
            .op_mode        = DAVINCI_MCASP_IIS_MODE,
            .num_serializer = ARRAY_SIZE(am335x_iis_serializer_direction0),
            .tdm_slots      = 2,
            .serial_dir     = am335x_iis_serializer_direction0,
            .asp_chan_q     = EVENTQ_2,
            .version        = MCASP_VERSION_3,
            .txnumevt       = 1,
            .rxnumevt       = 1,
    };

    /* Module pin mux for mcasp0 */
    static struct pinmux_config mcasp0_pin_mux[] = {
    {"mcasp0_aclkx.mcasp0_aclkx", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN},
    {"mcasp0_fsx.mcasp0_fsx", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN},
    {"mcasp0_ahclkr.mcasp0_axr2", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLDOWN},
    {"mcasp0_ahclkx.mcasp0_axr3", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},
    {NULL, 0},
    };

    /* Setup McASP 0 */

    static void mcasp0_init(int evm_id, int profile)
    {
            /* Configure McASP */
            setup_pin_mux(mcasp0_pin_mux);
            am335x_register_mcasp0(&am335x_evm_snd_data0);
            return;
    }

    /* Beaglebone Rev A3 and after */
    static struct evm_dev_cfg beaglebone_dev_cfg[] = {
    {lcdc_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {tsc_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {mii1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {i2c1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {mcasp0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
    {NULL, 0, 0},
    };
    
    
    arch/arm/mach-omap2/devices.c


    static struct resource am335x_mcasp0_resource[] = {
            {
                    .name = "mcasp0",
                    .start = AM33XX_ASP0_BASE,
                    .end = AM33XX_ASP0_BASE + (SZ_1K * 12) - 1,
                    .flags = IORESOURCE_MEM,
            },
            /* TX event */  
            {
                    .start = AM33XX_DMA_MCASP0_X,
                    .end = AM33XX_DMA_MCASP0_X,
                    .flags = IORESOURCE_DMA,
            },
            /* RX event */
            {
                    .start = AM33XX_DMA_MCASP0_R,
                    .end = AM33XX_DMA_MCASP0_R,
                    .flags = IORESOURCE_DMA,
            },
    };      
            
    static struct platform_device am335x_mcasp0_device = {
            .name = "davinci-mcasp",
            .id = 0,
            .num_resources = ARRAY_SIZE(am335x_mcasp0_resource),
            .resource = am335x_mcasp0_resource,
    };
            
    void __init am335x_register_mcasp0(struct snd_platform_data *pdata)
    {       
            am335x_mcasp0_device.dev.platform_data = pdata;
            platform_device_register(&am335x_mcasp0_device);
    }
    
    
    sound/soc/davinci/davinci-evm.c

    static struct snd_soc_dai_link am335x_evm_dai = {
            .name = "TLV320AIC3X",
            .stream_name = "AIC3X",        
            .cpu_dai_name = "davinci-mcasp.0",
            .codec_dai_name = "tlv320aic3x-hifi",        
            .codec_name = "tlv320aic3x-codec.2-001b",
            .platform_name = "davinci-pcm-audio",
            .init = evm_aic3x_init,
            .ops = &evm_ops,
    };
    Thanks
    Mehmet
  • Hi Mehmet,

    So it seems you have enabled audio in beaglebone_dev_cfg.

    But Android AUDIO is still stubbed. After you verify alsa_aplay & arecord working, you can do the following

    diff --git a/BoardConfig.mk b/BoardConfig.mk
    index a377aa6..b74f585 100644
    --- a/BoardConfig.mk
    +++ b/BoardConfig.mk
    @@ -7,9 +7,9 @@ TARGET_NO_RADIOIMAGE := true
     
     USE_CAMERA_STUB := true
     
    -BOARD_USES_GENERIC_AUDIO := true
    -#BOARD_USES_ALSA_AUDIO := true
    -#BUILD_WITH_ALSA_UTILS := true
    +#BOARD_USES_GENERIC_AUDIO := true
    +BOARD_USES_ALSA_AUDIO := true
    +BUILD_WITH_ALSA_UTILS := true
     
     BUILD_PV_VIDEO_ENCODERS := 1

    Also note that, you need to perform a complete clean and rebuilt to build the right android audio libraries.

  • Arun,

    Thanks, It is ok.