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 4EBB2C43142 for ; Tue, 31 Jul 2018 09:25:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 084B8208A5 for ; Tue, 31 Jul 2018 09:25:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 084B8208A5 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 S1731943AbeGaLEj (ORCPT ); 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [alsa-devel] [PATCH] ASoC: soc-pcm: Use delay set in pointer function Date: Tue, 31 Jul 2018 11:25:11 +0200 Message-ID: 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> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <5b3249cb-6212-6a14-b644-7548cf0ad00c@amd.com> Sender: linux-kernel-owner@vger.kernel.org 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 List-Id: alsa-devel@alsa-project.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