From patchwork Fri Dec 2 16:39:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13062896 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DFC33C4321E for ; Fri, 2 Dec 2022 16:24:05 +0000 (UTC) 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 03ECC188F; Fri, 2 Dec 2022 17:23:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 03ECC188F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669998244; bh=B/QzYcOylHgO5bXZk2VAURwLxYtGW6UmIy1vJ5Yjpek=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JV7SpxVU8UdMv7bYQal7LgZ8VfoofBXcfHn1ltPn+rY7WKVPOkp6GBonk3zRW40MB VDfmg2T7qC1rfgYL9quVeDlekbK/Jt/TnmxUPGThRtZon97zTXgnk2UDKn7OzTVZ1a fD6/Kyp8tyEgEBzZxc7vVqYBJZdoxj1HMDTSYpRw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7319CF804FC; Fri, 2 Dec 2022 17:22:55 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 23A17F804FC; Fri, 2 Dec 2022 17:22:54 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 72F7AF80272 for ; Fri, 2 Dec 2022 17:22:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 72F7AF80272 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lPs7tvFv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669998168; x=1701534168; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B/QzYcOylHgO5bXZk2VAURwLxYtGW6UmIy1vJ5Yjpek=; b=lPs7tvFvJ0nsilyzk+Xr65nhmXMdrvZymorGKtjOQAPARei2qPTEz4q8 JPAHY66Frq2+BHkz9yc361CF1afzB+W/HPYYRpPI1U7PFqvtMeeDimaSU socA9EjB4Q09rK13sybKJ17+DmPAH867UkjxcPejAeStAdjfwpkcfHiDi OpXUurZ01vQhwStscuD5a3yDXUO4KfNvN4vEI63Bn0NoP72Zv2JzrBocr SeFyU7gN0vwsWoPXeGCD3XV3/oAYWm+4a0Im6WIe12LfPgJvuPnwrdZX5 WQVFrjn7XHzvFdusBtxhGsmknMV8erknZvDlmIW5Z54/NNkJnmGSdrhda A==; X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="314689478" X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="314689478" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2022 08:22:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="733858970" X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="733858970" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by FMSMGA003.fm.intel.com with ESMTP; 02 Dec 2022 08:22:43 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 1/5] ASoC: Intel: Skylake: Update pipe_config_idx before filling BE params Date: Fri, 2 Dec 2022 17:39:41 +0100 Message-Id: <20221202163945.674746-2-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221202163945.674746-1-cezary.rojewski@intel.com> References: <20221202163945.674746-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: pierre-louis.bossart@linux.intel.com, Cezary Rojewski , upstream@semihalf.com, rad@semihalf.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com, cujomalainey@chromium.org, lma@semihalf.com 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" Without updating the index before BE copier config is filled with hardware parameters, outdated parameters are used instead. Signed-off-by: Cezary Rojewski --- sound/soc/intel/skylake/skl-topology.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index e06eac592da1..fc3d719d93e1 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -1837,16 +1837,24 @@ static int skl_tplg_be_fill_pipe_params(struct snd_soc_dai *dai, { struct nhlt_specific_cfg *cfg; struct skl_pipe *pipe = mconfig->pipe; + struct skl_pipe_params save = *pipe->p_params; struct skl_pipe_fmt *pipe_fmt; struct skl_dev *skl = get_skl_ctx(dai->dev); int link_type = skl_tplg_be_link_type(mconfig->dev_type); u8 dev_type = skl_tplg_be_dev_type(mconfig->dev_type); + int ret; skl_tplg_fill_dma_id(mconfig, params); if (link_type == NHLT_LINK_HDA) return 0; + *pipe->p_params = *params; + ret = skl_tplg_get_pipe_config(skl, mconfig); + if (ret) + goto err; + + dev_dbg(skl->dev, "%s using pipe config: %d\n", __func__, pipe->pipe_config_idx); if (pipe->direction == SNDRV_PCM_STREAM_PLAYBACK) pipe_fmt = &pipe->configs[pipe->pipe_config_idx].out_fmt; else @@ -1865,10 +1873,15 @@ static int skl_tplg_be_fill_pipe_params(struct snd_soc_dai *dai, dev_err(dai->dev, "Blob NULL for id:%d type:%d dirn:%d ch:%d, freq:%d, fmt:%d\n", mconfig->vbus_id, link_type, params->stream, params->ch, params->s_freq, params->s_fmt); - return -EINVAL; + ret = -EINVAL; + goto err; } return 0; + +err: + *pipe->p_params = save; + return ret; } static int skl_tplg_be_set_src_pipe_params(struct snd_soc_dai *dai, From patchwork Fri Dec 2 16:39:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13062897 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 94D2EC4321E for ; Fri, 2 Dec 2022 16:24:34 +0000 (UTC) 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 CBD311896; Fri, 2 Dec 2022 17:23:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CBD311896 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669998272; bh=aErEeCh11l+wjRHVyMJX8sMWTk/D9edkdEtg2W2BMLw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=X4sJxOE2QXWvJ51EFeTUz9w52NHTDGpyZRmVEghQlSvp1DNQiPg/NR+a+DckTJ67P GFRF9iig1VX8hCsAngOOBcfyfSsHzmLbSjN9cgj5FC3Z8o/Na4i5hK3OnBrQJnawyq i9LpNoPsuOTjXpBdAj+x7KZkpjeT7dcwppYWLlfE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 253C8F80559; Fri, 2 Dec 2022 17:22:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EDB01F8055A; Fri, 2 Dec 2022 17:22:55 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 421B6F800BD for ; Fri, 2 Dec 2022 17:22:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 421B6F800BD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PM198+Mo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669998170; x=1701534170; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aErEeCh11l+wjRHVyMJX8sMWTk/D9edkdEtg2W2BMLw=; b=PM198+Mo8uEn7VwtFZ2tziB2XUTHZ//+uy8NuBrWVbB1J00CQkM2n9uO 0/reMA+B7FeD1eV0nT56xQnjjv8tVk+/oKOjGzKwiEDdA2byG05zlPfqj nKeS9o8ocYhRA7f/MteyD/XWm2GMlJPNgq1lPe/mY6y8ApP+ZUL39AdLC K6k7Co8BAB7Hi2lJsZ2P+DJKtY6zJeNc51Iif5lH99NXDE+oD8xs4YLit B5spY1/jilIkWKPUXZIUOMlRxPMXEcJeFh/b27KaQQct7XlaKfhjDNarC TK/INCpcEFp19QFC6qMsIx+FUZ9F12jG57bSqtW02U5Vz5vkXABhZRCHu Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="314689501" X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="314689501" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2022 08:22:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="733858987" X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="733858987" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by FMSMGA003.fm.intel.com with ESMTP; 02 Dec 2022 08:22:46 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 2/5] ASoC: Intel: Skylake: Remove skl_tplg_is_multi_fmt() Date: Fri, 2 Dec 2022 17:39:42 +0100 Message-Id: <20221202163945.674746-3-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221202163945.674746-1-cezary.rojewski@intel.com> References: <20221202163945.674746-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: pierre-louis.bossart@linux.intel.com, Cezary Rojewski , upstream@semihalf.com, rad@semihalf.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com, cujomalainey@chromium.org, lma@semihalf.com 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" Rather than forcing userspace to select proper format with enumerable kcontrols, select it ourselves based on provided hw_params. Signed-off-by: Cezary Rojewski --- sound/soc/intel/skylake/skl-topology.c | 40 -------------------------- 1 file changed, 40 deletions(-) diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index fc3d719d93e1..f144acae1b44 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -582,38 +582,6 @@ static int skl_tplg_unload_pipe_modules(struct skl_dev *skl, return ret; } -static bool skl_tplg_is_multi_fmt(struct skl_dev *skl, struct skl_pipe *pipe) -{ - struct skl_pipe_fmt *cur_fmt; - struct skl_pipe_fmt *next_fmt; - int i; - - if (pipe->nr_cfgs <= 1) - return false; - - if (pipe->conn_type != SKL_PIPE_CONN_TYPE_FE) - return true; - - for (i = 0; i < pipe->nr_cfgs - 1; i++) { - if (pipe->direction == SNDRV_PCM_STREAM_PLAYBACK) { - cur_fmt = &pipe->configs[i].out_fmt; - next_fmt = &pipe->configs[i + 1].out_fmt; - } else { - cur_fmt = &pipe->configs[i].in_fmt; - next_fmt = &pipe->configs[i + 1].in_fmt; - } - - if (!CHECK_HW_PARAMS(cur_fmt->channels, cur_fmt->freq, - cur_fmt->bps, - next_fmt->channels, - next_fmt->freq, - next_fmt->bps)) - return true; - } - - return false; -} - /* * Here, we select pipe format based on the pipe type and pipe * direction to determine the current config index for the pipeline. @@ -636,14 +604,6 @@ skl_tplg_get_pipe_config(struct skl_dev *skl, struct skl_module_cfg *mconfig) return 0; } - if (skl_tplg_is_multi_fmt(skl, pipe)) { - pipe->cur_config_idx = pipe->pipe_config_idx; - pipe->memory_pages = pconfig->mem_pages; - dev_dbg(skl->dev, "found pipe config idx:%d\n", - pipe->cur_config_idx); - return 0; - } - if (pipe->conn_type == SKL_PIPE_CONN_TYPE_NONE || pipe->nr_cfgs == 1) { dev_dbg(skl->dev, "No conn_type or just 1 pathcfg, taking 0th for %d\n", pipe->ppl_id); From patchwork Fri Dec 2 16:39:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13062898 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DAD4BC4321E for ; Fri, 2 Dec 2022 16:24:39 +0000 (UTC) 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 15A7C187D; Fri, 2 Dec 2022 17:23:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 15A7C187D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669998278; bh=Dkk3vruKcuTKAa07QIz7BbG/O+nO0F12C0SGGoHh5f0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=j4uETmiEEbaEfczLnkHC9fxUfWxW1mbIUSLX74IuWlXcQhPp5NSDcjw02k5rDNHnw +JT/hdTGRF/x4AYWEYqaTnQL3F+PZz/mi7ZXCNLvJi3BlRTzlSZxzKl8sGp43wZ8k7 O2gXB6tp0owluGYEr4xbVNFUB/jaVkk6qSlLlsWQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C8042F80272; Fri, 2 Dec 2022 17:23:00 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B29B5F80564; Fri, 2 Dec 2022 17:22:59 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2773BF80272 for ; Fri, 2 Dec 2022 17:22:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2773BF80272 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lAR6bqQQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669998174; x=1701534174; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dkk3vruKcuTKAa07QIz7BbG/O+nO0F12C0SGGoHh5f0=; b=lAR6bqQQSMgZDdd2EaKMr/c6H9qmcJheBuyB480XshxrP/SKfob9dpp/ lHi2sJF/ujg16EGoVF8e3ztr8j6TyIHn30D57sFdg+7PXT0iHccX9Ad3U aHH2MJb81IWxGiYRIIQFbCnUTgxfGdYpVllG3Ve4uBME5smhQJsQMvCHl 65uANOdWYjcjDNy0HvEjJWk3D6UhXUSAGalrpHOVlXhXA2R6xCKynAG6j noZlKgMRjKn6XFvsMocAG4KobdsM+tdKP2+Z2YjVaYmJnApWASWJI223I gt50exp04ecri1f7DUjevVIPWWLwjqNCmVFOIjRzHTdjyD2gPwCO3mSMV w==; X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="314689512" X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="314689512" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2022 08:22:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="733858991" X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="733858991" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by FMSMGA003.fm.intel.com with ESMTP; 02 Dec 2022 08:22:48 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 3/5] ASoC: Intel: Skylake: Drop pipe_config_idx Date: Fri, 2 Dec 2022 17:39:43 +0100 Message-Id: <20221202163945.674746-4-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221202163945.674746-1-cezary.rojewski@intel.com> References: <20221202163945.674746-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: pierre-louis.bossart@linux.intel.com, Cezary Rojewski , upstream@semihalf.com, rad@semihalf.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com, cujomalainey@chromium.org, lma@semihalf.com 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" Field ->pipe_config_idx duplicates the job of ->cur_config_idx so remove it. Signed-off-by: Cezary Rojewski --- sound/soc/intel/skylake/skl-topology.c | 10 +++++----- sound/soc/intel/skylake/skl-topology.h | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index f144acae1b44..567a3b661ce4 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -1351,9 +1351,9 @@ static int skl_tplg_multi_config_set_get(struct snd_kcontrol *kcontrol, return -EIO; if (is_set) - pipe->pipe_config_idx = ucontrol->value.enumerated.item[0]; + pipe->cur_config_idx = ucontrol->value.enumerated.item[0]; else - ucontrol->value.enumerated.item[0] = pipe->pipe_config_idx; + ucontrol->value.enumerated.item[0] = pipe->cur_config_idx; return 0; } @@ -1814,11 +1814,11 @@ static int skl_tplg_be_fill_pipe_params(struct snd_soc_dai *dai, if (ret) goto err; - dev_dbg(skl->dev, "%s using pipe config: %d\n", __func__, pipe->pipe_config_idx); + dev_dbg(skl->dev, "%s using pipe config: %d\n", __func__, pipe->cur_config_idx); if (pipe->direction == SNDRV_PCM_STREAM_PLAYBACK) - pipe_fmt = &pipe->configs[pipe->pipe_config_idx].out_fmt; + pipe_fmt = &pipe->configs[pipe->cur_config_idx].out_fmt; else - pipe_fmt = &pipe->configs[pipe->pipe_config_idx].in_fmt; + pipe_fmt = &pipe->configs[pipe->cur_config_idx].in_fmt; /* update the blob based on virtual bus_id*/ cfg = intel_nhlt_get_endpoint_blob(dai->dev, skl->nhlt, diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h index 017ac0ef324d..6db0fd7bad49 100644 --- a/sound/soc/intel/skylake/skl-topology.h +++ b/sound/soc/intel/skylake/skl-topology.h @@ -324,7 +324,6 @@ struct skl_pipe { struct skl_path_config configs[SKL_MAX_PATH_CONFIGS]; struct list_head w_list; bool passthru; - u32 pipe_config_idx; }; enum skl_module_state { From patchwork Fri Dec 2 16:39:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13062899 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1BE0DC47089 for ; Fri, 2 Dec 2022 16:24:52 +0000 (UTC) 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 3B9BE18A5; Fri, 2 Dec 2022 17:24:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3B9BE18A5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669998290; bh=gjGSVlKOBmP4//103vV1Se01lrQ00rii4KNWv7jXxbw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lHYTgC1yJAxYKMDrI0M7RFJsCNrevdr6KEgAJSEha5IHtInakVz2B39KC7r1s6QBq dnun2v2/LMlqGPT3RzftZgMYZhFszz2pHSVqQIg071azD3YKwtOPUtMWdfkcQdBzNo bWWju2jQdokDhK4iH3sPlf0DVnzzX4Y+fzhcnbSc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 66615F800BD; Fri, 2 Dec 2022 17:23:02 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A42AEF8056F; Fri, 2 Dec 2022 17:23:01 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0D019F800BD for ; Fri, 2 Dec 2022 17:22:54 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0D019F800BD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="P6Hcynwr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669998176; x=1701534176; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gjGSVlKOBmP4//103vV1Se01lrQ00rii4KNWv7jXxbw=; b=P6HcynwrNmjGHPcr05tnYyWZvaZB6loCPsj4+6V9IGCcZyLE2X5sbgfD 57QBKEqERL3j+Dw9xYyir9XPG084hp8RQJcxa0VZm0sFLSnbRvKDwv5jE i7S5gl8orFc4nmHFl570SWMF6W9eDRg/rXVitxexY5hgSGYdams3ZSGfF PVZZh7JCBRWNBIZDxO4XY9KOtXsgh00ytDx2VTGI+nYzWhuU9uGxAa2Es R8UIvb798fhGXmFLQt8oVZIm/4nXIGae7AztoQrIFNohdKLdxUMslvfcW tHJu1aQ+jEwuLPvt9OQk34Lh5s3gD3ewKLmA9OjplOWMFYUUHIY/UPEm4 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="314689522" X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="314689522" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2022 08:22:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="733858994" X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="733858994" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by FMSMGA003.fm.intel.com with ESMTP; 02 Dec 2022 08:22:51 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 4/5] ASoC: Intel: Skylake: Introduce single place for pipe-config selection Date: Fri, 2 Dec 2022 17:39:44 +0100 Message-Id: <20221202163945.674746-5-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221202163945.674746-1-cezary.rojewski@intel.com> References: <20221202163945.674746-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: pierre-louis.bossart@linux.intel.com, Cezary Rojewski , upstream@semihalf.com, rad@semihalf.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com, cujomalainey@chromium.org, lma@semihalf.com 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" Provide a single location for pipe config selection where all fields that have to be updated whenever ->pipe_config_idx changes can be updated accordingly. Signed-off-by: Cezary Rojewski --- sound/soc/intel/skylake/skl-topology.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index 567a3b661ce4..b20643b83401 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -582,6 +582,12 @@ static int skl_tplg_unload_pipe_modules(struct skl_dev *skl, return ret; } +static void skl_tplg_set_pipe_config_idx(struct skl_pipe *pipe, int idx) +{ + pipe->cur_config_idx = idx; + pipe->memory_pages = pipe->configs[idx].mem_pages; +} + /* * Here, we select pipe format based on the pipe type and pipe * direction to determine the current config index for the pipeline. @@ -600,16 +606,14 @@ skl_tplg_get_pipe_config(struct skl_dev *skl, struct skl_module_cfg *mconfig) int i; if (pipe->nr_cfgs == 0) { - pipe->cur_config_idx = 0; + skl_tplg_set_pipe_config_idx(pipe, 0); return 0; } if (pipe->conn_type == SKL_PIPE_CONN_TYPE_NONE || pipe->nr_cfgs == 1) { dev_dbg(skl->dev, "No conn_type or just 1 pathcfg, taking 0th for %d\n", pipe->ppl_id); - pipe->cur_config_idx = 0; - pipe->memory_pages = pconfig->mem_pages; - + skl_tplg_set_pipe_config_idx(pipe, 0); return 0; } @@ -628,10 +632,8 @@ skl_tplg_get_pipe_config(struct skl_dev *skl, struct skl_module_cfg *mconfig) if (CHECK_HW_PARAMS(params->ch, params->s_freq, params->s_fmt, fmt->channels, fmt->freq, fmt->bps)) { - pipe->cur_config_idx = i; - pipe->memory_pages = pconfig->mem_pages; + skl_tplg_set_pipe_config_idx(pipe, i); dev_dbg(skl->dev, "Using pipe config: %d\n", i); - return 0; } } @@ -1351,7 +1353,7 @@ static int skl_tplg_multi_config_set_get(struct snd_kcontrol *kcontrol, return -EIO; if (is_set) - pipe->cur_config_idx = ucontrol->value.enumerated.item[0]; + skl_tplg_set_pipe_config_idx(pipe, ucontrol->value.enumerated.item[0]); else ucontrol->value.enumerated.item[0] = pipe->cur_config_idx; From patchwork Fri Dec 2 16:39:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13062900 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 11A40C4321E for ; Fri, 2 Dec 2022 16:25:04 +0000 (UTC) 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 47A2E18AA; Fri, 2 Dec 2022 17:24:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 47A2E18AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669998302; bh=gXfSGnPfL+Q635d2cehZtogy9MtbXl2+EV/nOLXsI2g=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hSz7tPvILzfEPfHGdrzdNtTZiSTod5VrbJybW89AatUXYqmahmQ2J0Vumib/QZAF+ k9zVxk7ZKM6jmLZTn6aoo1Domq+fT3Sm6qkCwPzsTX9ZLQEfMGba4thqndtlHEYae2 m9/KI2thIVMD30PTYKBapDtNipeJthBtClhMGt+g= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EE4B5F80571; Fri, 2 Dec 2022 17:23:07 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E9C75F80578; Fri, 2 Dec 2022 17:23:05 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 285EDF8055A for ; Fri, 2 Dec 2022 17:22:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 285EDF8055A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Z0XBC4zk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669998180; x=1701534180; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gXfSGnPfL+Q635d2cehZtogy9MtbXl2+EV/nOLXsI2g=; b=Z0XBC4zkS8OOQmXM7RT/57YJlw0/brNdBbDIVU9wwGo3Ki0CgsSFT+5q 8jMxWMM/1uaY9JS8xT+U0m5iQ/ueZbWvKYhxUgS+ScRferG+B2oZS9zSj NdPocBr2Z5pRWH5n48LMrAbVqarI90Y7UKEVzU2W3SREdBEHdrCKRhzsf nrod6ORc/UqIyBe0G55MVakw/r2FZm+px4cOj60osYASN9UDC/q0JlM2v +IWV/S6jenkyMykAuPMl4jSV28sFsCOC02A3GBxmQCS2hPoC9goxYuquz a8l0MyLFU8JI4XXIzguRAp5hJoFo9HQByh47EicOX19gVU1CZrZmMllQs Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="314689536" X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="314689536" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2022 08:22:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="733858998" X-IronPort-AV: E=Sophos;i="5.96,212,1665471600"; d="scan'208";a="733858998" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by FMSMGA003.fm.intel.com with ESMTP; 02 Dec 2022 08:22:53 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 5/5] ASoC: Intel: Skylake: Fix driver hang during shutdown Date: Fri, 2 Dec 2022 17:39:45 +0100 Message-Id: <20221202163945.674746-6-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221202163945.674746-1-cezary.rojewski@intel.com> References: <20221202163945.674746-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: pierre-louis.bossart@linux.intel.com, Cezary Rojewski , upstream@semihalf.com, rad@semihalf.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com, cujomalainey@chromium.org, lma@semihalf.com 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" AudioDSP cores and HDAudio links need to be turned off on shutdown to ensure no communication or data transfer occurs during the procedure. Fixes: c5a76a246989 ("ASoC: Intel: Skylake: Add shutdown callback") Signed-off-by: Cezary Rojewski --- sound/soc/intel/skylake/skl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c index 9bd9f9866898..998bd0232cf1 100644 --- a/sound/soc/intel/skylake/skl.c +++ b/sound/soc/intel/skylake/skl.c @@ -1107,7 +1107,10 @@ static void skl_shutdown(struct pci_dev *pci) if (!skl->init_done) return; - snd_hdac_stop_streams_and_chip(bus); + snd_hdac_stop_streams(bus); + snd_hdac_ext_bus_link_power_down_all(bus); + skl_dsp_sleep(skl->dsp); + list_for_each_entry(s, &bus->stream_list, list) { stream = stream_to_hdac_ext_stream(s); snd_hdac_ext_stream_decouple(bus, stream, false);