aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci
diff options
context:
space:
mode:
authorTroy Kisky <troy.kisky@boundarydevices.com>2009-11-18 19:49:52 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-11-19 05:47:56 -0500
commit1587ea31572e25a0a2c9c491b7f8c937b6c0454e (patch)
tree8ab43408e2b859dcde8af29a5ec5651e454b0da1 /sound/soc/davinci
parent0d6c97742993a00ee2cbfbd6d68fba669c17bf50 (diff)
ASoC: DaVinci: pcm, rename variables in prep for ping/pong
Rename variable master_lch to asp_channel Rename variable slave_lch to asp_link[0] Rename local variables: lch to link count to asp_count src to asp_src dst to asp_dst Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r--sound/soc/davinci/davinci-pcm.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index 187ee965bf0b..42a657ea49cb 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -51,8 +51,8 @@ static struct snd_pcm_hardware davinci_pcm_hardware = {
51struct davinci_runtime_data { 51struct davinci_runtime_data {
52 spinlock_t lock; 52 spinlock_t lock;
53 int period; /* current DMA period */ 53 int period; /* current DMA period */
54 int master_lch; /* Master DMA channel */ 54 int asp_channel; /* Master DMA channel */
55 int slave_lch; /* linked parameter RAM reload slot */ 55 int asp_link[2]; /* asp parameter link channel, ping/pong */
56 struct davinci_pcm_dma_params *params; /* DMA params */ 56 struct davinci_pcm_dma_params *params; /* DMA params */
57}; 57};
58 58
@@ -60,7 +60,7 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
60{ 60{
61 struct davinci_runtime_data *prtd = substream->runtime->private_data; 61 struct davinci_runtime_data *prtd = substream->runtime->private_data;
62 struct snd_pcm_runtime *runtime = substream->runtime; 62 struct snd_pcm_runtime *runtime = substream->runtime;
63 int lch = prtd->slave_lch; 63 int link = prtd->asp_link[0];
64 unsigned int period_size; 64 unsigned int period_size;
65 unsigned int dma_offset; 65 unsigned int dma_offset;
66 dma_addr_t dma_pos; 66 dma_addr_t dma_pos;
@@ -78,7 +78,7 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
78 fifo_level = prtd->params->fifo_level; 78 fifo_level = prtd->params->fifo_level;
79 79
80 pr_debug("davinci_pcm: audio_set_dma_params_play channel = %d " 80 pr_debug("davinci_pcm: audio_set_dma_params_play channel = %d "
81 "dma_ptr = %x period_size=%x\n", lch, dma_pos, period_size); 81 "dma_ptr = %x period_size=%x\n", link, dma_pos, period_size);
82 82
83 data_type = prtd->params->data_type; 83 data_type = prtd->params->data_type;
84 count = period_size / data_type; 84 count = period_size / data_type;
@@ -102,16 +102,16 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
102 } 102 }
103 103
104 acnt = prtd->params->acnt; 104 acnt = prtd->params->acnt;
105 edma_set_src(lch, src, INCR, W8BIT); 105 edma_set_src(link, src, INCR, W8BIT);
106 edma_set_dest(lch, dst, INCR, W8BIT); 106 edma_set_dest(link, dst, INCR, W8BIT);
107 107
108 edma_set_src_index(lch, src_bidx, src_cidx); 108 edma_set_src_index(link, src_bidx, src_cidx);
109 edma_set_dest_index(lch, dst_bidx, dst_cidx); 109 edma_set_dest_index(link, dst_bidx, dst_cidx);
110 110
111 if (!fifo_level) 111 if (!fifo_level)
112 edma_set_transfer_params(lch, acnt, count, 1, 0, ASYNC); 112 edma_set_transfer_params(link, acnt, count, 1, 0, ASYNC);
113 else 113 else
114 edma_set_transfer_params(lch, acnt, fifo_level, count, 114 edma_set_transfer_params(link, acnt, fifo_level, count,
115 fifo_level, ABSYNC); 115 fifo_level, ABSYNC);
116 116
117 prtd->period++; 117 prtd->period++;
@@ -119,12 +119,12 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
119 prtd->period = 0; 119 prtd->period = 0;
120} 120}
121 121
122static void davinci_pcm_dma_irq(unsigned lch, u16 ch_status, void *data) 122static void davinci_pcm_dma_irq(unsigned link, u16 ch_status, void *data)
123{ 123{
124 struct snd_pcm_substream *substream = data; 124 struct snd_pcm_substream *substream = data;
125 struct davinci_runtime_data *prtd = substream->runtime->private_data; 125 struct davinci_runtime_data *prtd = substream->runtime->private_data;
126 126
127 pr_debug("davinci_pcm: lch=%d, status=0x%x\n", lch, ch_status); 127 pr_debug("davinci_pcm: link=%d, status=0x%x\n", link, ch_status);
128 128
129 if (unlikely(ch_status != DMA_COMPLETE)) 129 if (unlikely(ch_status != DMA_COMPLETE))
130 return; 130 return;
@@ -150,15 +150,15 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
150 EVENTQ_0); 150 EVENTQ_0);
151 if (ret < 0) 151 if (ret < 0)
152 return ret; 152 return ret;
153 prtd->master_lch = ret; 153 prtd->asp_channel = ret;
154 154
155 /* Request parameter RAM reload slot */ 155 /* Request parameter RAM reload slot */
156 ret = edma_alloc_slot(EDMA_CTLR(prtd->master_lch), EDMA_SLOT_ANY); 156 ret = edma_alloc_slot(EDMA_CTLR(prtd->asp_channel), EDMA_SLOT_ANY);
157 if (ret < 0) { 157 if (ret < 0) {
158 edma_free_channel(prtd->master_lch); 158 edma_free_channel(prtd->asp_channel);
159 return ret; 159 return ret;
160 } 160 }
161 prtd->slave_lch = ret; 161 prtd->asp_link[0] = ret;
162 162
163 /* Issue transfer completion IRQ when the channel completes a 163 /* Issue transfer completion IRQ when the channel completes a
164 * transfer, then always reload from the same slot (by a kind 164 * transfer, then always reload from the same slot (by a kind
@@ -169,10 +169,10 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
169 * the buffer and its length (ccnt) ... use it as a template 169 * the buffer and its length (ccnt) ... use it as a template
170 * so davinci_pcm_enqueue_dma() takes less time in IRQ. 170 * so davinci_pcm_enqueue_dma() takes less time in IRQ.
171 */ 171 */
172 edma_read_slot(prtd->slave_lch, &p_ram); 172 edma_read_slot(prtd->asp_link[0], &p_ram);
173 p_ram.opt |= TCINTEN | EDMA_TCC(EDMA_CHAN_SLOT(prtd->master_lch)); 173 p_ram.opt |= TCINTEN | EDMA_TCC(EDMA_CHAN_SLOT(prtd->asp_channel));
174 p_ram.link_bcntrld = EDMA_CHAN_SLOT(prtd->slave_lch) << 5; 174 p_ram.link_bcntrld = EDMA_CHAN_SLOT(prtd->asp_link[0]) << 5;
175 edma_write_slot(prtd->slave_lch, &p_ram); 175 edma_write_slot(prtd->asp_link[0], &p_ram);
176 176
177 return 0; 177 return 0;
178} 178}
@@ -188,12 +188,12 @@ static int davinci_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
188 case SNDRV_PCM_TRIGGER_START: 188 case SNDRV_PCM_TRIGGER_START:
189 case SNDRV_PCM_TRIGGER_RESUME: 189 case SNDRV_PCM_TRIGGER_RESUME:
190 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 190 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
191 edma_start(prtd->master_lch); 191 edma_start(prtd->asp_channel);
192 break; 192 break;
193 case SNDRV_PCM_TRIGGER_STOP: 193 case SNDRV_PCM_TRIGGER_STOP:
194 case SNDRV_PCM_TRIGGER_SUSPEND: 194 case SNDRV_PCM_TRIGGER_SUSPEND:
195 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 195 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
196 edma_stop(prtd->master_lch); 196 edma_stop(prtd->asp_channel);
197 break; 197 break;
198 default: 198 default:
199 ret = -EINVAL; 199 ret = -EINVAL;
@@ -214,8 +214,8 @@ static int davinci_pcm_prepare(struct snd_pcm_substream *substream)
214 davinci_pcm_enqueue_dma(substream); 214 davinci_pcm_enqueue_dma(substream);
215 215
216 /* Copy self-linked parameter RAM entry into master channel */ 216 /* Copy self-linked parameter RAM entry into master channel */
217 edma_read_slot(prtd->slave_lch, &temp); 217 edma_read_slot(prtd->asp_link[0], &temp);
218 edma_write_slot(prtd->master_lch, &temp); 218 edma_write_slot(prtd->asp_channel, &temp);
219 davinci_pcm_enqueue_dma(substream); 219 davinci_pcm_enqueue_dma(substream);
220 220
221 return 0; 221 return 0;
@@ -227,20 +227,20 @@ davinci_pcm_pointer(struct snd_pcm_substream *substream)
227 struct snd_pcm_runtime *runtime = substream->runtime; 227 struct snd_pcm_runtime *runtime = substream->runtime;
228 struct davinci_runtime_data *prtd = runtime->private_data; 228 struct davinci_runtime_data *prtd = runtime->private_data;
229 unsigned int offset; 229 unsigned int offset;
230 dma_addr_t count; 230 int asp_count;
231 dma_addr_t src, dst; 231 dma_addr_t asp_src, asp_dst;
232 232
233 spin_lock(&prtd->lock); 233 spin_lock(&prtd->lock);
234 234
235 edma_get_position(prtd->master_lch, &src, &dst); 235 edma_get_position(prtd->asp_channel, &asp_src, &asp_dst);
236 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 236 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
237 count = src - runtime->dma_addr; 237 asp_count = asp_src - runtime->dma_addr;
238 else 238 else
239 count = dst - runtime->dma_addr; 239 asp_count = asp_dst - runtime->dma_addr;
240 240
241 spin_unlock(&prtd->lock); 241 spin_unlock(&prtd->lock);
242 242
243 offset = bytes_to_frames(runtime, count); 243 offset = bytes_to_frames(runtime, asp_count);
244 if (offset >= runtime->buffer_size) 244 if (offset >= runtime->buffer_size)
245 offset = 0; 245 offset = 0;
246 246
@@ -289,10 +289,10 @@ static int davinci_pcm_close(struct snd_pcm_substream *substream)
289 struct snd_pcm_runtime *runtime = substream->runtime; 289 struct snd_pcm_runtime *runtime = substream->runtime;
290 struct davinci_runtime_data *prtd = runtime->private_data; 290 struct davinci_runtime_data *prtd = runtime->private_data;
291 291
292 edma_unlink(prtd->slave_lch); 292 edma_unlink(prtd->asp_link[0]);
293 293
294 edma_free_slot(prtd->slave_lch); 294 edma_free_slot(prtd->asp_link[0]);
295 edma_free_channel(prtd->master_lch); 295 edma_free_channel(prtd->asp_channel);
296 296
297 kfree(prtd); 297 kfree(prtd);
298 298