From patchwork Wed Aug 18 07:57:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 499801 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 39CE1C4338F for ; Wed, 18 Aug 2021 07:59:21 +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 1AE306108B for ; Wed, 18 Aug 2021 07:59:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1AE306108B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=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 B80EF168A; Wed, 18 Aug 2021 09:58:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B80EF168A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1629273558; bh=Y/uzR3GGpPehxp0/DWUKUBYg15ZeBnxan7j9G3uhmTs=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gid3p3+KDtOaO+MPCmbSlgSGOIxODH2ZxY9eaJb0xa/HQtddxDhDh1kker6aiPgd/ 1OoMNiK5Ml52AZ8uAHyb489vDstOM8GGGIWuQy3LQkibW+y2xT4V5YdJbucj7DBSlj SYRAq3qTmHP/pSJ933SrV40CylgDShp/bCZBEspE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E0443F80527; Wed, 18 Aug 2021 09:55:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CCBC9F8051A; Wed, 18 Aug 2021 09:55:32 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 E75F9F80519 for ; Wed, 18 Aug 2021 09:55:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E75F9F80519 X-IronPort-AV: E=McAfee;i="6200,9189,10079"; a="195855585" X-IronPort-AV: E=Sophos;i="5.84,330,1620716400"; d="scan'208";a="195855585" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2021 00:55:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,330,1620716400"; d="scan'208";a="676975010" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga006.fm.intel.com with ESMTP; 18 Aug 2021 00:55:24 -0700 From: Cezary Rojewski To: alsa-devel@alsa-project.org Subject: [PATCH 10/11] ASoC: Intel: Skylake: Properly configure modules with generic extension Date: Wed, 18 Aug 2021 09:57:41 +0200 Message-Id: <20210818075742.1515155-11-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818075742.1515155-1-cezary.rojewski@intel.com> References: <20210818075742.1515155-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Szymon Mielczarek , jairaj.arava@intel.com, upstream@semihalf.com, Cezary Rojewski , harshapriya.n@intel.com, cujomalainey@google.com, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, Gustaw Lewandowski , hdegoede@redhat.com, broonie@kernel.org, jenny.tc@intel.com, lma@semihalf.com, Pawel Harlozinski , vamshi.krishna.gopal@intel.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" From: Pawel Harlozinski Make use of struct skl_base_cfg_ext and its format setter to configure modules which are described with said structure. Signed-off-by: Gustaw Lewandowski Signed-off-by: Pawel Harlozinski Signed-off-by: Szymon Mielczarek Signed-off-by: Cezary Rojewski --- sound/soc/intel/skylake/skl-messages.c | 51 ++++++++------------------ 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c index 8886f984ae26..eaad180af42e 100644 --- a/sound/soc/intel/skylake/skl-messages.c +++ b/sound/soc/intel/skylake/skl-messages.c @@ -806,27 +806,6 @@ static void skl_set_copier_format(struct skl_dev *skl, skl_setup_cpr_gateway_cfg(skl, mconfig, cpr_mconfig); } -/* - * Algo module are DSP pre processing modules. Algo module take base module - * configuration and params - */ - -static void skl_set_algo_format(struct skl_dev *skl, - struct skl_module_cfg *mconfig, - struct skl_algo_cfg *algo_mcfg) -{ - struct skl_base_cfg *base_cfg = (struct skl_base_cfg *)algo_mcfg; - - skl_set_base_module_format(skl, mconfig, base_cfg); - if (mconfig->formats_config[SKL_PARAM_INIT].caps_size == 0) - return; - - memcpy(algo_mcfg->params, - mconfig->formats_config[SKL_PARAM_INIT].caps, - mconfig->formats_config[SKL_PARAM_INIT].caps_size); - -} - /* * Mic select module allows selecting one or many input channels, thus * acting as a demux. @@ -849,6 +828,8 @@ static void skl_set_base_outfmt_format(struct skl_dev *skl, static u16 skl_get_module_param_size(struct skl_dev *skl, struct skl_module_cfg *mconfig) { + struct skl_module_res *res; + struct skl_module *module = mconfig->module; u16 param_size; switch (mconfig->m_type) { @@ -863,11 +844,6 @@ static u16 skl_get_module_param_size(struct skl_dev *skl, case SKL_MODULE_TYPE_UPDWMIX: return sizeof(struct skl_up_down_mixer_cfg); - case SKL_MODULE_TYPE_ALGO: - param_size = sizeof(struct skl_base_cfg); - param_size += mconfig->formats_config[SKL_PARAM_INIT].caps_size; - return param_size; - case SKL_MODULE_TYPE_BASE_OUTFMT: case SKL_MODULE_TYPE_MIC_SELECT: return sizeof(struct skl_base_outfmt_cfg); @@ -876,12 +852,16 @@ static u16 skl_get_module_param_size(struct skl_dev *skl, case SKL_MODULE_TYPE_KPB: return sizeof(struct skl_base_cfg); + case SKL_MODULE_TYPE_ALGO: default: - /* - * return only base cfg when no specific module type is - * specified - */ - return sizeof(struct skl_base_cfg); + res = &module->resources[mconfig->res_idx]; + + param_size = sizeof(struct skl_base_cfg) + sizeof(struct skl_base_cfg_ext); + param_size += (res->nr_input_pins + res->nr_output_pins) * + sizeof(struct skl_pin_format); + param_size += mconfig->formats_config[SKL_PARAM_INIT].caps_size; + + return param_size; } return 0; @@ -922,10 +902,6 @@ static int skl_set_module_format(struct skl_dev *skl, skl_set_updown_mixer_format(skl, module_config, *param_data); break; - case SKL_MODULE_TYPE_ALGO: - skl_set_algo_format(skl, module_config, *param_data); - break; - case SKL_MODULE_TYPE_BASE_OUTFMT: case SKL_MODULE_TYPE_MIC_SELECT: skl_set_base_outfmt_format(skl, module_config, *param_data); @@ -936,10 +912,13 @@ static int skl_set_module_format(struct skl_dev *skl, skl_set_base_module_format(skl, module_config, *param_data); break; + case SKL_MODULE_TYPE_ALGO: default: skl_set_base_module_format(skl, module_config, *param_data); + skl_set_base_ext_module_format(skl, module_config, + *param_data + + sizeof(struct skl_base_cfg)); break; - } dev_dbg(skl->dev, "Module type=%d id=%d config size: %d bytes\n",