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.

Capture for mcasp0 only

Other Parts Discussed in Thread: TLV320AIC3106

Hi ,

I want to do with McAsp0 audio collection by sii9233a.
++Error:
arecord: pcm_read:1801: read error: Input/output error
++The value of the register:
DAVINCI_MCASP_PDIR_REG=0x00000001                ?
DAVINCI_MCASP_PDSET_REG=0x00000000            ? P1394 29 27 26
DAVINCI_MCASP_GBLCTL_REG=0x00000203         ? P1398 3 4 5
DAVINCI_MCASP_RXSTAT_REG=0x00000104          ?
DAVINCI_MCASP_RXMASK_REG=0x0000ffff
DAVINCI_MCASP_RXFMT_REG=0x00008074
DAVINCI_MCASP_RXFMCTL_REG=0x00000100

++Look at the CM_ALWON_MCASP0_CLKCTRL:
DAVINCI_MCASP0_CLKCTRL=0x00000002
DAVINCI_MCASP1_CLKCTRL=0x00030000
DAVINCI_MCASP2_CLKCTRL=0x00000002

++Pin Multiplexing
MCA[0]_AXR[0]=0x00000000
MCA[0]_AXR[1]=0x00000000
MCA[0]_AXR[2]=0x00000000
MCA[0]_AXR[3]=0x00000000
MCA[0]_AXR[4]=0x00000000
MCA[0]_AXR[5]=0x00000000

======

static u8 ti8168_iis_serializer_direction_0[] = {
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, 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,

}

ti81xx_register_mcasp(0, &ti8168_evm_snd_data_0);

------

The above is my main add code and debug information. Can be viewed from PDSET what reason? Hope to get help.

  • Hi user4252232,

    Do you use EZSDK 5.05.02.00?

    Do you use DM816x TI EVM or DM816x based custom board?

    Do you need to capture audio (arecord) with McASP0?

    See if the below wiki pages will be in help:
    processors.wiki.ti.com/.../TI81xx_PSP_Porting_Guide
    processors.wiki.ti.com/.../TI81XX_PSP_AUDIO_Driver_User_Guide - see Audio.zip ("Use different McASP instance").

    Regards,
    Pavel
  • Hi ,
    sorry, I don't have a clearly stated. I use DVRRDK_04.00.00.03 and DM816x based custom board .
    I have according to you give these documents to operate.
    Generate the equipment:
    root@ti81xx:~# arecord -l
    **** List of CAPTURE Hardware Devices ****
    card 0: SOUND0 [TI81XX ETV SOUND0], device 0: AIF1 rt5640-aif1-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    And then Run:
    arecord -D plughw:0,0 -d 10 -c 2 -t wav -r 44100 -f "Signed 16 bit Little Endian" /mnt/ti8168/test.wav
    An error:
    arecord: pcm_read:1801: read error: Input/output error
    I have modified it:
    static u8 ti8168_iis_serializer_direction_0[] = {
    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, 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,
    };
    ti81xx_register_mcasp(0, &ti8168_evm_snd_data_0);
    {
    .name = "RT5640",
    .stream_name = "AIF1",
    .cpu_dai_name= "davinci-mcasp.0",
    .codec_dai_name = "rt5640-aif1",
    .codec_name = "rt5640.1-001c",
    .platform_name = "davinci-pcm-audio",
    .init = ti81xx_evm_aic3x_init,
    .ops = &ti81xx_evm_ops,
    },
    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,
    };
    ti81xx_mcasp0_device.dev.platform_data = pdata;
    platform_device_register(&ti81xx_mcasp0_device);
  • Hi Mr cai,

    In DM816x TI EVM we have McASP2 connected to TLV320AIC3106 audio stereo codec, controlled through i2C0. While on your custom board you have McASP0 connected to RT5640 audio codec, controlled through I2C0?

    Mr cai said:
    arecord -D plughw:0,0 -d 10 -c 2

    Mr cai said:
    static u8 ti8168_iis_serializer_direction_0[] = {
    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, INACTIVE_MODE, INACTIVE_MODE,
    };

    I see you are trying to use 2 channels, one for transmit/playback and one for receive/capture. Have you check the RT5640 datasheet? Does RT5640 support this configuration (like AIC3106)? You have to compare AIC3106 and RT5640 to see if you can use RT5640 in the same way.

    Also RT5640 driver do not exist in DM816x DVRRDK 2.6.37 linux kernel, we have AIC3106 there, but not RT5640:

    linux-dvr-rdk-dm81xx/sound/soc/codecs/tlv320aic3x.c

    The RT5640 driver comes from v3.11 onwards. You can take it from AM335x SDK7:

    ti-sdk-am335x-evm-07.00.00.00/board-support/linux-3.12.10-ti2013.12.01/sound/soc/codecs/rt5640.c

    Did you integrate the RT5640 driver in the 2.6.37 dvr kernel?

    Mr cai said:
    .txnumevt = 1,
    .rxnumevt = 1,

    You might set there 32 or 64, see the below patch:

    Mr cai said:
    // .clk_input_pin = MCASP_AHCLKX_OUT,

    In DM816x TI EVM, the AIC3106 codec MCLK is clocked via a 24.576MHz oscillator. What about your custom board?

    Mr cai said:
    ti81xx_register_mcasp(0, &ti8168_evm_snd_data_0);

    In DVRRDK code base we have:

    linux-dvr-rdk-dm81xx/arch/arm/mach-omap2/board-ti8168dvr.c:    ti81xx_register_mcasp();

    linux-dvr-rdk-dm81xx/arch/arm/mach-omap2/board-ti8168evm.c:    ti81xx_register_mcasp();

    In both board files, ti81xx_register_mcasp() has not parameters.

    Mr cai said:
    {
    .name = "RT5640",
    .stream_name = "AIF1",
    .cpu_dai_name= "davinci-mcasp.0",
    .codec_dai_name = "rt5640-aif1",
    .codec_name = "rt5640.1-001c",
    .platform_name = "davinci-pcm-audio",
    .init = ti81xx_evm_aic3x_init,
    .ops = &ti81xx_evm_ops,
    },

    If your board is based on DVR board, you should use the below file:

    linux-dvr-rdk-dm81xx/sound/soc/davinci/ti81xx-uddvr.c

    If your board is based on EVM board, you should use the below file:

    linux-dvr-rdk-dm81xx/sound/soc/davinci/ti81xx-evm.c

    Mr cai said:
    .codec_name = "rt5640.1-001c",

    The codec_name is made up of the name used in the codec driver along with the I2C bus and I2C address (1-0018 for the EVM). So you have your RT5640 codec on I2C bus 1 (I2C0) on addr 0x1C?

    Have you made the pinmux for McASP0?

    Regards,
    Pavel