diff options
author | Peter Ujfalusi <peter.ujfalusi@nokia.com> | 2010-03-03 08:08:09 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-03-12 06:12:25 -0500 |
commit | 75581d2459d3e6e5e796a42b362e4abb612bc958 (patch) | |
tree | 52d9086845bfc3615d2ad2dc3c15782b24b475f3 /sound | |
parent | 7dc976ed38a927fc9880bd3dc498a6a903d1ba74 (diff) |
ASoC: OMAP3: Report delay caused by the internal FIFO
Use the new delay calback function to report the delay through
ALSA for application caused by the internal FIFO.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index e814a9591f78..2952fb046ed6 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -256,6 +256,31 @@ static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd, | |||
256 | return err; | 256 | return err; |
257 | } | 257 | } |
258 | 258 | ||
259 | static snd_pcm_sframes_t omap_mcbsp_dai_delay( | ||
260 | struct snd_pcm_substream *substream, | ||
261 | struct snd_soc_dai *dai) | ||
262 | { | ||
263 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
264 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
265 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | ||
266 | u16 fifo_use; | ||
267 | snd_pcm_sframes_t delay; | ||
268 | |||
269 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
270 | fifo_use = omap_mcbsp_get_tx_delay(mcbsp_data->bus_id); | ||
271 | else | ||
272 | fifo_use = omap_mcbsp_get_rx_delay(mcbsp_data->bus_id); | ||
273 | |||
274 | /* | ||
275 | * Divide the used locations with the channel count to get the | ||
276 | * FIFO usage in samples (don't care about partial samples in the | ||
277 | * buffer). | ||
278 | */ | ||
279 | delay = fifo_use / substream->runtime->channels; | ||
280 | |||
281 | return delay; | ||
282 | } | ||
283 | |||
259 | static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | 284 | static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, |
260 | struct snd_pcm_hw_params *params, | 285 | struct snd_pcm_hw_params *params, |
261 | struct snd_soc_dai *dai) | 286 | struct snd_soc_dai *dai) |
@@ -607,6 +632,7 @@ static struct snd_soc_dai_ops omap_mcbsp_dai_ops = { | |||
607 | .startup = omap_mcbsp_dai_startup, | 632 | .startup = omap_mcbsp_dai_startup, |
608 | .shutdown = omap_mcbsp_dai_shutdown, | 633 | .shutdown = omap_mcbsp_dai_shutdown, |
609 | .trigger = omap_mcbsp_dai_trigger, | 634 | .trigger = omap_mcbsp_dai_trigger, |
635 | .delay = omap_mcbsp_dai_delay, | ||
610 | .hw_params = omap_mcbsp_dai_hw_params, | 636 | .hw_params = omap_mcbsp_dai_hw_params, |
611 | .set_fmt = omap_mcbsp_dai_set_dai_fmt, | 637 | .set_fmt = omap_mcbsp_dai_set_dai_fmt, |
612 | .set_clkdiv = omap_mcbsp_dai_set_clkdiv, | 638 | .set_clkdiv = omap_mcbsp_dai_set_clkdiv, |