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.

[DM8127] using McASP0 + AIC23 instead of McASP2 + AIC3x

Hi TI,

In our custom board, I am using McASP0 with AIC23 codec, the AIC23 codec is attached on I2C bus 2 for control. I have read previous posts and made following changes: (I only list out the lines with changes)

In "board-ti8148ipnc.c"

static struct i2c_board_info __initdata mxv3_i2c_boardinfo[] = {
  { I2C_BOARD_INFO("tlv320aic23", 0x1A), }
};

static void __init ti814x_evm_i2c_init(void)
{
  omap_register_i2c_bus(2, 20, mxv3_i2c_boardinfo, ARRAY_SIZE(mxv3_i2c_boardinfo));
}

static struct snd_platform_data ti8148_evm_snd_data = {
  .tx_dma_offset = 0x46000000, /* McASP0: 4600_0000, McASP1: 4640_0000, McASP2: 4680_0000 */
  .rx_dma_offset = 0x46000000,

};

In "mach-omap2\devices.c":

// MXv3 use McASP0 instead of McASP2
static struct resource ti81xx_mcasp_resource_mxv3[] = {
{
  .name = "mcasp",
  .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,
  },
};

void __init ti81xx_register_mcasp(int id, struct snd_platform_data *pdata)
{
  if (machine_is_ti8168evm() || machine_is_ti8148evm() || machine_is_ti811xevm() || machine_is_ti8148ipnc()) {
  if ( machine_is_mxv3() )
  {
    ti81xx_mcasp_device.id = 0;
    ti81xx_mcasp_device.resource = ti81xx_mcasp_resource_mxv3;
    ti81xx_mcasp_device.num_resources = ARRAY_SIZE(ti81xx_mcasp_resource_mxv3);
  }

  ...
}

In "sound\soc\davinci\davinci-evm.c"

static void ti81xx_evm_dai_fixup(void)
{
  if (machine_is_ti8168evm() || machine_is_ti8148evm()
    || machine_is_ti8148ipnc() || machine_is_ti811xevm()) {
    if ( machine_is_mxv3() )
    {
      ti81xx_evm_dai[0].cpu_dai_name = "davinci-mcasp.0"; // McASP port 0
      ti81xx_evm_dai[0].codec_dai_name = "tlv320aic23-hifi"; // with AIC23
      ti81xx_evm_dai[0].codec_name = "tlv320aic23-codec.2-001a"; // codec using i2c ch 2, with addr 0x001a
    }

...
}

Also in Kernel configurations, I have enable AIC23 drivers, disable HDMI audio. Following kernel messages prompt out:

AIC23 Audio Codec 0.1                                                      <---- probing of AIC23 driver
tlv320aic23_write write 000 to register R15 done!       <---- as I have add kernel print in writing AIC23 registers
tlv320aic23_write write 047 to register R6 done!
tlv320aic23_write write 004 to register R5 done!
tlv320aic23_write write 117 to register R0 done!
tlv320aic23_write write 117 to register R1 done!
tlv320aic23_write write 010 to register R4 done!
tlv320aic23_write write 070 to register R2 done!
tlv320aic23_write write 070 to register R3 done!
tlv320aic23_write write 001 to register R9 done!
asoc: tlv320aic23-hifi <-> davinci-mcasp.0 mapping ok
ALSA device list:
#0: TI8148 IPNC

So I guess I have successfully loading the AIC23 driver on I2C 2, with McASP0. However, when I run the audio demo, when I open the pcm devices for audio capturing, it has following error message:

asoc: can't open platform davinci-pcm-audio

[host]

Audio capture task created ERROR (audio_capture.c|InitAudioCaptureDevice|395): unable to open pcm device: Device or resource busy
ipnc_rdk_mcfw.out: pcm.c:1304: snd_pcm_readi: Assertion `pcm' failed.

After further debugging, I found that the code failed at:

soc_pcm_open() -> davinci_pcm_open() -> davinci_pcm_dma_request() -> edma_alloc_channel() at following lines (channel number is 9)

else if (test_and_set_bit(channel, edma_info[ctlr]->edma_inuse)) {
  return -EBUSY;
}

So why DMA allocation fails? Do you guys have any hints on it? Thank you very much.

Regards,

ChingHok