Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp913150imm; Fri, 27 Jul 2018 08:11:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfk4tUCoL/HpMa1FAeGXqNHsNdAHZcsrv79zrml6MscH8ZEvXYUNuJSdLhX7K5S0Zs9SxQB X-Received: by 2002:a62:4695:: with SMTP id o21-v6mr7041731pfi.176.1532704281941; Fri, 27 Jul 2018 08:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532704281; cv=none; d=google.com; s=arc-20160816; b=0HXpFVcCfJMIdqU16IiwvNTOn/SjyCc6IL2zccQlSGmiSchjaG7JimjnGb++SfY3nj WjM1vxxrBWlSPw/ovjpZPk31w4u5DSXAmO3h3huQe83219XqsrrKfTc3STHDQBUvrINA DIkyKsB4BodZaf6Hc444jNJ4j4/bD9axab0suLCL6nDIeM4ekYY5MEDaAUncGMrlcwYt xod87e03oMW1qhxrBJBNBOjRr5fejlL8s7y93+tuR76vxXfkeD21z0XWVcmI7eZRb3FY +o+dxhm6Smj81e/hW2MCRDyxYHXAWoV6r+YGH0mj8R25m/lfXLP/22nWaL28UApFk8P6 yCNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=xikeSKxmwBPZcmjB/s3lnre7F8aE69r2hmF1dUUY/rE=; b=xtSnHqfEPElmDLLOIIlxZDZWd43Fg9MkTzI/fmNMdrJxNi9TqZxmEo9/V2VkhOw1wq Mlwqyc2zR3dKK8M8gnKh1UFxb42So5RCPcLB+Fg4usFn84CnWmDSiGMaH6hdBWUpWzQw bvzWHZ2nIO3n5tHAsTV1WrGiWB8lz7j/Q1ze3z0MaCZSUOI906iZJsbjp9MPZwlG5fuy ZEcyWC5ouBBETKnewii5R9XDuSo/RrbAjgRW5UmLOUSNLXjC1lLnC2K57CNxEGgvfDbr 8QJb3aI1RvF9wnMXmcq0Qomqxxdoua54/vzaVLzWYpaUy+U4XIqQwfrkr0cAuMUi6S/x Xmkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e35-v6si3784957plb.499.2018.07.27.08.11.06; Fri, 27 Jul 2018 08:11:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388666AbeG0Qba (ORCPT + 99 others); Fri, 27 Jul 2018 12:31:30 -0400 Received: from mga02.intel.com ([134.134.136.20]:7391 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731160AbeG0Qba (ORCPT ); Fri, 27 Jul 2018 12:31:30 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jul 2018 08:09:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,409,1526367600"; d="scan'208";a="75087217" Received: from linux.intel.com ([10.54.29.200]) by fmsmga004.fm.intel.com with ESMTP; 27 Jul 2018 08:09:10 -0700 Received: from stedia-mobl.amr.corp.intel.com (unknown [10.254.75.253]) by linux.intel.com (Postfix) with ESMTP id 0E1AC58037D; Fri, 27 Jul 2018 08:09:08 -0700 (PDT) Subject: Re: [alsa-devel] [PATCH] ASoC: soc-pcm: Use delay set in pointer function To: Akshu Agrawal Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list , Takashi Iwai , Liam Girdwood , djkurtz@chromium.org, Mark Brown , Alexander.Deucher@amd.com References: <1532686422-1790-1-git-send-email-akshu.agrawal@amd.com> From: Pierre-Louis Bossart Message-ID: <66c8b8c4-bdd0-0129-5e5b-850890cfdb8d@linux.intel.com> Date: Fri, 27 Jul 2018 10:09:08 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1532686422-1790-1-git-send-email-akshu.agrawal@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/27/18 5:13 AM, Akshu Agrawal wrote: > 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 > > Also, in some cases cpu dai used is generic and the pcm > driver needs to set delay. > > This delay was getting lost and was overwritten by delays > from codec or cpu dai delay function if exposed. Humm, yes the runtime->delay set in the .pointer function would be lost without this change, but the delay would still be provided in the followup call to .delay. With your change, the same delay will be accounted for twice? > > Signed-off-by: Akshu Agrawal > --- > sound/soc/soc-pcm.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c > index 98be04b..b1a2bc2 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 delay */ > + runtime->delay = 0; > + > for_each_rtdcom(rtd, rtdcom) { > component = rtdcom->component; > > @@ -1203,7 +1206,7 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) > } > delay += codec_delay; > > - runtime->delay = delay; > + runtime->delay += delay; > > return offset; > } >