From patchwork Fri Feb 5 06:49:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 8232011 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1A7009F37A for ; Fri, 5 Feb 2016 06:50:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 35B062039C for ; Fri, 5 Feb 2016 06:50:29 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 10E0C20384 for ; Fri, 5 Feb 2016 06:50:28 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 20E9126669D; Fri, 5 Feb 2016 07:50:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 83F492665E5; Fri, 5 Feb 2016 07:48:07 +0100 (CET) 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 AC11D2665AC; Fri, 5 Feb 2016 07:48:02 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by alsa0.perex.cz (Postfix) with ESMTP id 71E1C26661E for ; Fri, 5 Feb 2016 07:46:20 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 04 Feb 2016 22:46:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,399,1449561600"; d="scan'208";a="896849732" Received: from vkoul-udesk7.iind.intel.com ([10.223.84.39]) by fmsmga001.fm.intel.com with ESMTP; 04 Feb 2016 22:45:59 -0800 From: Vinod Koul To: alsa-devel@alsa-project.org Date: Fri, 5 Feb 2016 12:19:10 +0530 Message-Id: <1454654950-23091-8-git-send-email-vinod.koul@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454654950-23091-1-git-send-email-vinod.koul@intel.com> References: <1454654950-23091-1-git-send-email-vinod.koul@intel.com> Cc: tiwai@suse.de, patches.audio@intel.com, liam.r.girdwood@linux.intel.com, Vinod Koul , broonie@kernel.org, Jeeja KP Subject: [alsa-devel] [PATCH 7/7] ASoC: Intel: Skylake: Fill BE blob with default params 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: Jeeja KP When we have a path that connects to DSP sink and source, we need to query the blob using the default params. So add a function to query the params for such path Signed-off-by: Jeeja KP Signed-off-by: Vinod Koul --- sound/soc/intel/skylake/skl-topology.c | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index 7803a6f3c014..03a8762d1e3e 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -260,6 +260,64 @@ static void skl_tplg_update_buffer_size(struct skl_sst *ctx, multiplier; } +static int skl_tplg_update_be_blob(struct snd_soc_dapm_widget *w, + struct skl_sst *ctx) +{ + struct skl_module_cfg *m_cfg = w->priv; + int link_type, dir; + u32 ch, s_freq, s_fmt; + struct nhlt_specific_cfg *cfg; + struct skl *skl = get_skl_ctx(ctx->dev); + + /* check if we already have blob */ + if (m_cfg->formats_config.caps_size > 0) + return 0; + + switch (m_cfg->dev_type) { + case SKL_DEVICE_DMIC: + link_type = NHLT_LINK_DMIC; + dir = 1; + s_freq = m_cfg->in_fmt[0].s_freq; + s_fmt = m_cfg->in_fmt[0].bit_depth; + ch = m_cfg->in_fmt[0].channels; + break; + + case SKL_DEVICE_I2S: + link_type = NHLT_LINK_SSP; + if (m_cfg->hw_conn_type == SKL_CONN_SOURCE) { + dir = 1; + s_freq = m_cfg->in_fmt[0].s_freq; + s_fmt = m_cfg->in_fmt[0].bit_depth; + ch = m_cfg->in_fmt[0].channels; + } else { + dir = 0; + s_freq = m_cfg->out_fmt[0].s_freq; + s_fmt = m_cfg->out_fmt[0].bit_depth; + ch = m_cfg->out_fmt[0].channels; + } + break; + + default: + return -EINVAL; + } + + /* update the blob based on virtual bus_id and default params */ + cfg = skl_get_ep_blob(skl, m_cfg->vbus_id, link_type, + s_fmt, ch, s_freq, dir); + if (cfg) { + m_cfg->formats_config.caps_size = cfg->size; + m_cfg->formats_config.caps = (u32 *) &cfg->caps; + } else { + dev_err(ctx->dev, "Blob NULL for id %x type %d dirn %d\n", + m_cfg->vbus_id, link_type, dir); + dev_err(ctx->dev, "PCM: ch %d, freq %d, fmt %d\n", + ch, s_freq, s_fmt); + return -EIO; + } + + return 0; +} + static void skl_tplg_update_module_params(struct snd_soc_dapm_widget *w, struct skl_sst *ctx) { @@ -433,6 +491,9 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe) return ret; } + /* update blob if blob is null for be with default value */ + skl_tplg_update_be_blob(w, ctx); + /* * apply fix/conversion to module params based on * FE/BE params