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.

mcasp DMA error

Hi, we use DM8168 evm, RDK4.0.
I add a new audio code, and it has mapped OK.
But we capture the data, there has an error with following:
AUDIO: Capture -> capture error Input/output error, Calling recover !!!!!
In the kernel, the error is write error (DMA or IRQ trouble?).

The audio data format is I2S, I2S_CLK is connected to MCASP0_ACLKR, I2S_FSR is connected to MCASP0_AFSR, mcasp0 is slave.
I printf the register value:
root@dm816x:~#  mem_rdwr.out --rd 0x48038000 166 | grep -v "00000000"
 0x48038000: 44306B02
 0x48038004: 00000002
 0x4803801c: 20000000
 0x48038030: 0000C291
 0x48038038: 00000001
 0x48038044: 00000003
 0x48038060: 0000001F
 0x48038064: 0000FFFF
 0x48038068: 00018074
 0x4803806c: 00000101
 0x48038074: 00008000
 0x48038078: 00000003
 0x48038080: 00000104
 0x480380a0: 0000001F
 0x480380a4: 0000FFFF
 0x480380a8: 00000074
 0x480380ac: 00000001
 0x480380b0: 00180080
 0x480380b4: 00008000
 0x480380c0: 0000010C
 0x480380c4: 0000017F
 0x48038180: 00000002
 0x48038198: 00000002
 0x4803819c: 00000002
 0x480381a0: 00000002
 0x480381a4: 00000002
 0x480381a8: 00000002
 0x480381ac: 00000002
 0x480381b0: 00000002
 0x480381b4: 00000002
 0x480381b8: 00000002
 0x480381bc: 00000002
 The datasheet indicates reg 0x60 is alias of reg 0x44 for receive bits. so it should be same.

 Is there anyone who can know how to handle the problem?

Thanks.

  • Ketty,

    Are you using the PSP audio driver?

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_User_Guide

    The audio driver in the PSP package conforms to the ASoC framework in the Linux kernel. The current driver supports audio capture and playback using the AIC3106 codec on the EVM.

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_AUDIO_Driver_User_Guide

    Best Regards,
    Pavel

  • Please check also the below e2e threads which discuss this issue:

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/155480.aspx

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/229575.aspx

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/246455.aspx

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/253850.aspx

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/221980.aspx

    Regards,
    Pavel

  • Yes.

    And I have referenced of the five theards you post. And my setting is looked like with http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/p/262021/946707.aspx#946707.

    But the error is same.

  • The codec is slave, and mcasp is slave.

    2273.mcasp0.diff
    Index: sound/soc/codecs/Kconfig
    ===================================================================
    --- sound/soc/codecs/Kconfig	(revision 2854)
    +++ sound/soc/codecs/Kconfig	(working copy)
    @@ -41,6 +41,7 @@
     	select SND_SOC_TLV320DAC33 if I2C
     	select SND_SOC_TWL4030 if TWL4030_CORE
     	select SND_SOC_TVP5158AUDIO if I2C
    +	select SND_SOC_AD7619AUDIO
     	select SND_SOC_TWL6040 if TWL4030_CORE
     	select SND_SOC_UDA134X
     	select SND_SOC_UDA1380 if I2C
    @@ -189,6 +190,9 @@
     config SND_SOC_TVP5158AUDIO
     	tristate
     
    +config SND_SOC_AD7619AUDIO
    +	tristate
    +	
     config SND_SOC_TLV320DAC33
     	tristate
     
    Index: sound/soc/codecs/ad7619-audio.c
    ===================================================================
    --- sound/soc/codecs/ad7619-audio.c	(revision 0)
    +++ sound/soc/codecs/ad7619-audio.c	(revision 0)
    @@ -0,0 +1,71 @@
    +/*
    + * ALSA SoC AD7619 audio dummy driver
    + *
    + * This program is free software; you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License version 2 as
    + * published by the Free Software Foundation.
    + */
    +#include <linux/module.h>
    +#include <linux/moduleparam.h>
    +#include <linux/slab.h>
    +#include <sound/soc.h>
    +#include <sound/pcm.h>
    +#include <sound/initval.h>
    +
    +static struct snd_soc_codec_driver soc_codec_ad7619;
    +
    +static struct snd_soc_dai_driver ad7619_dai = {
    +	.name = "ad7619-hifi",
    +	.capture = {
    +		.stream_name = "Capture",
    +		.channels_min = 2,
    +		.channels_max = 16,
    +		.rates = (SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_44100),	
    +		.formats = SNDRV_PCM_FMTBIT_S16_LE,},
    +};
    +
    +static int ad7619_audio_codec_probe(struct platform_device *pdev)
    +{
    +	int ret;
    +
    +	ret = snd_soc_register_codec(&pdev->dev, &soc_codec_ad7619,
    +					&ad7619_dai, 1);
    +	if (ret < 0)
    +		printk(KERN_ERR "ad7619 Audio Codec Register Failed\n");
    +	
    +	printk(KERN_INFO "******Registered ad7619 audio codec\n");
    +	
    +	return ret;
    +}
    +
    +static int ad7619_audio_codec_remove(struct platform_device *pdev)
    +{
    +	snd_soc_unregister_codec(&pdev->dev);
    +	return 0;
    +}
    +
    +static struct platform_driver ad7619_audio_codec_driver = {
    +	.probe		= ad7619_audio_codec_probe,
    +	.remove		= ad7619_audio_codec_remove,
    +	.driver		= {
    +		.name	= "ad7619-audio",
    +		.owner	= THIS_MODULE,
    +	},
    +};
    +
    +static int __init ad7619_audio_init(void)
    +{
    +	return platform_driver_register(&ad7619_audio_codec_driver);
    +}
    +
    +static void __exit ad7619_audio_exit(void)
    +{
    +	platform_driver_unregister(&ad7619_audio_codec_driver);
    +	platform_driver_unregister(&ad7619_audio_codec_driver);
    +}
    +
    +module_init(ad7619_audio_init);
    +module_exit(ad7619_audio_exit);
    +
    +MODULE_DESCRIPTION("ad7619 ASOC codec Interface");
    +MODULE_LICENSE("GPL");
    
    Property changes on: sound/soc/codecs/ad7619-audio.c
    ___________________________________________________________________
    Added: svn:executable
       + *
    
    Index: sound/soc/codecs/Makefile
    ===================================================================
    --- sound/soc/codecs/Makefile	(revision 2854)
    +++ sound/soc/codecs/Makefile	(working copy)
    @@ -22,6 +22,7 @@
     snd-soc-stac9766-objs := stac9766.o
     snd-soc-tlv320aic23-objs := tlv320aic23.o
     snd-soc-tvp5158-audio-objs := tvp5158-audio.o
    +snd-soc-ad7619-audio-objs := ad7619-audio.o
     snd-soc-tlv320aic26-objs := tlv320aic26.o
     snd-soc-tlv320aic3x-objs := tlv320aic3x.o
     snd-soc-tlv320dac33-objs := tlv320dac33.o
    @@ -103,6 +104,7 @@
     obj-$(CONFIG_SND_SOC_TLV320DAC33)	+= snd-soc-tlv320dac33.o
     obj-$(CONFIG_SND_SOC_TWL4030)	+= snd-soc-twl4030.o
     obj-$(CONFIG_SND_SOC_TVP5158_AUDIO)	+= snd-soc-tvp5158-audio.o
    +obj-$(CONFIG_SND_SOC_AD7619_AUDIO)	+= snd-soc-ad7619-audio.o
     obj-$(CONFIG_SND_SOC_TWL6040)	+= snd-soc-twl6040.o
     obj-$(CONFIG_SND_SOC_UDA134X)	+= snd-soc-uda134x.o
     obj-$(CONFIG_SND_SOC_UDA1380)	+= snd-soc-uda1380.o
    Index: sound/soc/davinci/davinci-mcasp.c
    ===================================================================
    --- sound/soc/davinci/davinci-mcasp.c	(revision 2854)
    +++ sound/soc/davinci/davinci-mcasp.c	(working copy)
    @@ -359,6 +359,7 @@
     
     static void mcasp_start_rx(struct davinci_audio_dev *dev)
     {
    +    u32 val, val1;
     	mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXHCLKRST);
     	mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXCLKRST);
     	mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXSERCLR);
    @@ -370,13 +371,17 @@
     
     	mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXSMRST);
     	mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXFSRST);
    +
    +	val = mcasp_get_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG);
    +	val1 = mcasp_get_reg(dev->base + DAVINCI_MCASP_GBLCTL_REG);
    +	printk(KERN_ERR "################ mcasp start RX success, the val = %x, the val1= %x....\n", val, val1);
     }
     
     static void mcasp_start_tx(struct davinci_audio_dev *dev)
     {
     	u8 offset = 0, i;
     	u32 cnt;
    -
    +    u32 val;
     	mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLX_REG, TXHCLKRST);
     	mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLX_REG, TXCLKRST);
     	mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLX_REG, TXSERCLR);
    @@ -399,10 +404,13 @@
     		cnt++;
     
     	mcasp_set_reg(dev->base + DAVINCI_MCASP_TXBUF_REG, 0);
    +	val = mcasp_get_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG);
    +	printk(KERN_ERR "################ mcasp start TX success,the val = %x....\n", val);
     }
     
     static void davinci_mcasp_start(struct davinci_audio_dev *dev, int stream)
     {
    +    u32 cnt = 0;
     	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
     		if (dev->txnumevt)	/* enable FIFO */
     			mcasp_set_bits(dev->base + DAVINCI_MCASP_WFIFOCTL,
    @@ -413,19 +421,32 @@
     			mcasp_set_bits(dev->base + DAVINCI_MCASP_RFIFOCTL,
     								FIFO_ENABLE);
     		mcasp_start_rx(dev);
    +		while( ((mcasp_get_reg(dev->base + DAVINCI_MCASP_GBLCTL_REG)& mcasp_get_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG)) != 0x1f)
    +			     && cnt < 1000)
    +		{
    +		   mcasp_start_rx(dev);
    +		   cnt++;
    +		}
    +		printk("\n 3333333333333333333333 davinci_mcasp_start...\n");
     	}
     }
     
     static void mcasp_stop_rx(struct davinci_audio_dev *dev)
     {
    +    u32 val;
     	mcasp_set_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, 0);
     	mcasp_set_reg(dev->base + DAVINCI_MCASP_RXSTAT_REG, 0xFFFFFFFF);
    +	val = mcasp_get_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG);
    +	printk(KERN_ERR "################ mcasp stop RX success, the reg val = %d....\n", val);
     }
     
     static void mcasp_stop_tx(struct davinci_audio_dev *dev)
     {
    +    u32 val;
     	mcasp_set_reg(dev->base + DAVINCI_MCASP_GBLCTLX_REG, 0);
     	mcasp_set_reg(dev->base + DAVINCI_MCASP_TXSTAT_REG, 0xFFFFFFFF);
    +	val = mcasp_get_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG);
    +	printk(KERN_ERR "################ mcasp stop TX success, the val = %x....\n", val);
     }
     
     static void davinci_mcasp_stop(struct davinci_audio_dev *dev, int stream)
    @@ -448,7 +469,25 @@
     {
     	struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(cpu_dai);
     	void __iomem *base = dev->base;
    -
    +    u32 val;
    +	
    +    switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
    +	
    +    case SND_SOC_DAIFMT_I2S:
    +       //codec is using i2s data format 16 bits //bit0, bit4, bit8, register6c
    +      mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, 0x00000111);
    +      mcasp_set_bits(base + DAVINCI_MCASP_RXTDM_REG, 0x00000001); //???
    +       // bit16, bit15, bit6, bit5, bit4, bit2, register68, Receive bit stream format register
    +      mcasp_set_bits(base + DAVINCI_MCASP_RXFMT_REG, 0x00018074);
    +      mcasp_set_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL); //reg b0, Bit7, transmition
    +      
    +       mcasp_clr_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC);
    +	   mcasp_clr_bits(dev->base + DAVINCI_MCASP_AHCLKRCTL_REG, AHCLKRE);
    +	   val = mcasp_get_reg(dev->base + DAVINCI_MCASP_AHCLKRCTL_REG);
    +	   printk( "\n 1111111111111 davinci set dai fmt %x, the base = %x, the val = %x...\n", fmt, dev->base, val);
    +       break;
    +    }
    +    	
     	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
     	case SND_SOC_DAIFMT_CBS_CFS:
     		/* codec is clock and frame slave */
    @@ -657,7 +696,7 @@
     	if (dev->rxnumevt && stream == SNDRV_PCM_STREAM_CAPTURE) {
     		if (dev->rxnumevt * rx_ser > 64)
     			dev->rxnumevt = 1;
    -
    +        printk("\n rrrrrrrrrrrrrrrrr rxnumevt = %d, rx_ser = %d...\n", dev->rxnumevt, rx_ser);
     		mcasp_mod_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, rx_ser,
     								NUMDMA_MASK);
     		mcasp_mod_bits(dev->base + DAVINCI_MCASP_RFIFOCTL,
    @@ -817,7 +856,7 @@
     		dma_params->acnt = 4;
     	else
     		dma_params->acnt = dma_params->data_type;
    -
    +    printk("\n dddddddddddddd acnt = %d, fifo_level =  %d...\n ", fifo_level);
     	dma_params->fifo_level = fifo_level;
     	davinci_config_channel_size(dev, word_length);
     
    @@ -866,8 +905,8 @@
     				 struct snd_soc_dai *dai)
     {
     	struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai);
    -
     	snd_soc_dai_set_dma_data(dai, substream, dev->dma_params);
    +	printk( "2222222222222222222222 davinci_mcasp_startup...\n");
     	return 0;
     }
     
    @@ -1042,7 +1081,9 @@
     	ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]);
     	if (ret != 0)
     		goto err_iounmap;
    -
    +    printk("dddddddddd the dam addr = %x, channel=%d, fifo_level = %d, pdev_id = %d...\n",
    +		   dma_data->dma_addr, dma_data->channel, dma_data->fifo_level, pdev->id);
    +	
     #if defined(CONFIG_SND_TI81XX_SOC_UDDVR) || defined(CONFIG_SND_TI81XX_SOC_EVM)
     	if (pdev->id == 2)
     		mcasp_ahclkx_enable(dev);
    Index: sound/soc/davinci/Kconfig
    ===================================================================
    --- sound/soc/davinci/Kconfig	(revision 2854)
    +++ sound/soc/davinci/Kconfig	(working copy)
    @@ -67,6 +67,10 @@
     	tristate "TVP5158 Audio Codec support for DaVinci DM81XX EVM"
     	depends on (SND_TI81XX_SOC_UDDVR || SND_TI81XX_SOC_EVM) && SND_TI81XX_SOC
     
    +config SND_SOC_AD7619_AUDIO
    +	tristate "AD7619 Audio Codec support for DaVinci DM81XX EVM"
    +	depends on  SND_TI81XX_SOC_EVM && SND_TI81XX_SOC
    +	
     config SND_DAVINCI_SOC_SFFSDR
     	tristate "SoC Audio support for SFFSDR"
     	depends on SND_DAVINCI_SOC && MACH_SFFSDR
    Index: sound/soc/davinci/davinci-pcm.c
    ===================================================================
    --- sound/soc/davinci/davinci-pcm.c	(revision 2854)
    +++ sound/soc/davinci/davinci-pcm.c	(working copy)
    @@ -169,7 +169,10 @@
     	dma_pos = runtime->dma_addr + dma_offset;
     	fifo_level = prtd->params->fifo_level;
     
    -	pr_debug("davinci_pcm: audio_set_dma_params_play channel = %d "
    +	//pr_debug("davinci_pcm: audio_set_dma_params_play channel = %d "
    +	//	"dma_ptr = %x period_size=%x\n", link, dma_pos, period_size);
    +
    +	printk("############## davinci_pcm: audio_set_dma_params_play channel = %d "
     		"dma_ptr = %x period_size=%x\n", link, dma_pos, period_size);
     
     	data_type = prtd->params->data_type;
    @@ -217,12 +220,14 @@
     	struct davinci_runtime_data *prtd = substream->runtime->private_data;
     
     	print_buf_info(prtd->ram_channel, "i ram_channel");
    -	pr_debug("davinci_pcm: link=%d, status=0x%x\n", link, ch_status);
    +	//pr_debug("davinci_pcm: link=%d, status=0x%x\n", link, ch_status);
    +	printk("555555555555555 davinci_pcm: link=%d, status=0x%x\n", link, ch_status);
     
     	if (unlikely(ch_status != DMA_COMPLETE))
     		return;
     
     	if (snd_pcm_running(substream)) {
    +		pr_notice("\n 66666666666666666 snd_pcm_running...\n ");
     		if (prtd->ram_channel < 0) {
     			/* No ping/pong must fix up link dma data*/
     			spin_lock(&prtd->lock);
    @@ -399,11 +404,13 @@
     	/* Request ram link channel */
     	link = prtd->ram_link = edma_alloc_slot(
     			EDMA_CTLR(prtd->ram_channel), EDMA_SLOT_ANY);
    +
     	if (link < 0)
     		goto exit2;
     
     	link = prtd->asp_link[1] = edma_alloc_slot(
     			EDMA_CTLR(prtd->asp_channel), EDMA_SLOT_ANY);
    +
     	if (link < 0)
     		goto exit3;
     
    @@ -486,6 +493,7 @@
     	if (!params)
     		return -ENODEV;
     
    +	 printk("\n &&&&&&&&&&&&&&&&& 1111111111 into davinci_pcm_dma_request... \n");
     	/* Request asp master DMA channel */
     	link = prtd->asp_channel = edma_alloc_channel(params->channel,
     			davinci_pcm_dma_irq, substream,
    @@ -521,6 +529,7 @@
     		EDMA_TCC(EDMA_CHAN_SLOT(prtd->asp_channel));
     	prtd->asp_params.link_bcntrld = EDMA_CHAN_SLOT(link) << 5;
     	edma_write_slot(link, &prtd->asp_params);
    +	printk("\n ######################edma write slot....\n");
     	return 0;
     exit2:
     	edma_free_channel(prtd->asp_channel);
    @@ -541,6 +550,7 @@
     	case SNDRV_PCM_TRIGGER_RESUME:
     	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
     		edma_resume(prtd->asp_channel);
    +		printk("\n eeeeeeeeeeeee davinci_pcm_trigger: edma_resume\n");
     		break;
     	case SNDRV_PCM_TRIGGER_STOP:
     	case SNDRV_PCM_TRIGGER_SUSPEND:
    @@ -563,6 +573,7 @@
     
     	if (prtd->ram_channel >= 0) {
     		int ret = ping_pong_dma_setup(substream);
    +		printk("\n 777777777777777777 davinci_pcm_prepare...\n");
     		if (ret < 0)
     			return ret;
     
    @@ -603,8 +614,9 @@
     	unsigned int offset;
     	int asp_count;
     	dma_addr_t asp_src, asp_dst;
    -
    +   
     	spin_lock(&prtd->lock);
    +	printk("\n 99999999999999999999 davinci_pcm_pointer..\n");
     	if (prtd->ram_channel >= 0) {
     		int ram_count;
     		int mod_ram;
    @@ -644,10 +656,13 @@
     			asp_count = asp_src - runtime->dma_addr;
     		else
     			asp_count = asp_dst - runtime->dma_addr;
    +
    +		printk("\n 99999999999999999999 asp_count = %d, asp_dst = %x, dma_addr = %x..\n", asp_count, asp_dst, runtime->dma_addr);
     	}
     	spin_unlock(&prtd->lock);
     
     	offset = bytes_to_frames(runtime, asp_count);
    +	printk("\n 99999999999999999999 offset = %d..\n", offset);
     	if (offset >= runtime->buffer_size)
     		offset = 0;
     
    @@ -665,6 +680,7 @@
     	struct davinci_pcm_dma_params *params;
     
     	pa = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
    +	printk("\n 44444444444444444444 davinci_pcm_open, snd_soc_dai_get_dma_data, stream = 1..\n", substream->stream);
     	if (!pa)
     		return -ENODEV;
     	params = &pa[substream->stream];
    @@ -783,9 +799,12 @@
     	buf->area = dma_alloc_writecombine(pcm->card->dev, size,
     					   &buf->addr, GFP_KERNEL);
     
    -	pr_debug("davinci_pcm: preallocate_dma_buffer: area=%p, addr=%p, "
    -		"size=%d\n", (void *) buf->area, (void *) buf->addr, size);
    +//	pr_debug("davinci_pcm: preallocate_dma_buffer: area=%p, addr=%p, "
    +	//	"size=%d\n", (void *) buf->area, (void *) buf->addr, size);
     
    +	printk("davinci_pcm: preallocate_dma_buffer: area=%p, addr=%p, "
    +			"size=%d\n", (void *) buf->area, (void *) buf->addr, size);
    +
     	if (!buf->area)
     		return -ENOMEM;
     
    @@ -848,6 +867,7 @@
     			pcm_hardware_capture.buffer_bytes_max);
     		if (ret)
     			return ret;
    +		printk("\n @@@@@@@@@@@@@@@@davinci_pcm_new, this is capture\n");
     	}
     
     	return 0;
    Index: sound/soc/davinci/ti81xx-evm.c
    ===================================================================
    --- sound/soc/davinci/ti81xx-evm.c	(revision 2854)
    +++ sound/soc/davinci/ti81xx-evm.c	(working copy)
    @@ -61,8 +61,14 @@
     		/*
     		 * DSP_B Mode
     		 */
    -		fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM |
    -			 SND_SOC_DAIFMT_IB_NF;
    +		//fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_CBM_CFM |
    +		//	 SND_SOC_DAIFMT_IB_NF;
    +		/*
    +		 * I2S Mode
    +		 */
    +
    +        fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM |
    +			 SND_SOC_DAIFMT_NB_IF;
     	}
     	
     	/* set codec DAI configuration */
    @@ -70,8 +76,8 @@
     	/* set cpu DAI configuration */
     	snd_soc_dai_set_fmt(cpu_dai, fmt);
     	/* set the codec system clock */
    -	snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT);
    -
    +	//snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT);
    +    snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_IN);
     	return 0;
     }
     
    @@ -146,7 +152,7 @@
     }
     
     static struct snd_soc_dai_link ti81xx_mcasp_dai[] = {
    -	{
    +	/*{
     		.name = "TVP5158AUDIO",
     		.stream_name = "TVP-PCM",
     		.cpu_dai_name= "davinci-mcasp.0",
    @@ -154,8 +160,19 @@
     		.platform_name ="davinci-pcm-audio",
     		.codec_name = "tvp5158-audio",
     		.ops = &ti81xx_evm_ops,
    -	},
    +	}, */
    +
     	{
    +	   .name = "AD7619AUDIO",
    +	   .stream_name = "ADV-PCM",
    +	   .cpu_dai_name= "davinci-mcasp.0",
    +	   .codec_dai_name = "ad7619-hifi",
    +	   .platform_name ="davinci-pcm-audio",
    +	   .codec_name = "ad7619-audio",
    +	   .ops = &ti81xx_evm_ops,
    +    },
    +    
    +
     };
     #ifdef CONFIG_SND_SOC_TI81XX_HDMI
     static struct snd_soc_dai_link ti81xx_hdmi_dai = {
    Index: sound/core/pcm_lib.c
    ===================================================================
    --- sound/core/pcm_lib.c	(revision 2854)
    +++ sound/core/pcm_lib.c	(working copy)
    @@ -1729,7 +1729,7 @@
     	int err = 0;
     	snd_pcm_uframes_t avail = 0;
     	long tout;
    -
    +    
     	init_waitqueue_entry(&wait, current);
     	add_wait_queue(&runtime->tsleep, &wait);
     	for (;;) {
    @@ -2008,10 +2008,12 @@
     	struct snd_pcm_runtime *runtime = substream->runtime;
     	int err;
     	char __user *buf = (char __user *) data + frames_to_bytes(runtime, off);
    +	printk("\n tttttttttttttttt snd_pcm_lib_read_transfer...\n");
     	if (substream->ops->copy) {
    +		printk("\n tttttttttttttttt 111111111111111111...\n");
     		if ((err = substream->ops->copy(substream, -1, hwoff, buf, frames)) < 0)
     			return err;
    -	} else {
    +	} else { printk("\n tttttttttttttttt 222222222222222222...\n");
     		char *hwbuf = runtime->dma_area + frames_to_bytes(runtime, hwoff);
     		if (copy_to_user(buf, hwbuf, frames_to_bytes(runtime, frames)))
     			return -EFAULT;
    @@ -2062,6 +2064,7 @@
     		snd_pcm_uframes_t frames, appl_ptr, appl_ofs;
     		snd_pcm_uframes_t avail;
     		snd_pcm_uframes_t cont;
    +		printk("\n aaaaaaaaaaaaaaaaaaa the runtime->status->state = %d, nonblcok = %d...\n", runtime->status->state, nonblock);
     		if (runtime->status->state == SNDRV_PCM_STATE_RUNNING)
     			snd_pcm_update_hw_ptr(substream);
     		avail = snd_pcm_capture_avail(runtime);
    @@ -2078,6 +2081,7 @@
     			runtime->twake = min_t(snd_pcm_uframes_t, size,
     					runtime->control->avail_min ? : 1);
     			err = wait_for_avail(substream, &avail);
    +			printk("\n GGGGGGGGGGGGGGGGGGGGGG the err = %d\n", err);
     			if (err < 0)
     				goto _end_unlock;
     			if (!avail)
    @@ -2085,6 +2089,7 @@
     		}
     		frames = size > avail ? avail : size;
     		cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size;
    +		printk("\n aaaaaaaaaaaaaaaaaaa the frames = %ld, the cont = %ld...\n ", frames, cont);
     		if (frames > cont)
     			frames = cont;
     		if (snd_BUG_ON(!frames)) {
    @@ -2094,6 +2099,7 @@
     		}
     		appl_ptr = runtime->control->appl_ptr;
     		appl_ofs = appl_ptr % runtime->buffer_size;
    +		printk("\n aaaaaaaaaaaaaaaaaaa the frames = %ld, count = %ld, size = %ld, avail = %ld...\n",frames, cont, size, avail);
     		snd_pcm_stream_unlock_irq(substream);
     		err = transfer(substream, appl_ofs, data, offset, frames);
     		snd_pcm_stream_lock_irq(substream);
    Index: sound/core/pcm_native.c
    ===================================================================
    --- sound/core/pcm_native.c	(revision 2854)
    +++ sound/core/pcm_native.c	(working copy)
    @@ -380,6 +380,7 @@
     		return -ENXIO;
     	runtime = substream->runtime;
     	snd_pcm_stream_lock_irq(substream);
    +	printk("\n ^^^^^^^^^^^^^^ snd_pcm_hw_params, the status is %d...\n", runtime->status->state);
     	switch (runtime->status->state) {
     	case SNDRV_PCM_STATE_OPEN:
     	case SNDRV_PCM_STATE_SETUP:
    @@ -887,6 +888,7 @@
      */
     int snd_pcm_start(struct snd_pcm_substream *substream)
     {
    +   printk("\n aaaaaaaaaaaaaaaa snd_pcm_started...\n");
     	return snd_pcm_action(&snd_pcm_action_start, substream,
     			      SNDRV_PCM_STATE_RUNNING);
     }
    @@ -1346,6 +1348,7 @@
     	if ((res = snd_power_wait(card, SNDRV_CTL_POWER_D0)) >= 0)
     		res = snd_pcm_action_nonatomic(&snd_pcm_action_prepare,
     					       substream, f_flags);
    +	printk("\n ^^^^^^^^^^^^^^^^^ snd_pcm_prepare....\n");
     	snd_power_unlock(card);
     	return res;
     }
    Index: arch/arm/mach-omap2/devices.c
    ===================================================================
    --- arch/arm/mach-omap2/devices.c	(revision 2854)
    +++ arch/arm/mach-omap2/devices.c	(working copy)
    @@ -2980,6 +2980,7 @@
     #endif
     
     #if defined(CONFIG_ARCH_TI81XX)
    +
     static struct resource ti81xx_mcasp1_resource[] = {
     	{
     		.name = "mcasp",
    @@ -3023,6 +3024,7 @@
     };
     
     #ifdef CONFIG_SND_SOC_TVP5158_AUDIO
    +#if 0
     static struct platform_device tvp5158_audio_device = {
     	.name	= "tvp5158-audio",
     	.id	= -1,
    @@ -3052,6 +3054,48 @@
     	.rxnumevt	= 32,   
     };
     
    +static struct platform_device ti81xx_mcasp_tvp5158_device = {
    +	.name = "davinci-mcasp", /* driver name */
    +	.id = 0,
    +	.dev = {
    +		.platform_data = &tvp5158_snd_data,
    +		},
    +	.num_resources = ARRAY_SIZE(ti81xx_mcasp0_resource),
    +	.resource = ti81xx_mcasp0_resource,
    +};
    +#endif
    +#endif
    +
    +//#ifdef CONFIG_SND_SOC_AD7619_AUDIO
    +static struct platform_device ad7619_audio_device = {
    +	.name	= "ad7619-audio",
    +	.id	= -1,
    +};
    +
    +static u8 ad7619_iis_serializer_direction[] = {
    +	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,	INACTIVE_MODE,
    +};
    +
    +static struct snd_platform_data ad7619_snd_data = {
    +	.tx_dma_offset	= 0x46000000,
    +	.rx_dma_offset	= 0x46000000,
    +	.asp_chan_q	= EVENTQ_0,
    +	.tdm_slots	= 2, /* number of channels */
    +	.op_mode	= DAVINCI_MCASP_IIS_MODE,
    +	.num_serializer = ARRAY_SIZE(ad7619_iis_serializer_direction),
    +	.serial_dir	= ad7619_iis_serializer_direction,
    +	.version	= MCASP_VERSION_2,
    +    /* 
    +          * Having Max number of channels as mcasp fifo / edma read depth.
    +          * For 4ch this granularity is still 16 which is ok 
    +          */
    +	.txnumevt	= 0, //32,
    +	.rxnumevt	= 32,   
    +};
    +
     static struct resource ti81xx_mcasp0_resource[] = {
     	{
     		.name = "mcasp0",
    @@ -3073,16 +3117,16 @@
     	},
     };
     
    -static struct platform_device ti81xx_mcasp_tvp5158_device = {
    +static struct platform_device ti81xx_mcasp_ad7619_device = {
     	.name = "davinci-mcasp", /* driver name */
     	.id = 0,
     	.dev = {
    -		.platform_data = &tvp5158_snd_data,
    +		.platform_data = &ad7619_snd_data,
     		},
     	.num_resources = ARRAY_SIZE(ti81xx_mcasp0_resource),
     	.resource = ti81xx_mcasp0_resource,
     };
    -#endif
    +//#endif
     
     #ifdef CONFIG_SND_SOC_TLV320AIC3X
     static u8 aic3x_iis_serializer_direction[] = {
    @@ -3105,7 +3149,7 @@
     	.num_serializer = ARRAY_SIZE(aic3x_iis_serializer_direction),
     	.tdm_slots	= 2,
     	.serial_dir	= aic3x_iis_serializer_direction,
    -	.asp_chan_q	= EVENTQ_0,
    +	.asp_chan_q	= EVENTQ_2, //EVENTQ_0,
     	.version	= MCASP_VERSION_2,
     	.txnumevt	= 32,
     	.rxnumevt	= 32,
    @@ -3139,15 +3183,18 @@
     	/* TI811x AIC_MCLK is connected to SoC pin MCA2_AHCLKX */
     	//omap_mux_init_signal("xref_clk2.mcasp2_ahclkx", 0);
     #ifdef CONFIG_SND_SOC_TLV320AIC3X
    -	platform_device_register(&ti81xx_mcasp_aic_device);
    -    printk (KERN_DEBUG "\n**** Registering AIC & MCASP - Done\n");
    +//	platform_device_register(&ti81xx_mcasp_aic_device);
    +//    printk (KERN_DEBUG "\n**** Registering AIC & MCASP - Done\n");
     #endif
     
     #ifdef CONFIG_SND_SOC_TVP5158_AUDIO
    -    printk (KERN_DEBUG "\n**** Registering TVP5158 & MCASP0\n");
    -    platform_device_register(&tvp5158_audio_device);
    -    platform_device_register(&ti81xx_mcasp_tvp5158_device);
    +   // printk (KERN_DEBUG "\n**** Registering TVP5158 & MCASP0\n");
    +   // platform_device_register(&tvp5158_audio_device);
    +   // platform_device_register(&ti81xx_mcasp_tvp5158_device);
     #endif
    +    printk (KERN_NOTICE "\n**** Registering AD7619 & MCASP0\n");
    +    platform_device_register(&ad7619_audio_device);
    +    platform_device_register(&ti81xx_mcasp_ad7619_device);
     }
     #endif
    

  • Is there another suggestion?