From patchwork Thu Sep 22 08:30:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 9344809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 02CD760757 for ; Thu, 22 Sep 2016 09:05:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7C342A8F0 for ; Thu, 22 Sep 2016 09:04:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC3E12A8F3; Thu, 22 Sep 2016 09:04:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D977C2A8F0 for ; Thu, 22 Sep 2016 09:04:53 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7C228267092; Thu, 22 Sep 2016 11:04:52 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1E8D12665A3; Thu, 22 Sep 2016 11:02:27 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7003C26705D; Thu, 22 Sep 2016 10:22:27 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by alsa0.perex.cz (Postfix) with ESMTP id 6D14E267056 for ; Thu, 22 Sep 2016 10:22:20 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP; 22 Sep 2016 01:22:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,378,1470726000"; d="scan'208";a="11958427" Received: from vkoul-udesk7.iind.intel.com ([10.223.84.143]) by fmsmga006.fm.intel.com with ESMTP; 22 Sep 2016 01:22:17 -0700 From: Vinod Koul To: alsa-devel@alsa-project.org Date: Thu, 22 Sep 2016 14:00:38 +0530 Message-Id: <1474533040-14222-3-git-send-email-vinod.koul@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474533040-14222-1-git-send-email-vinod.koul@intel.com> References: <1474533040-14222-1-git-send-email-vinod.koul@intel.com> Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com, Dharageswari R , broonie@kernel.org, Vinod Koul Subject: [alsa-devel] [PATCH v2 2/4] ASoC: Intel: Skylake: Use private instance id of modules in IPC X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dharageswari R Use private id's of module instances that are generated during init_module for the IPC messages to DSP. These id's are freed up during delete pipeline. Signed-off-by: Dharageswari R Signed-off-by: Vinod Koul --- sound/soc/intel/skylake/skl-messages.c | 22 ++++++++++++---------- sound/soc/intel/skylake/skl-sst-utils.c | 2 +- sound/soc/intel/skylake/skl-topology.c | 10 +++++++--- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c index 8eb5ba2dae3a..ac0c58e170c3 100644 --- a/sound/soc/intel/skylake/skl-messages.c +++ b/sound/soc/intel/skylake/skl-messages.c @@ -787,6 +787,7 @@ static int skl_alloc_queue(struct skl_module_pin *mpin, mpin[i].in_use = true; mpin[i].id.module_id = id.module_id; mpin[i].id.instance_id = id.instance_id; + mpin[i].id.pvt_id = id.pvt_id; mpin[i].tgt_mcfg = tgt_cfg; return i; } @@ -810,6 +811,7 @@ static void skl_free_queue(struct skl_module_pin *mpin, int q_index) mpin[q_index].in_use = false; mpin[q_index].id.module_id = 0; mpin[q_index].id.instance_id = 0; + mpin[q_index].id.pvt_id = 0; } mpin[q_index].pin_state = SKL_PIN_UNBIND; mpin[q_index].tgt_mcfg = NULL; @@ -850,7 +852,7 @@ int skl_init_module(struct skl_sst *ctx, struct skl_ipc_init_instance_msg msg; dev_dbg(ctx->dev, "%s: module_id = %d instance=%d\n", __func__, - mconfig->id.module_id, mconfig->id.instance_id); + mconfig->id.module_id, mconfig->id.pvt_id); if (mconfig->pipe->state != SKL_PIPE_CREATED) { dev_err(ctx->dev, "Pipe not created state= %d pipe_id= %d\n", @@ -866,7 +868,7 @@ int skl_init_module(struct skl_sst *ctx, } msg.module_id = mconfig->id.module_id; - msg.instance_id = mconfig->id.instance_id; + msg.instance_id = mconfig->id.pvt_id; msg.ppl_instance_id = mconfig->pipe->ppl_id; msg.param_data_size = module_config_size; msg.core_id = mconfig->core_id; @@ -887,9 +889,9 @@ static void skl_dump_bind_info(struct skl_sst *ctx, struct skl_module_cfg *src_module, struct skl_module_cfg *dst_module) { dev_dbg(ctx->dev, "%s: src module_id = %d src_instance=%d\n", - __func__, src_module->id.module_id, src_module->id.instance_id); + __func__, src_module->id.module_id, src_module->id.pvt_id); dev_dbg(ctx->dev, "%s: dst_module=%d dst_instacne=%d\n", __func__, - dst_module->id.module_id, dst_module->id.instance_id); + dst_module->id.module_id, dst_module->id.pvt_id); dev_dbg(ctx->dev, "src_module state = %d dst module state = %d\n", src_module->m_state, dst_module->m_state); @@ -936,9 +938,9 @@ int skl_unbind_modules(struct skl_sst *ctx, return 0; msg.module_id = src_mcfg->id.module_id; - msg.instance_id = src_mcfg->id.instance_id; + msg.instance_id = src_mcfg->id.pvt_id; msg.dst_module_id = dst_mcfg->id.module_id; - msg.dst_instance_id = dst_mcfg->id.instance_id; + msg.dst_instance_id = dst_mcfg->id.pvt_id; msg.bind = false; ret = skl_ipc_bind_unbind(&ctx->ipc, &msg); @@ -997,9 +999,9 @@ int skl_bind_modules(struct skl_sst *ctx, msg.src_queue, msg.dst_queue); msg.module_id = src_mcfg->id.module_id; - msg.instance_id = src_mcfg->id.instance_id; + msg.instance_id = src_mcfg->id.pvt_id; msg.dst_module_id = dst_mcfg->id.module_id; - msg.dst_instance_id = dst_mcfg->id.instance_id; + msg.dst_instance_id = dst_mcfg->id.pvt_id; msg.bind = true; ret = skl_ipc_bind_unbind(&ctx->ipc, &msg); @@ -1177,7 +1179,7 @@ int skl_set_module_params(struct skl_sst *ctx, u32 *params, int size, struct skl_ipc_large_config_msg msg; msg.module_id = mcfg->id.module_id; - msg.instance_id = mcfg->id.instance_id; + msg.instance_id = mcfg->id.pvt_id; msg.param_data_size = size; msg.large_param_id = param_id; @@ -1190,7 +1192,7 @@ int skl_get_module_params(struct skl_sst *ctx, u32 *params, int size, struct skl_ipc_large_config_msg msg; msg.module_id = mcfg->id.module_id; - msg.instance_id = mcfg->id.instance_id; + msg.instance_id = mcfg->id.pvt_id; msg.param_data_size = size; msg.large_param_id = param_id; diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c index a8dab80e763e..78f1043dfb65 100644 --- a/sound/soc/intel/skylake/skl-sst-utils.c +++ b/sound/soc/intel/skylake/skl-sst-utils.c @@ -141,7 +141,7 @@ int snd_skl_get_module_info(struct skl_sst *ctx, EXPORT_SYMBOL_GPL(snd_skl_get_module_info); static inline int skl_getid_32(struct uuid_module *module, u64 *val, - int word1_mask, int word2_mask) + int word1_mask, int word2_mask) { int index, max_inst, pvt_id; u32 mask_val; diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index 2d475b720963..b6fc374f38b5 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -505,12 +505,15 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe) * FE/BE params */ skl_tplg_update_module_params(w, ctx); - + mconfig->id.pvt_id = skl_get_pvt_id(ctx, mconfig); + if (mconfig->id.pvt_id < 0) + return ret; skl_tplg_set_module_init_data(w); ret = skl_init_module(ctx, mconfig); - if (ret < 0) + if (ret < 0) { + skl_put_pvt_id(ctx, mconfig); return ret; - + } skl_tplg_alloc_pipe_mcps(skl, mconfig); ret = skl_tplg_set_module_params(w, ctx); if (ret < 0) @@ -537,6 +540,7 @@ static int skl_tplg_unload_pipe_modules(struct skl_sst *ctx, if (ret < 0) return -EIO; } + skl_put_pvt_id(ctx, mconfig); } /* no modules to unload in this path, so return */