From patchwork Mon Jun 12 11:40:56 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: 9780805 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 CEA1B60352 for ; Mon, 12 Jun 2017 11:56:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5441285B6 for ; Mon, 12 Jun 2017 11:56:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA6A0285E9; Mon, 12 Jun 2017 11:56:25 +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 C9DCF285B6 for ; Mon, 12 Jun 2017 11:56:24 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7A599266E3C; Mon, 12 Jun 2017 13:55:51 +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 DB65D266E25; Mon, 12 Jun 2017 13:55:48 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by alsa0.perex.cz (Postfix) with ESMTP id 664CA2669FF for ; Mon, 12 Jun 2017 13:55:46 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2017 04:55:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,333,1493708400"; d="scan'208";a="97073042" Received: from subhransu-desktop.iind.intel.com ([10.223.96.135]) by orsmga004.jf.intel.com with ESMTP; 12 Jun 2017 04:55:43 -0700 From: "Subhransu S. Prusty" To: alsa-devel@alsa-project.org Date: Mon, 12 Jun 2017 17:10:56 +0530 Message-Id: <1497267657-20359-3-git-send-email-subhransu.s.prusty@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1497267657-20359-1-git-send-email-subhransu.s.prusty@intel.com> References: <1497267657-20359-1-git-send-email-subhransu.s.prusty@intel.com> Cc: tiwai@suse.de, lgirdwood@gmail.com, Ramesh Babu , patches.audio@intel.com, broonie@kernel.org, "Subhransu S. Prusty" Subject: [alsa-devel] [PATCH 2/3] ASoC: Intel: Skylake: Fix dma buffer size calculation 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: Ramesh Babu DMA buffer size for gateway copier will be calculated based on: For host DMA copier: Input buffer size (ibs) for output direction (playback) Output buffer size (obs) for input direction (capture) For link DMA copier: IBS for input direction (capture) OBS for output direction (playback) Update the driver to use the above. Signed-off-by: Ramesh Babu Signed-off-by: Subhransu S. Prusty --- sound/soc/intel/skylake/skl-messages.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c index ab1adc0c9cc3..7063b451b109 100644 --- a/sound/soc/intel/skylake/skl-messages.c +++ b/sound/soc/intel/skylake/skl-messages.c @@ -507,6 +507,8 @@ static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx, struct skl_module_cfg *mconfig, struct skl_cpr_cfg *cpr_mconfig) { + u32 dma_io_buf; + cpr_mconfig->gtw_cfg.node_id = skl_get_node_id(ctx, mconfig); if (cpr_mconfig->gtw_cfg.node_id == SKL_NON_GATEWAY_CPR_NODE_ID) { @@ -514,10 +516,29 @@ static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx, return; } - if (SKL_CONN_SOURCE == mconfig->hw_conn_type) - cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * mconfig->obs; - else - cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * mconfig->ibs; + switch (mconfig->hw_conn_type) { + case SKL_CONN_SOURCE: + if (mconfig->dev_type == SKL_DEVICE_HDAHOST) + dma_io_buf = mconfig->ibs; + else + dma_io_buf = mconfig->obs; + break; + + case SKL_CONN_SINK: + if (mconfig->dev_type == SKL_DEVICE_HDAHOST) + dma_io_buf = mconfig->obs; + else + dma_io_buf = mconfig->ibs; + break; + + default: + dev_warn(ctx->dev, "wrong connection type: %d\n", + mconfig->hw_conn_type); + return; + } + + cpr_mconfig->gtw_cfg.dma_buffer_size = + mconfig->dma_buffer_size * dma_io_buf; cpr_mconfig->cpr_feature_mask = 0; cpr_mconfig->gtw_cfg.config_length = 0;