summaryrefslogtreecommitdiffstats
path: root/sound/soc/davinci
diff options
context:
space:
mode:
authorBen Gardiner <bengardiner@nanometrics.ca>2011-05-24 20:50:19 +0200
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-05-25 13:14:31 +0200
commit10ab3bfda41ea21419f6a8d1e5a645521fea4b32 (patch)
treef0a78be7d76d37ac480ede84038d79f615370d2b /sound/soc/davinci
parentASoC: davinci-pcm: fix audible glitch on 2nd ping-pong playback (diff)
downloadlinux-10ab3bfda41ea21419f6a8d1e5a645521fea4b32.tar.xz
linux-10ab3bfda41ea21419f6a8d1e5a645521fea4b32.zip
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 {
struct edmacc_param ram_params;
};
+static void davinci_pcm_period_elapsed(struct snd_pcm_substream *substream)
+{
+ struct davinci_runtime_data *prtd = substream->runtime->private_data;
+ struct snd_pcm_runtime *runtime = substream->runtime;
+
+ prtd->period++;
+ if (unlikely(prtd->period >= runtime->periods))
+ prtd->period = 0;
+}
+
+static void davinci_pcm_period_reset(struct snd_pcm_substream *substream)
+{
+ struct davinci_runtime_data *prtd = substream->runtime->private_data;
+
+ prtd->period = 0;
+}
/*
* Not used with ping/pong
*/
@@ -216,9 +232,7 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
edma_set_transfer_params(link, acnt, fifo_level, count,
fifo_level, ABSYNC);
- prtd->period++;
- if (unlikely(prtd->period >= runtime->periods))
- prtd->period = 0;
+ davinci_pcm_period_elapsed(substream);
}
static 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)
return 0;
}
- prtd->period = 0;
+ davinci_pcm_period_reset(substream);
davinci_pcm_enqueue_dma(substream);
/* Copy self-linked parameter RAM entry into master channel */