From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37A46C28CF6 for ; Wed, 1 Aug 2018 12:03:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D959820862 for ; Wed, 1 Aug 2018 12:03:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D959820862 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389044AbeHANsg (ORCPT ); Wed, 1 Aug 2018 09:48:36 -0400 Received: from mx2.suse.de ([195.135.220.15]:50054 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387575AbeHANsg (ORCPT ); Wed, 1 Aug 2018 09:48:36 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 75E79ADA7; Wed, 1 Aug 2018 12:03:07 +0000 (UTC) Date: Wed, 01 Aug 2018 14:03:06 +0200 Message-ID: From: Takashi Iwai To: "Akshu Agrawal" Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , , , "Liam Girdwood" , "Mark Brown" , "Jaroslav Kysela" , "open list" Subject: Re: [PATCH v2] ASoC: soc-pcm: Use delay set in component pointer function In-Reply-To: <1533118054-14509-1-git-send-email-akshu.agrawal@amd.com> References: <1533118054-14509-1-git-send-email-akshu.agrawal@amd.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/26 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 01 Aug 2018 12:07:33 +0200, Akshu Agrawal wrote: > > 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 Reviewed-by: Takashi Iwai thanks, Takashi > --- > 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 98be04b..e8b98bfd 100644 > --- a/sound/soc/soc-pcm.c > +++ b/sound/soc/soc-pcm.c > @@ -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); > -- > 1.9.1 > >