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=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,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 E6F09C433DB for ; Tue, 16 Feb 2021 07:27:08 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E885964E02 for ; Tue, 16 Feb 2021 07:27:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E885964E02 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 39B86846; Tue, 16 Feb 2021 08:26:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 39B86846 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1613460424; bh=Z7T0Hx/Vb5aXYKQema2mzehKX2JsK75I8rZ0mqWfZyc=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=tKrSbk5hU3ydiEinZIpIxrX0r969BOWDc6YqJVRqNj0u9q588aqQ/NUB11Wu+pTLi XAd6DrrIFX8aL8rRfZjr2kNY07r2gAKwPGDfdiGvpxd9WTlIUbwcjE7JgT5Cp7Y4sN 0eJypmlUAitxGtMlIFi4vjr4bqyFco8DP3kGsnZU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B3437F80059; Tue, 16 Feb 2021 08:26:13 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 359C2F8015A; Tue, 16 Feb 2021 08:26:12 +0100 (CET) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id AE76EF80059 for ; Tue, 16 Feb 2021 08:26:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AE76EF80059 Date: 16 Feb 2021 16:26:04 +0900 X-IronPort-AV: E=Sophos;i="5.81,182,1610377200"; d="scan'208";a="72210955" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 16 Feb 2021 16:26:04 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id EDBE94004928; Tue, 16 Feb 2021 16:26:03 +0900 (JST) Message-ID: <87zh04wkf4.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Kai Vehmanen Subject: Re: [PATCH 2/3] ASoC: soc-pcm: add soc_pcm_hw_update_chan() In-Reply-To: References: <87tuqs90rl.wl-kuninori.morimoto.gx@renesas.com> <87r1lw90oo.wl-kuninori.morimoto.gx@renesas.com> <62f03ec8-7b9c-4550-d63d-cc50693e62fa@linux.intel.com> <20210215204527.GC4378@sirena.org.uk> User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Cc: Linux-ALSA , Mark Brown , Bard liao , Pierre-Louis Bossart , Ranjani Sridharan X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Hi Kai > I think we might still have issues if we have multiple CPU DAIs per > runtime and dpcm_init_runtime_hw() is called multiple times. With the > fixup, the limits are taken from the last CPU DAI. > > But if you look at original code, the same issues seems to be there > (rate and channels taken from the stream directly with no consideration > of already set values). Only exception is runtime->hw.formats, which > is handled differently: Actually, when I posted the patch, I removed 1 line which I thought not needed. But it seems it was necessary... Current fixup patch always initialize hw at dpcm_set_fe_runtime()'s loop, but I guess we need is initialize once. How about this patch ? It reverts current fixup, and initialize hw once at dpcm_set_fe_runtime(). ----------- diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 37094aeff440..14d85ca1e435 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1531,10 +1531,12 @@ static void dpcm_init_runtime_hw(struct snd_pcm_runtime *runtime, { struct snd_pcm_hardware *hw = &runtime->hw; - soc_pcm_hw_init(hw); soc_pcm_hw_update_rate(hw, stream); soc_pcm_hw_update_chan(hw, stream); - soc_pcm_hw_update_format(hw, stream); + if (runtime->hw.formats) + runtime->hw.formats &= stream->formats; + else + runtime->hw.formats = stream->formats; } static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream, @@ -1662,10 +1664,13 @@ static void dpcm_runtime_merge_rate(struct snd_pcm_substream *substream, static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_pcm_hardware *hw = &runtime->hw; struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); struct snd_soc_dai *cpu_dai; int i; + soc_pcm_hw_init(hw); + for_each_rtd_cpu_dais(rtd, i, cpu_dai) { /* * Skip CPUs which don't support the current stream Thank you for your help !! Best regards --- Kuninori Morimoto