Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4923539imm; Tue, 31 Jul 2018 02:26:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcuiRvIja+NZX5PC/h4Z+kyTjBRUrHqFD6B0ijMMfIMNUx71xV7oANtSWGIa8MbEtjUcmuU X-Received: by 2002:a65:41c6:: with SMTP id b6-v6mr19297976pgq.174.1533029204098; Tue, 31 Jul 2018 02:26:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533029204; cv=none; d=google.com; s=arc-20160816; b=PPqsKntItlY7z6gdClfrm32h+ESKfTyj8LCDdgzGoMcNzcO3qAh2N+lizDxZEXatfm zapK9MYESy86PqdT2RNZt7lR9LTAKEe7PtXReJHI4OgEMcd031s4mJ2b/00E8qTaPByl qo8kGr6cbgNLPbCVEy+5YxOYglIObhb3lmZ11rMrJa13NorHFJOdd8KgD0jNKFQEHVhd BqAtEdRoUWxPbzsL45Zo8tbsNzPUDE+feT4+c5688rbzoIvkUHhioFC6wGBbFY5p+Kde PooS79v73SuUAGrvmf2DBamhmD7D+01ocYyO8V7kbdvH4H94PvR68HThPYm5lqjWDhyg ithA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date :arc-authentication-results; bh=JKbbUWz6Y76nyaTSYyR1bpBUHLaCLRdXt5wNc0KwNY0=; b=Z7RSvl5WO3QkSgFGHk9gXQESllAQkcCTooA5FDVXbqvuI0UHlSK347P92kFCfDGyJB 5TetBKmdmhVpEVeq82+iA1WxH6fEjFxWiyGafA8qhfiLlyAska1f7o8FvtxeiBv/PyZk 4mU+RKpijKCMTyFzjWFyZmWb+zdvlfGFtht3YjLL2jhRa5fvQM+6PjlXvsmo3FAWaZ4W eEPY43lvkhKcKWSQfF7TPzNIsW094xgzTgpMiXj8iv6pp/OwKHOFJs+uF3VDY1x4vFvx 10BHBFzqiS7eWbEvcTsbSSvJiE1BsCR5fqlLUbg/UGZttvYmWfS4LCHzGSnFUj/lZxlr aX5g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c62-v6si14862998pfb.98.2018.07.31.02.26.30; Tue, 31 Jul 2018 02:26:44 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731928AbeGaLEj (ORCPT + 99 others); Tue, 31 Jul 2018 07:04:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:54420 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730113AbeGaLEj (ORCPT ); Tue, 31 Jul 2018 07:04:39 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C31C8AD81; Tue, 31 Jul 2018 09:25:12 +0000 (UTC) Date: Tue, 31 Jul 2018 11:25:11 +0200 Message-ID: From: Takashi Iwai To: "Agrawal, Akshu" Cc: Mark Brown , Pierre-Louis Bossart , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , Alexander.Deucher@amd.com, djkurtz@chromium.org, Liam Girdwood , open list Subject: Re: [alsa-devel] [PATCH] ASoC: soc-pcm: Use delay set in pointer function In-Reply-To: <5b3249cb-6212-6a14-b644-7548cf0ad00c@amd.com> References: <1532686422-1790-1-git-send-email-akshu.agrawal@amd.com> <66c8b8c4-bdd0-0129-5e5b-850890cfdb8d@linux.intel.com> <20180730155030.GP5789@sirena.org.uk> <7a88c7b4-d31d-b044-bb8e-a866d49d1256@amd.com> <5b3249cb-6212-6a14-b644-7548cf0ad00c@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 Tue, 31 Jul 2018 11:06:59 +0200, Agrawal, Akshu wrote: > > > > On 7/31/2018 11:00 AM, Takashi Iwai wrote: > > On Tue, 31 Jul 2018 03:25:06 +0200, > > Agrawal, Akshu wrote: > >> > >> > >> > >> On 7/30/2018 9:20 PM, Mark Brown wrote: > >>> On Mon, Jul 30, 2018 at 05:32:21PM +0200, Takashi Iwai wrote: > >>> > >>>> That said, if delay callback of CPU dai provides the additional delay, > >>>> the patch does correct thing. OTOH, if CPU dai provides the base > >>>> delay instead, we need to clarify that it's rather a must; the delay > >>>> calculation in pointer callback becomes bogus in this scenario. > >>> > >>> Part of the theory here is that every component might have a delay > >>> independently of the rest and we need to add them all together to figure > >>> out what the system as a whole will see. Personally I'd rather just > >>> have everything use a callack consistently to avoid confusion. > >>> > >> > >> For consistency we can add a delay callback in snd_pcm_ops and modify > >> the drivers which directly assigning runtime->delay to use the callback. > > > > No, ALSA PCM ops definition is fine. The delay calculation is > > basically tied with the position, hence it has to be set together, and > > that's the pointer callback. > > > > Judging from the call pattern, the current design of ASoC delay > > callback implies that the return value is more or less constant, which > > can be accumulated on top of the base value. So your patch is natural > > from that POV. > > > > OTOH, if the CPU dai can really provide a dynamic value that is > > strictly tied with pointer, CPU dai itself should provide the pointer > > callback that covers both the pointer and the base delay, and it > > should be used instead of component pointer callback. > > > > Not sure if all cpu dai can provide the base delay and thus require > component pointer callback for it. For example, in case of AMD, it uses > designware cpu dai which is a common code. It's not necessary that all CPU dais provide the pointer callback. My suggestion is that, if CPU dai *wants* to provide the base delay, it must be tied with the position value, hence it should provide the pointer callback. If CPU dai has a pointer callback, snd_soc_pcm_pointer() skips the component pointer callback but uses CPU dai pointer callback instead. OTOH, for most of existing implementations, the delay is just additions, and this can be still given via the existing delay callback. In that case, the base delay is taken from the component driver ops, and it'll be like your patch. Takashi