aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorChaithrika U S <chaithrika@ti.com>2009-09-30 17:32:27 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-09-30 08:43:55 -0400
commit4fa9c1a5953441e06dbde7b6a655cbf6618e61dd (patch)
tree661628c2ba19c95bdb3dc4ecb26bb1a405e78ea8 /sound
parentbe2500b8353d41463399e997fe8562f772dcaaba (diff)
ASoC: DaVinci: McASP FIFO related updates
The DMA params for McASP with FIFO has been updated so that it works for various FIFO levels. A member- 'fifo_level' has been added to the DMA params data structure. The fifo_level can be adjusted by the tx[rx]_numevt platform data. This is relevant only for DA8xx/OMAP-L1xx platforms. This implementation has been tested for numevt values 1, 2, 4, 8. Signed-off-by: Chaithrika U S <chaithrika@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/davinci/davinci-i2s.c2
-rw-r--r--sound/soc/davinci/davinci-mcasp.c17
-rw-r--r--sound/soc/davinci/davinci-pcm.c21
-rw-r--r--sound/soc/davinci/davinci-pcm.h1
4 files changed, 28 insertions, 13 deletions
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index 4ae707048021..2ab809359c08 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -397,6 +397,8 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
397 } 397 }
398 398
399 dma_params->acnt = dma_params->data_type; 399 dma_params->acnt = dma_params->data_type;
400 dma_params->fifo_level = 0;
401
400 rcr |= DAVINCI_MCBSP_RCR_RFRLEN1(1); 402 rcr |= DAVINCI_MCBSP_RCR_RFRLEN1(1);
401 xcr |= DAVINCI_MCBSP_XCR_XFRLEN1(1); 403 xcr |= DAVINCI_MCBSP_XCR_XFRLEN1(1);
402 404
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 5d1f98a4c978..50ad0519a8fa 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -714,16 +714,13 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
714 struct davinci_pcm_dma_params *dma_params = 714 struct davinci_pcm_dma_params *dma_params =
715 &dev->dma_params[substream->stream]; 715 &dev->dma_params[substream->stream];
716 int word_length; 716 int word_length;
717 u8 numevt; 717 u8 fifo_level;
718 718
719 davinci_hw_common_param(dev, substream->stream); 719 davinci_hw_common_param(dev, substream->stream);
720 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 720 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
721 numevt = dev->txnumevt; 721 fifo_level = dev->txnumevt;
722 else 722 else
723 numevt = dev->rxnumevt; 723 fifo_level = dev->rxnumevt;
724
725 if (!numevt)
726 numevt = 1;
727 724
728 if (dev->op_mode == DAVINCI_MCASP_DIT_MODE) 725 if (dev->op_mode == DAVINCI_MCASP_DIT_MODE)
729 davinci_hw_dit_param(dev); 726 davinci_hw_dit_param(dev);
@@ -751,12 +748,12 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
751 return -EINVAL; 748 return -EINVAL;
752 } 749 }
753 750
754 if (dev->version == MCASP_VERSION_2) { 751 if (dev->version == MCASP_VERSION_2 && !fifo_level)
755 dma_params->data_type *= numevt; 752 dma_params->acnt = 4;
756 dma_params->acnt = 4 * numevt; 753 else
757 } else
758 dma_params->acnt = dma_params->data_type; 754 dma_params->acnt = dma_params->data_type;
759 755
756 dma_params->fifo_level = fifo_level;
760 davinci_config_channel_size(dev, word_length); 757 davinci_config_channel_size(dev, word_length);
761 758
762 return 0; 759 return 0;
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index 359e99ec7244..1152d8ba8970 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -66,38 +66,53 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
66 dma_addr_t dma_pos; 66 dma_addr_t dma_pos;
67 dma_addr_t src, dst; 67 dma_addr_t src, dst;
68 unsigned short src_bidx, dst_bidx; 68 unsigned short src_bidx, dst_bidx;
69 unsigned short src_cidx, dst_cidx;
69 unsigned int data_type; 70 unsigned int data_type;
70 unsigned short acnt; 71 unsigned short acnt;
71 unsigned int count; 72 unsigned int count;
73 unsigned int fifo_level;
72 74
73 period_size = snd_pcm_lib_period_bytes(substream); 75 period_size = snd_pcm_lib_period_bytes(substream);
74 dma_offset = prtd->period * period_size; 76 dma_offset = prtd->period * period_size;
75 dma_pos = runtime->dma_addr + dma_offset; 77 dma_pos = runtime->dma_addr + dma_offset;
78 fifo_level = prtd->params->fifo_level;
76 79
77 pr_debug("davinci_pcm: audio_set_dma_params_play channel = %d " 80 pr_debug("davinci_pcm: audio_set_dma_params_play channel = %d "
78 "dma_ptr = %x period_size=%x\n", lch, dma_pos, period_size); 81 "dma_ptr = %x period_size=%x\n", lch, dma_pos, period_size);
79 82
80 data_type = prtd->params->data_type; 83 data_type = prtd->params->data_type;
81 count = period_size / data_type; 84 count = period_size / data_type;
85 if (fifo_level)
86 count /= fifo_level;
82 87
83 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 88 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
84 src = dma_pos; 89 src = dma_pos;
85 dst = prtd->params->dma_addr; 90 dst = prtd->params->dma_addr;
86 src_bidx = data_type; 91 src_bidx = data_type;
87 dst_bidx = 0; 92 dst_bidx = 0;
93 src_cidx = data_type * fifo_level;
94 dst_cidx = 0;
88 } else { 95 } else {
89 src = prtd->params->dma_addr; 96 src = prtd->params->dma_addr;
90 dst = dma_pos; 97 dst = dma_pos;
91 src_bidx = 0; 98 src_bidx = 0;
92 dst_bidx = data_type; 99 dst_bidx = data_type;
100 src_cidx = 0;
101 dst_cidx = data_type * fifo_level;
93 } 102 }
94 103
95 acnt = prtd->params->acnt; 104 acnt = prtd->params->acnt;
96 edma_set_src(lch, src, INCR, W8BIT); 105 edma_set_src(lch, src, INCR, W8BIT);
97 edma_set_dest(lch, dst, INCR, W8BIT); 106 edma_set_dest(lch, dst, INCR, W8BIT);
98 edma_set_src_index(lch, src_bidx, 0); 107
99 edma_set_dest_index(lch, dst_bidx, 0); 108 edma_set_src_index(lch, src_bidx, src_cidx);
100 edma_set_transfer_params(lch, acnt, count, 1, 0, ASYNC); 109 edma_set_dest_index(lch, dst_bidx, dst_cidx);
110
111 if (!fifo_level)
112 edma_set_transfer_params(lch, acnt, count, 1, 0, ASYNC);
113 else
114 edma_set_transfer_params(lch, acnt, fifo_level, count,
115 fifo_level, ABSYNC);
101 116
102 prtd->period++; 117 prtd->period++;
103 if (unlikely(prtd->period >= runtime->periods)) 118 if (unlikely(prtd->period >= runtime->periods))
diff --git a/sound/soc/davinci/davinci-pcm.h b/sound/soc/davinci/davinci-pcm.h
index 8746606efc89..c8b0d2baf05a 100644
--- a/sound/soc/davinci/davinci-pcm.h
+++ b/sound/soc/davinci/davinci-pcm.h
@@ -23,6 +23,7 @@ struct davinci_pcm_dma_params {
23 enum dma_event_q eventq_no; /* event queue number */ 23 enum dma_event_q eventq_no; /* event queue number */
24 unsigned char data_type; /* xfer data type */ 24 unsigned char data_type; /* xfer data type */
25 unsigned char convert_mono_stereo; 25 unsigned char convert_mono_stereo;
26 unsigned int fifo_level;
26}; 27};
27 28
28 29