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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 895C6C77B71 for ; Thu, 13 Apr 2023 02:38:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230063AbjDMCiC (ORCPT ); Wed, 12 Apr 2023 22:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229928AbjDMChP (ORCPT ); Wed, 12 Apr 2023 22:37:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A0688A7B; Wed, 12 Apr 2023 19:36:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4E0B463A9A; Thu, 13 Apr 2023 02:36:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D578AC4339C; Thu, 13 Apr 2023 02:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681353415; bh=P1RJ20QJirQyRF3HhoWwKz3CHgv5xWwc6aSBD4SJCo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SwcQyGyRSZZrimKUkQzBwbeBYipfzG4G5sKM1V3TKyUV3qptQguQUj5lTMbt6CKlm 36vbC7oygyuu3IMGZrcZeWhseFOwuo0OIseaQs9bMhcGQDGZlFEfnbcjKvfM0Ogfao /YA5dIRmeYJEMe2Efexf0L3COrxUuaivIsX8zZgeXCk1iy8TK/yaosO7VYGCHhAoBf rcQPyLcYLnUMU5wkjDeRtohqqiUEu5E7tIueGh7N84Q0hC9Wa4J9VckIOwjWIBtm34 E/reX9rRALNiIsESVqNUpH2w+Pljc9Hi6A/vOmz/gHndzUbK1Qaq7m9FRAs+Misyhv 9MyZc+yJgoSHg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Shengjiu Wang , Mark Brown , Sasha Levin , lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 6.1 03/17] ASoC: soc-pcm: fix hw->formats cleared by soc_pcm_hw_init() for dpcm Date: Wed, 12 Apr 2023 22:36:31 -0400 Message-Id: <20230413023647.74661-3-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230413023647.74661-1-sashal@kernel.org> References: <20230413023647.74661-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shengjiu Wang [ Upstream commit 083a25b18d6ad9f1f540e629909aa3eaaaf01823 ] The hw->formats may be set by snd_dmaengine_pcm_refine_runtime_hwparams() in component's startup()/open(), but soc_pcm_hw_init() will init hw->formats in dpcm_runtime_setup_fe() after component's startup()/open(), which causes the valuable hw->formats to be cleared. So need to store the hw->formats before initialization, then restore it after initialization. Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1678346017-3660-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/soc-pcm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 35a16c3f9591b..7a486ca9633c1 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1649,10 +1649,14 @@ static void dpcm_runtime_setup_fe(struct snd_pcm_substream *substream) struct snd_pcm_hardware *hw = &runtime->hw; struct snd_soc_dai *dai; int stream = substream->stream; + u64 formats = hw->formats; int i; soc_pcm_hw_init(hw); + if (formats) + hw->formats &= formats; + for_each_rtd_cpu_dais(fe, i, dai) { struct snd_soc_pcm_stream *cpu_stream; -- 2.39.2