From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-dm3nam03on0090.outbound.protection.outlook.com ([104.47.41.90]:39552 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727487AbeIBRUA (ORCPT ); Sun, 2 Sep 2018 13:20:00 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Akshu Agrawal , Mark Brown , Sasha Levin Subject: [PATCH AUTOSEL 4.18 043/131] ASoC: soc-pcm: Use delay set in component pointer function Date: Sun, 2 Sep 2018 13:03:55 +0000 Message-ID: <20180902064601.183036-43-alexander.levin@microsoft.com> References: <20180902064601.183036-1-alexander.levin@microsoft.com> In-Reply-To: <20180902064601.183036-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Akshu Agrawal [ Upstream commit 9fb4c2bf130b922c77c16a8368732699799c40de ] 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 =3D base delay + cpu_dai delay + codec_dai delay Signed-off-by: Akshu Agrawal Reviewed-by: Takashi Iwai Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/soc-pcm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 5e7ae47a9658..1cdd21f6827e 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1165,6 +1165,9 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_p= cm_substream *substream) snd_pcm_sframes_t codec_delay =3D 0; int i; =20 + /* clearing the previous total delay */ + runtime->delay =3D 0; + for_each_rtdcom(rtd, rtdcom) { component =3D rtdcom->component; =20 @@ -1176,6 +1179,8 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_p= cm_substream *substream) offset =3D component->driver->ops->pointer(substream); break; } + /* base delay if assigned in pointer callback */ + delay =3D runtime->delay; =20 if (cpu_dai->driver->ops->delay) delay +=3D cpu_dai->driver->ops->delay(substream, cpu_dai); --=20 2.17.1