Commit dd894f4c authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-pcm: tidyup soc_pcm_pointer()'s delay update method

No driver directly updates runtime->delay in .pointer.
This patch cleanups its method.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zgq4wnkx.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 796b64a7
...@@ -1080,29 +1080,22 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -1080,29 +1080,22 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
/* /*
* soc level wrapper for pointer callback * soc level wrapper for pointer callback
* If cpu_dai, codec_dai, component driver has the delay callback, then * If cpu_dai, codec_dai, component driver has the delay callback, then
* the runtime->delay will be updated accordingly. * the runtime->delay will be updated via snd_soc_pcm_component/dai_delay().
*/ */
static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_uframes_t offset = 0; snd_pcm_uframes_t offset = 0;
snd_pcm_sframes_t delay = 0;
snd_pcm_sframes_t codec_delay = 0; snd_pcm_sframes_t codec_delay = 0;
snd_pcm_sframes_t cpu_delay = 0; snd_pcm_sframes_t cpu_delay = 0;
/* clearing the previous total delay */
runtime->delay = 0;
offset = snd_soc_pcm_component_pointer(substream); offset = snd_soc_pcm_component_pointer(substream);
/* base delay if assigned in pointer callback */
delay = runtime->delay;
/* should be called *after* snd_soc_pcm_component_pointer() */ /* should be called *after* snd_soc_pcm_component_pointer() */
snd_soc_pcm_dai_delay(substream, &cpu_delay, &codec_delay); snd_soc_pcm_dai_delay(substream, &cpu_delay, &codec_delay);
snd_soc_pcm_component_delay(substream, &cpu_delay, &codec_delay); snd_soc_pcm_component_delay(substream, &cpu_delay, &codec_delay);
runtime->delay = delay + cpu_delay + codec_delay; runtime->delay = cpu_delay + codec_delay;
return offset; return offset;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment