[PATCH 7/7] ASoC: soc-pcm: Merge CPU/Codec at soc_pcm_pointer()
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Wed Mar 11 02:07:56 CET 2020
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
soc_pcm_pointer() is getting eash DAI's delay via snd_soc_dai_delay(),
but, it is adding CPU delay and Codec delay.
We need is not "added delay", but "max delay" of CPU/Codec.
This patch finds maximum delay from CPU/Codec.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
sound/soc/soc-pcm.c | 27 +++++++--------------------
1 file changed, 7 insertions(+), 20 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index c0f318699fe4..675de7c0eaa4 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1274,13 +1274,10 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream,
static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai;
- struct snd_soc_dai *codec_dai;
+ struct snd_soc_dai *dai;
struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_uframes_t offset = 0;
- snd_pcm_sframes_t delay = 0;
- snd_pcm_sframes_t codec_delay = 0;
- snd_pcm_sframes_t cpu_delay = 0;
+ snd_pcm_sframes_t add_delay = 0;
int i;
/* clearing the previous total delay */
@@ -1288,22 +1285,12 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
offset = snd_soc_pcm_component_pointer(substream);
- /* base delay if assigned in pointer callback */
- delay = runtime->delay;
-
- for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
- cpu_delay = max(cpu_delay,
- snd_soc_dai_delay(cpu_dai, substream));
- }
- delay += cpu_delay;
-
- for_each_rtd_codec_dais(rtd, i, codec_dai) {
- codec_delay = max(codec_delay,
- snd_soc_dai_delay(codec_dai, substream));
- }
- delay += codec_delay;
+ for_each_rtd_dais(rtd, i, dai)
+ add_delay = max(add_delay,
+ snd_soc_dai_delay(dai, substream));
- runtime->delay = delay;
+ /* base delay if assigned in pointer callback */
+ runtime->delay += add_delay;
return offset;
}
--
2.17.1
More information about the Alsa-devel
mailing list