Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2871991rdh; Mon, 27 Nov 2023 00:29:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVe79nz58Vea9vIn5TPhC1DrMXwtsLmMSmfMGtQ3o3DPe/qX8NUAoXsBqhMrbSsnM5bLh1 X-Received: by 2002:aca:1c02:0:b0:3ae:156f:d325 with SMTP id c2-20020aca1c02000000b003ae156fd325mr12328152oic.58.1701073753791; Mon, 27 Nov 2023 00:29:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701073753; cv=none; d=google.com; s=arc-20160816; b=Tj6HGK7tgf+O3EjdeZPvq5gUzVtzwa+Xra4VmdZAz3zafNulZ0KzwAjMOH1dRz04Aa 1H7uCBoaP41MSbvO6bW0KdtUm/4/1J3XlUzYP8rSHWgKqplcU+pJ/HUzjZ0HQ/bKWiIO tLPSCjAlFXW0Hga71rGEoo9Vt/VhS1NNCpJq7Fog0jg23pALVknVM17QgVcj3r+x67wx 4dvt3e3h/Z5MaW+Wp6H/lUFe/efREQYoCVUSpdo2TNjo8Ytv2S9vpdo1Geuka3s1EL0z x6waPvYCiGh0/L3FfUfVEr1xa+svxSb9m12CrYlxpRLhME3TAaCRduUrBfAyWSOTZssS GLPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ee60G01+QQojq4uuM7n6RHEV1cSWEO0wC/k1Fu/ohZU=; fh=uwzy+CFGF16tKhJxITBHChStLTXJwnTd3nXvwHYS8Tw=; b=o/mvNAIEaOlSiXSpHNDHlphzuShfbT2B9aQhO2QkrzG7968rybXO/6nKcIwVMVI95Z /8ntyEPfhEeoiS5Z7/PwrNfgU8ddeCwmU2a4T/a+PAbWdEviHhZScGoAqN20aUGPqA5v RHEf+aWzQ+OjJDLCFOUYuoY8R3spSSFriEHA4rjWl3kEeJERQi1i0huCB+ri4Tn5dkK7 eNxSyeNXbIdfQ5vyk1gfRC8sYtV/lqpS2xNpCAOPSOJC5czpJjL5AQyacn64ryocrJpq nQ1qy0gu6nzZkDnRQAc8blV6GLCmQjYdFQ0PI2TkxRe3P6+m2LlppyjQk+PalvIqBOYg R59A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PCG7Yqk0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id n4-20020a632704000000b005c1e762bc50si8959595pgn.742.2023.11.27.00.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 00:29:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PCG7Yqk0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 05D2F807DED9; Mon, 27 Nov 2023 00:29:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232558AbjK0I2x (ORCPT + 99 others); Mon, 27 Nov 2023 03:28:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232452AbjK0I2w (ORCPT ); Mon, 27 Nov 2023 03:28:52 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 469CFD6 for ; Mon, 27 Nov 2023 00:28:59 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7E8AC433C7; Mon, 27 Nov 2023 08:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701073738; bh=zkIajtumZwqOpyIXYiKzh7afVZjXgDnAjVN67KB4Nlg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PCG7Yqk0IfGUKmVsDhCjnubH3mc95XUFU5wIkJ8Rlwey4P+qEJXOJ3l7F3h9zUWPJ su8x78HsvwdKDB3OJNkqZpkMCbcdDSwePwhUXt7TQZFqZtfOFHUez30wk2US3dNJ3m PE3Z/Lpa/b+UaLCXu6ElIJv4IVfVNFHeAPHUFqSeRGgB8k3XEt7UcUe6hVJMlmY+2w QMUzXjEb0XZzEtVszH8qAsqiWoTzB8+wQ0U5Z8k7x1msftlCUxb5amAz1XSqcIGp4F bT5ju7o3CLSNJEUo2KLoicEkJrKPrJx6qkpJqErcK+yjk8rcF9LmVuWwej6k8Y3CQ+ SQwgxxmUwTGTQ== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1r7Wzc-0002jY-1S; Mon, 27 Nov 2023 09:29:24 +0100 Date: Mon, 27 Nov 2023 09:29:24 +0100 From: Johan Hovold To: Chancel Liu Cc: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: Re: [PATCH v2 1/1] ASoC: soc-pcm.c: Make sure DAI parameters cleared if the DAI becomes inactive Message-ID: References: <20230920153621.711373-1-chancel.liu@nxp.com> <20230920153621.711373-2-chancel.liu@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230920153621.711373-2-chancel.liu@nxp.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 27 Nov 2023 00:29:11 -0800 (PST) On Wed, Sep 20, 2023 at 11:36:21PM +0800, Chancel Liu wrote: > The commit 1da681e52853 ("ASoC: soc-pcm.c: Clear DAIs parameters after > stream_active is updated") tries to make sure DAI parameters can be > cleared properly through moving the cleanup to the place where stream > active status is updated. However, it will cause the cleanup only > happening in soc_pcm_close(). > > Suppose a case: aplay -Dhw:0 44100.wav 48000.wav. The case calls > soc_pcm_open()->soc_pcm_hw_params()->soc_pcm_hw_free()-> > soc_pcm_hw_params()->soc_pcm_hw_free()->soc_pcm_close() in order. The > parameters would be remained in the system even if the playback of > 44100.wav is finished. > > The case requires us clearing parameters in phase of soc_pcm_hw_free(). > However, moving the DAI parameters cleanup back to soc_pcm_hw_free() > has the risk that DAIs parameters never be cleared if there're more > than one stream, see commit 1da681e52853 ("ASoC: soc-pcm.c: Clear DAIs > parameters after stream_active is updated") for more details. > > To meet all these requirements, in addition to do DAI parameters > cleanup in soc_pcm_hw_free(), also check it in soc_pcm_close() to make > sure DAI parameters cleared if the DAI becomes inactive. > > Fixes: 1da681e52853 ("ASoC: soc-pcm.c: Clear DAIs parameters after stream_active is updated") > Signed-off-by: Chancel Liu For the record, this change incidentally also fixed the remaining click sounds I heard when stopping pulseaudio (e.g. on reboot) with the Lenovo ThinkPad X13s, which have also been discussed here: https://lore.kernel.org/lkml/ZTukaxUhgY4WLgEs@hovoldconsulting.com/ Johan