]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ASoC: soc-pcm: Use delay set in component pointer function
authorAkshu Agrawal <akshu.agrawal@amd.com>
Wed, 1 Aug 2018 10:07:33 +0000 (15:37 +0530)
committerMark Brown <broonie@kernel.org>
Wed, 1 Aug 2018 13:31:16 +0000 (14:31 +0100)
Take into account the base delay set in pointer callback.

There are cases where a pointer function populates
runtime->delay, such as:
./sound/pci/hda/hda_controller.c
./sound/soc/intel/atom/sst-mfld-platform-pcm.c

This delay was getting lost and was overwritten by delays
from codec or cpu dai delay function if exposed.

Now,
Total delay = base delay + cpu_dai delay + codec_dai delay

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-pcm.c

index 4019bc10897c80a9b2b918c3a7f6ba0c13a24c52..9833e53754cb2120caf63f147ba661532000fb19 100644 (file)
@@ -1179,6 +1179,9 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
        snd_pcm_sframes_t codec_delay = 0;
        int i;
 
+       /* clearing the previous total delay */
+       runtime->delay = 0;
+
        for_each_rtdcom(rtd, rtdcom) {
                component = rtdcom->component;
 
@@ -1190,6 +1193,8 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
                offset = component->driver->ops->pointer(substream);
                break;
        }
+       /* base delay if assigned in pointer callback */
+       delay = runtime->delay;
 
        if (cpu_dai->driver->ops->delay)
                delay += cpu_dai->driver->ops->delay(substream, cpu_dai);