From patchwork Tue Apr 25 06:48:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Subhransu S. Prusty" X-Patchwork-Id: 9697605 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 ABA6F60249 for ; Tue, 25 Apr 2017 07:02:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F11B2845E for ; Tue, 25 Apr 2017 07:02:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92BFD2858D; Tue, 25 Apr 2017 07:02:38 +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 D59B02845E for ; Tue, 25 Apr 2017 07:02:37 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E6965266F07; Tue, 25 Apr 2017 09:01:45 +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 83A93266F04; Tue, 25 Apr 2017 09:01:44 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by alsa0.perex.cz (Postfix) with ESMTP id C5C5A266EF1 for ; Tue, 25 Apr 2017 09:01:39 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Apr 2017 00:01:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,248,1488873600"; d="scan'208";a="960747146" Received: from subhransu-desktop.iind.intel.com ([10.223.96.135]) by orsmga003.jf.intel.com with ESMTP; 25 Apr 2017 00:01:36 -0700 From: "Subhransu S. Prusty" To: alsa-devel@alsa-project.org Date: Tue, 25 Apr 2017 12:18:21 +0530 Message-Id: <1493102904-12624-4-git-send-email-subhransu.s.prusty@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1493102904-12624-1-git-send-email-subhransu.s.prusty@intel.com> References: <1493102904-12624-1-git-send-email-subhransu.s.prusty@intel.com> Cc: tiwai@suse.de, lgirdwood@gmail.com, G Kranthi , patches.audio@intel.com, broonie@kernel.org, "Subhransu S. Prusty" Subject: [alsa-devel] [PATCH v2 3/6] ASoC: Intel: Skylake: Modify arguments to reuse module transfer function 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: G Kranthi Kabylake also uses code loader dma for module load and library load. skl_transfer_module can be reused. Modify the arguments to include library index to be passed to lib load ipc and module/lib check to use correct ipc for lib/module load. Signed-off-by: G Kranthi Signed-off-by: Subhransu S. Prusty --- sound/soc/intel/skylake/skl-sst.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c index 4fdd503a837c..b4c3b5c63115 100644 --- a/sound/soc/intel/skylake/skl-sst.c +++ b/sound/soc/intel/skylake/skl-sst.c @@ -325,7 +325,7 @@ static struct skl_module_table *skl_module_get_from_id( } static int skl_transfer_module(struct sst_dsp *ctx, const void *data, - u32 size, u16 mod_id) + u32 size, u16 mod_id, u8 table_id, bool is_module) { int ret, bytes_left, curr_pos; struct skl_sst *skl = ctx->thread_context; @@ -335,10 +335,12 @@ static int skl_transfer_module(struct sst_dsp *ctx, const void *data, if (bytes_left < 0) return bytes_left; - ret = skl_ipc_load_modules(&skl->ipc, SKL_NUM_MODULES, &mod_id); - if (ret < 0) { - dev_err(ctx->dev, "Failed to Load module: %d\n", ret); - goto out; + if (is_module) { /* load module */ + ret = skl_ipc_load_modules(&skl->ipc, SKL_NUM_MODULES, &mod_id); + if (ret < 0) { + dev_err(ctx->dev, "Failed to Load module: %d\n", ret); + goto out; + } } /* @@ -393,7 +395,8 @@ static int skl_load_module(struct sst_dsp *ctx, u16 mod_id, u8 *guid) if (!module_entry->usage_cnt) { ret = skl_transfer_module(ctx, module_entry->mod_info->fw->data, - module_entry->mod_info->fw->size, mod_id); + module_entry->mod_info->fw->size, + mod_id, 0, true); if (ret < 0) { dev_err(ctx->dev, "Failed to Load module\n"); return ret;