From patchwork Thu Feb 8 10:23:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 770919 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 5957DC4828F for ; Thu, 8 Feb 2024 10:24:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 37CB1846; Thu, 8 Feb 2024 11:24:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 37CB1846 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1707387883; bh=RtezLeKtYqzMMlD7l4M22QwSiNc/vjvRHMceNkkvGLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=pGoBlLB8uPOv9RcrEKFzVMLGLNxgrosqSAU/Fa0t3qHRa4vqKxuFyHvbm7Cb4dn+8 HcvsPoblN+O9F9EZqxVUV0WHxm8kIwL4HYVANP9QNV4vt1+JFjOyQdcBaRI131ojpu 9ZVYYD7iZoQJe5Em+srxgtBnch65h4C7GfDiK8Ak= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1A533F805C8; Thu, 8 Feb 2024 11:23:50 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 10455F805D4; Thu, 8 Feb 2024 11:23:50 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A7DBFF80548; Thu, 8 Feb 2024 11:23:44 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 95DBBF800EE for ; Thu, 8 Feb 2024 11:23:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 95DBBF800EE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=iF3EIEgK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707387819; x=1738923819; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RtezLeKtYqzMMlD7l4M22QwSiNc/vjvRHMceNkkvGLc=; b=iF3EIEgKYba4DMUXT4bRkq71CLrToDq85ecGEoPmaNFBGvLjMfgwacHg 5JAaoyM9Pvb/TSTgrx1jS6xt9QXLOT2dYgT00eQv8Wc8W9qXBPsvHB7JE l9t0VEnI9KgGbf/jtFP9QVAOA09vnZUu/jvqhPMUbcpccfeCkYvJue3n+ c/AMCSFJ7sq2qQg/Otalb47/kZSBWHl3xlxUOdUx2LKIoZQ1tRp5zAeNA V6HRZTefZNTkA0ZBVUlXP/AsYJR2WxnQ/xaFmknljSFfg7MYP2VbDwOjt VPvknLryU6zCCrtnBgMpzLd6zrDelR/QwUl74FnPjUli6s6eJ5thczEKx Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10977"; a="18699117" X-IronPort-AV: E=Sophos;i="6.05,253,1701158400"; d="scan'208";a="18699117" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 02:23:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,253,1701158400"; d="scan'208";a="1913784" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmviesa006.fm.intel.com with ESMTP; 08 Feb 2024 02:23:32 -0800 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, =?utf-8?q?=C5=81u?= =?utf-8?q?kasz_Majczak?= , =?utf-8?q?Amadeusz_S=C5=82awi?= =?utf-8?q?=C5=84ski?= Subject: [PATCH v2 1/3] ASoC: Intel: avs: UAPI: Add tokens for initial config feature Date: Thu, 8 Feb 2024 11:23:58 +0100 Message-Id: <20240208102400.2497791-2-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240208102400.2497791-1-amadeuszx.slawinski@linux.intel.com> References: <20240208102400.2497791-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: VLH22M3ZBRJHZDUZ763HXY255B67C4M4 X-Message-ID-Hash: VLH22M3ZBRJHZDUZ763HXY255B67C4M4 X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Allow for defining initial config which will be send after module initialization to configure initial module state. This is only useful for modules which need to be configured on init. Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- include/uapi/sound/intel/avs/tokens.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/uapi/sound/intel/avs/tokens.h b/include/uapi/sound/intel/avs/tokens.h index 4ffe546aa409a..4beca03405c07 100644 --- a/include/uapi/sound/intel/avs/tokens.h +++ b/include/uapi/sound/intel/avs/tokens.h @@ -19,6 +19,8 @@ enum avs_tplg_token { AVS_TKN_MANIFEST_NUM_MODCFGS_EXT_U32 = 6, AVS_TKN_MANIFEST_NUM_PPLCFGS_U32 = 7, AVS_TKN_MANIFEST_NUM_BINDINGS_U32 = 8, + AVS_TKN_MANIFEST_NUM_CONDPATH_TMPLS_U32 = 9, + AVS_TKN_MANIFEST_NUM_INIT_CONFIGS_U32 = 10, /* struct avs_tplg_library */ AVS_TKN_LIBRARY_ID_U32 = 101, @@ -109,6 +111,8 @@ enum avs_tplg_token { AVS_TKN_MOD_PROC_DOMAIN_U8 = 1705, AVS_TKN_MOD_MODCFG_EXT_ID_U32 = 1706, AVS_TKN_MOD_KCONTROL_ID_U32 = 1707, + AVS_TKN_MOD_INIT_CONFIG_NUM_IDS_U32 = 1708, + AVS_TKN_MOD_INIT_CONFIG_ID_U32 = 1709, /* struct avs_tplg_path_template */ AVS_TKN_PATH_TMPL_ID_U32 = 1801, @@ -125,6 +129,11 @@ enum avs_tplg_token { /* struct avs_tplg_kcontrol */ AVS_TKN_KCONTROL_ID_U32 = 2301, + + /* struct avs_tplg_init_config */ + AVS_TKN_INIT_CONFIG_ID_U32 = 2401, + AVS_TKN_INIT_CONFIG_PARAM_U8 = 2402, + AVS_TKN_INIT_CONFIG_LENGTH_U32 = 2403, }; #endif From patchwork Thu Feb 8 10:24:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 770918 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 0EBEDC48260 for ; Thu, 8 Feb 2024 10:25:22 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5E2A2B70; Thu, 8 Feb 2024 11:25:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5E2A2B70 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1707387915; bh=Ko10ZkzkLNKDt3XPWSA4Pl4GxMkRRlKq5pWgyGeCp8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=lJAFaWIUvncrZAb9NPe+pCJxg5wJiigl3KAZ5VBfsSLZnANFFgsfwyt+JVkfoXLOy nGpNv/sK1q2BwFB0Taa/fOcIedGMaNLqjfWn1NQfrZEhkwliapotsYWLf75+KgZ08e cmwgy4+elIayaU7wTYgZ+jbArNcVzWggeCayg8jU= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1F0EFF805BD; Thu, 8 Feb 2024 11:24:47 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id A0273F805AB; Thu, 8 Feb 2024 11:24:46 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8B076F801EB; Thu, 8 Feb 2024 11:24:42 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 7D9E4F804E7 for ; Thu, 8 Feb 2024 11:23:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7D9E4F804E7 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=gX+g5mo4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707387820; x=1738923820; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ko10ZkzkLNKDt3XPWSA4Pl4GxMkRRlKq5pWgyGeCp8g=; b=gX+g5mo4tS5sQQA6efs33jknB/RPxL4WJuWgyGlaws4LBtvTj4qt7ACn lKGp0IiTN36WaAU2zyghV2SPqd40zMrrMnESZuwgCdc0LCU2M7LhzjEL0 zpxXmGKvV++tdLIfwFBAtXc0xfsyLTtclus6NyBODJP0BOJaIEMpJiKJn 3OrJlL4t50VmKrT+Z0rrJMLaF2P8iR4BhssulpYRRSbbDqUyI05rmyeOC h7XioOvtFsLCmrbF0whvjtjXbuoszcvPFn7MGlmi6AMUq1YWpP8LAfCJN 2f6UaKbsplJDK+Lb5zefH7FQ3fGtsO5VzH1kdk7bBxQkokZ4IKL7hotjV A==; X-IronPort-AV: E=McAfee;i="6600,9927,10977"; a="18699166" X-IronPort-AV: E=Sophos;i="6.05,253,1701158400"; d="scan'208";a="18699166" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 02:23:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,253,1701158400"; d="scan'208";a="1913818" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmviesa006.fm.intel.com with ESMTP; 08 Feb 2024 02:23:36 -0800 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, =?utf-8?q?=C5=81u?= =?utf-8?q?kasz_Majczak?= , =?utf-8?q?Amadeusz_S=C5=82awi?= =?utf-8?q?=C5=84ski?= Subject: [PATCH v2 3/3] ASoC: Intel: avs: Send initial config to module if present Date: Thu, 8 Feb 2024 11:24:00 +0100 Message-Id: <20240208102400.2497791-4-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240208102400.2497791-1-amadeuszx.slawinski@linux.intel.com> References: <20240208102400.2497791-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: Y7TPTSSZYXSP5PYETERX5HQS232OKGTL X-Message-ID-Hash: Y7TPTSSZYXSP5PYETERX5HQS232OKGTL X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: If there are initial configs to send to module on init do send them. Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/path.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c index 3aa16ee8d34c1..e785fc2a7008f 100644 --- a/sound/soc/intel/avs/path.c +++ b/sound/soc/intel/avs/path.c @@ -547,6 +547,33 @@ static int avs_path_module_type_create(struct avs_dev *adev, struct avs_path_mod return avs_modext_create(adev, mod); } +static int avs_path_module_send_init_configs(struct avs_dev *adev, struct avs_path_module *mod) +{ + struct avs_soc_component *acomp; + + acomp = to_avs_soc_component(mod->template->owner->owner->owner->owner->comp); + + u32 num_ids = mod->template->num_config_ids; + u32 *ids = mod->template->config_ids; + + for (int i = 0; i < num_ids; i++) { + struct avs_tplg_init_config *config = &acomp->tplg->init_configs[ids[i]]; + size_t len = config->length; + void *data = config->data; + u32 param = config->param; + int ret; + + ret = avs_ipc_set_large_config(adev, mod->module_id, mod->instance_id, + param, data, len); + if (ret) { + dev_err(adev->dev, "send initial module config failed: %d\n", ret); + return AVS_IPC_RET(ret); + } + } + + return 0; +} + static void avs_path_module_free(struct avs_dev *adev, struct avs_path_module *mod) { kfree(mod); @@ -580,6 +607,12 @@ avs_path_module_create(struct avs_dev *adev, return ERR_PTR(ret); } + ret = avs_path_module_send_init_configs(adev, mod); + if (ret) { + kfree(mod); + return ERR_PTR(ret); + } + return mod; }