diff options
-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, |