aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci/davinci-pcm.c
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/soc/davinci/davinci-pcm.c
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/soc/davinci/davinci-pcm.c')
-rw-r--r--sound/soc/davinci/davinci-pcm.c21
1 files changed, 18 insertions, 3 deletions
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))