From patchwork Tue Jul 26 12:36:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 9248499 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 B6131607F2 for ; Tue, 26 Jul 2016 17:35:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A89B8212D9 for ; Tue, 26 Jul 2016 17:35:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D52926B41; Tue, 26 Jul 2016 17:35:03 +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 C5AE8212D9 for ; Tue, 26 Jul 2016 17:35:02 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id BE839266668; Tue, 26 Jul 2016 19:35:01 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 30F902682B1; Tue, 26 Jul 2016 15:48:04 +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 D57342682B0; Tue, 26 Jul 2016 15:48:02 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by alsa0.perex.cz (Postfix) with ESMTP id 51D45266992 for ; Tue, 26 Jul 2016 14:29:45 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 26 Jul 2016 05:29:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.28,424,1464678000"; d="scan'208"; a="1024132574" Received: from vkoul-udesk7.iind.intel.com ([10.223.84.143]) by orsmga002.jf.intel.com with ESMTP; 26 Jul 2016 05:29:31 -0700 From: Vinod Koul To: alsa-devel@alsa-project.org Date: Tue, 26 Jul 2016 18:06:40 +0530 Message-Id: <1469536610-27606-3-git-send-email-vinod.koul@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469536610-27606-1-git-send-email-vinod.koul@intel.com> References: <1469536610-27606-1-git-send-email-vinod.koul@intel.com> Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com, broonie@kernel.org, Vinod Koul , Senthilnathan Veppur Subject: [alsa-devel] [PATCH 02/12] ASoC: Intel: Skylake: Move modules query to runtime 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 Since we are moving DSP init to later, at the topology load the module info is not available. So set the module id to -1 at init and query at first module initialization. Signed-off-by: Senthilnathan Veppur Signed-off-by: Vinod Koul --- sound/soc/intel/skylake/skl-topology.c | 32 +++++++++++++++++++++++++++----- sound/soc/intel/skylake/skl-topology.h | 2 +- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index cc0150fc2601..904103056d62 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -473,6 +473,28 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe) w = w_module->w; mconfig = w->priv; + /* check if module ids are populated */ + if (mconfig->id.module_id < 0) { + struct skl_dfw_module *dfw_config; + + dfw_config = kzalloc(sizeof(dfw_config), GFP_KERNEL); + if (!dfw_config) + return -ENOMEM; + + ret = snd_skl_get_module_info(skl->skl_sst, + mconfig->guid, dfw_config); + if (ret < 0) { + dev_err(skl->skl_sst->dev, + "query module info failed: %d\n", ret); + kfree(dfw_config); + return ret; + } + mconfig->id.module_id = dfw_config->module_id; + mconfig->is_loadable = dfw_config->is_loadable; + + kfree(dfw_config); + } + /* check resource available */ if (!skl_is_pipe_mcps_avail(skl, mconfig)) return -ENOMEM; @@ -1621,11 +1643,11 @@ static int skl_tplg_widget_load(struct snd_soc_component *cmpnt, w->priv = mconfig; memcpy(&mconfig->guid, &dfw_config->uuid, 16); - ret = snd_skl_get_module_info(skl->skl_sst, mconfig->guid, dfw_config); - if (ret < 0) - return ret; - - mconfig->id.module_id = dfw_config->module_id; + /* + * module binary can be loaded later, so set it to query when + * module is load for a use case + */ + mconfig->id.module_id = -1; mconfig->id.instance_id = dfw_config->instance_id; mconfig->mcps = dfw_config->max_mcps; mconfig->ibs = dfw_config->ibs; diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h index 22d3ef83817d..96fa86d0f93a 100644 --- a/sound/soc/intel/skylake/skl-topology.h +++ b/sound/soc/intel/skylake/skl-topology.h @@ -216,7 +216,7 @@ struct skl_module_fmt { struct skl_module_cfg; struct skl_module_inst_id { - u32 module_id; + int module_id; u32 instance_id; };