aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci
diff options
context:
space:
mode:
authorBen Gardiner <bengardiner@nanometrics.ca>2011-05-24 14:50:19 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-05-25 07:14:31 -0400
commit10ab3bfda41ea21419f6a8d1e5a645521fea4b32 (patch)
treef0a78be7d76d37ac480ede84038d79f615370d2b /sound/soc/davinci
parentef39eb6f212996ede8da47ef45e6dffff1121ec7 (diff)
ASoC: davinci-pcm: extract period elapsed functions
Extract functions that modify the prtd->period member in preparation for conversion to BATCH mode playback. Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Reviewed-by: Steven Faludi <stevenfaludi@nanometrics.ca> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r--sound/soc/davinci/davinci-pcm.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index 5d9269a51761..fedca81b67b4 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -155,6 +155,22 @@ struct davinci_runtime_data {
155 struct edmacc_param ram_params; 155 struct edmacc_param ram_params;
156}; 156};
157 157
158static void davinci_pcm_period_elapsed(struct snd_pcm_substream *substream)
159{
160 struct davinci_runtime_data *prtd = substream->runtime->private_data;
161 struct snd_pcm_runtime *runtime = substream->runtime;
162
163 prtd->period++;
164 if (unlikely(prtd->period >= runtime->periods))
165 prtd->period = 0;
166}
167
168static void davinci_pcm_period_reset(struct snd_pcm_substream *substream)
169{
170 struct davinci_runtime_data *prtd = substream->runtime->private_data;
171
172 prtd->period = 0;
173}
158/* 174/*
159 * Not used with ping/pong 175 * Not used with ping/pong
160 */ 176 */
@@ -216,9 +232,7 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
216 edma_set_transfer_params(link, acnt, fifo_level, count, 232 edma_set_transfer_params(link, acnt, fifo_level, count,
217 fifo_level, ABSYNC); 233 fifo_level, ABSYNC);
218 234
219 prtd->period++; 235 davinci_pcm_period_elapsed(substream);
220 if (unlikely(prtd->period >= runtime->periods))
221 prtd->period = 0;
222} 236}
223 237
224static void davinci_pcm_dma_irq(unsigned link, u16 ch_status, void *data) 238static void davinci_pcm_dma_irq(unsigned link, u16 ch_status, void *data)
@@ -591,7 +605,7 @@ static int davinci_pcm_prepare(struct snd_pcm_substream *substream)
591 605
592 return 0; 606 return 0;
593 } 607 }
594 prtd->period = 0; 608 davinci_pcm_period_reset(substream);
595 davinci_pcm_enqueue_dma(substream); 609 davinci_pcm_enqueue_dma(substream);
596 610
597 /* Copy self-linked parameter RAM entry into master channel */ 611 /* Copy self-linked parameter RAM entry into master channel */