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.

The confusion of register mcap0 in dm8168

Hello, TI engineer,
I want to register a McAsp0 sound devices in dm8168 , MCA [0] _AHCLKR, MCA [0] _ACLKR, MCA [0] _AFSR, MCA [0] _AXR [0] input source is in
the external processing of digital signal, no i2c control.This method is feasible in 8168?

  • Hi Mr cai,

    From what I understand, you want to replace the external audio codec with external DSP. If this DSP can provide audio data to DM816x McASP module, then your use case should be feasible. You can control the external DSP (if you need to control it) with SPI also.

    See also the below wiki pages:

    processors.wiki.ti.com/.../TI81xx_PSP_Porting_Guide
    processors.wiki.ti.com/.../TI81XX_PSP_AUDIO_Driver_User_Guide - make sure you will check into Audio.ppt
    processors.wiki.ti.com/.../TI81XX_PSP_04.04.00.02_Feature_Performance_Guide

    Regards,
    Pavel
  • Hi Pavel,
    Thanks for your reply ! if eable,the codec_dai_name and the codec_name how to modify in ti81xx_mcasp_dai .
    .codec_dai_name = "tlv320aic3x-hifi",
    .codec_name = "tlv320aic3x-codec.1-0018",
    I tried to remove these two parameters, but registration is not successful. Do you have any good Suggestions?
  • Mr cai,

    You can try with dummy codec, as explained in the TI81xx audio driver wiki that was already provided to you.

    The current version of the TI81XX audio driver only support stereo mode of operations due the codec limitations used in the EVM. To add the multi-channel audio capture support using an external capture setup (FPGA) connected to the McASP using single serializer follow the steps give bellow.

    Assumptions

       Audio captured data is provided to the McASP in Time Division Multiplex(TDM) format connected through a single serializer.

       The is no or little of configurations required for the codec or the FPGA are done outside similar to the HDMI codec used as the reference.

    Add the support in ALSA SoC Driver

    1. Add Dummy codec configurations. Please refer the sample dummy codec added for the HDMI driver and add similar one

    static struct snd_soc_dai_link ti81xx_evm_dai[] = {

              {

                          […..]     Remove the configurations for the AIC codec in the EVEM

              },

              {

                          .name = "DUMMY_SOC_LINK",

                          .stream_name = "dummy",

                          .cpu_dai_name = " davinci-mcasp.0",

                          .platform_name = "davinci-pcm-audio",

                          .codec_dai_name = " DUMMY-DAI-CODEC",     /* DAI name */

                          .codec_name = "dummy-dummy-codec", /*strings from dummy-codec driver*/        

              },

    }


    See also the below e2e threads, these discuss similar issue:

    Regards,
    Pavel

  • Hi Pavel,

    I have successfully registered a virtual device, but use the application of arecord ,the mistakes are as follows:
        ERROR: cannot open audio device (Invalid argument)
    I look up to the error code is in the "snd_pcm_open --> snd_pcm_hw_constraints_complete"
    I stick to modify the code:

    Ti81xx-etv.c

     

    static struct snd_soc_dai_link ti81xx_dummy_dai = {

                       .name = "DUMMY_SOC_LINK",

                       .stream_name = "dummy",

                       .cpu_dai_name = "davinci-mcasp.0",

                       .platform_name = "davinci-pcm-audio",

                       .codec_dai_name = "DUMMY-DAI-CODEC",

                       .codec_name = "dummy-dummy-codec",

    };

    -----

    static struct snd_soc_card ti81xx_evm_snd_card2 = {

             .name = "TI81XX ETV SOUND2",

             .dai_link = &ti81xx_dummy_dai,

             .num_links = 1,

    };

    static struct platform_device *ti81xx_pdev2;

    ------

             ti81xx_pdev2 = platform_device_alloc("soc-audio", 2);

             if (!ti81xx_pdev2) {

                       platform_device_put(ti81xx_pdev0);

                        platform_device_put(ti81xx_pdev1);

                       return -ENOMEM;

             }

     

             platform_set_drvdata(ti81xx_pdev2, &ti81xx_evm_snd_card2);

         ret = platform_device_add(ti81xx_pdev2);

         if (ret) {

          printk(KERN_ERR "Can't add soc platform device\n");

          platform_device_put(ti81xx_pdev0);

          platform_device_put(ti81xx_pdev1);

          platform_device_put(ti81xx_pdev2);

          return ret;

         }

    static void __exit ti81xx_evm_soc_exit(void)

    {

             ………….

            platform_device_unregister(ti81xx_pdev2);

    }

     

    Board-ti8168etv.c

    static u8 ti8168_iis_serializer_direction_0[] = {

            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,  INACTIVE_MODE,  INACTIVE_MODE,

    };

     

    static struct snd_platform_data ti8168_evm_snd_data_0 = {

            .tx_dma_offset  = 0x46000000,

            .rx_dma_offset  = 0x46000000,

            .op_mode        = DAVINCI_MCASP_IIS_MODE,

            .num_serializer = ARRAY_SIZE(ti8168_iis_serializer_direction_0),

            .tdm_slots      = 2,

            .serial_dir     = ti8168_iis_serializer_direction_0,

            .asp_chan_q     = EVENTQ_2,

            .version        = MCASP_VERSION_2,

            .txnumevt       = 1,

            .rxnumevt       = 1,

              .clk_input_pin         = MCASP_AHCLKX_OUT,

    };

     

    static struct platform_device ti8168_dummy_codec_device = {

             .name       = "dummy-dummy-codec",

             .id     = -1,

    };

    static struct platform_device *ti8168_devices[] __initdata = {

             &ti8168_hdmi_audio_device,

             &ti8168_hdmi_codec_device,

             &ti8168_dummy_codec_device,  //add

    };

    void __init ti8168_hdmi_mclk_init(void){don’t modify};

    ti81xx_register_mcasp(0, &ti8168_evm_snd_data_0); //add

    ti8168_hdmi_mclk_init();

    platform_add_devices(ti8168_devices, ARRAY_SIZE(ti8168_devices));

    devices.c (mach-omap2)

     

    static struct resource ti81xx_mcasp0_resource[] = {

             {

                       .name = "mcasp0",

                       .start = TI81XX_ASP0_BASE,

                       .end = TI81XX_ASP0_BASE + (SZ_1K * 12) - 1,

                       .flags = IORESOURCE_MEM,

             },

             /* TX event */

             {

                       .start = TI81XX_DMA_MCASP0_AXEVT,

                       .end = TI81XX_DMA_MCASP0_AXEVT,

                       .flags = IORESOURCE_DMA,

             },

             /* RX event */

             {

                       .start = TI81XX_DMA_MCASP0_AREVT,

                       .end = TI81XX_DMA_MCASP0_AREVT,

                       .flags = IORESOURCE_DMA,

             },

    };

     

    static struct platform_device ti81xx_mcasp0_device = {

             .name = "davinci-mcasp", /* driver name */

             .id = 0,

             .num_resources = ARRAY_SIZE(ti81xx_mcasp0_resource),

             .resource = ti81xx_mcasp0_resource,

    };

     

    void __init ti81xx_register_mcasp(int id, struct snd_platform_data *pdata)

    {

            ti81xx_mcasp0_device.dev.platform_data = pdata;

            platform_device_register(&ti81xx_mcasp0_device);

    }

  • Mr cai said:
    I have successfully registered a virtual device, but use the application of arecord ,the mistakes are as follows:
        ERROR: cannot open audio device (Invalid argument)

    Can you provide full console log output of the linux kernel boot up and after executing the below commands?

    # arecord -l

    # arecord -D 'hw:0,0'

    # arecord -D 'hw:2,0'

    D = Device id (Represented with 'hw: <cardId,deviceId>') 


    Regards,
    Pavel
  • Hi Pavel Botev,

      Thanks for your reply! This won't be wrong, I use AIC3254 to record is ok!

    arecord -D plughw:2,0 -d 5 -c 2 -t wav -r 44100 -f "Signed 16 bit Little Endian" ./test.wav

     I modify the davinci_mcasp_dai[] in davinci - McAsp. c , i remove the playback only keep capture,then it can record, but only 44 bytes.

    MCASP0 Only do receiving , I want to ask how to make the input i2s and McAsp0 on the corresponding virtual equipment, (How the interaction between)  which is to modify the file?

  • Mr cai,

    So on your DM816x custom board you have:

    McASP0 to external DSP
    McASP2 to external AIC3254

    And McASP2 to AIC3254 works fine, but McASP0 to DSP do not.

    Have you check the McASP0 pinmux? Please dump the McASP0 pinmux setings just before starting the receiving and send me the values you have in the pinmux registers.

    I previously request also the full console log output of the linux kernel boot up, but it is not provided to that moment. Do you need more details what linux kernel boot up log is and how to be provided?

    Regards,
    Pavel
  • Note also that you should have two capture devices, check this with "arecord -l"

    For example, on DM816x TI EVM, on card 0, device 0 we have aic3x codec, invoke with -Dhw:0,0
    On card 0, device 1, we have HDMI, invoke with -Dhw:0,1

    You should have something similar on your custom board, -Dhw:x,x for Aic32 and DSP.

    Regards,
    Pavel