From patchwork Wed Nov 7 13:23:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 10672359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 37A53109C for ; Wed, 7 Nov 2018 13:22:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2422E2BC1B for ; Wed, 7 Nov 2018 13:22:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21F532BC65; Wed, 7 Nov 2018 13:22:08 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 F33312BC76 for ; Wed, 7 Nov 2018 13:22:06 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B7095267AB4; Wed, 7 Nov 2018 14:22:04 +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 0E116267839; Wed, 7 Nov 2018 14:22:02 +0100 (CET) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by alsa0.perex.cz (Postfix) with ESMTP id 11D33267AA5 for ; Wed, 7 Nov 2018 14:21:57 +0100 (CET) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id wA7DLvCk049393; Wed, 7 Nov 2018 07:21:57 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1541596917; bh=HAV++L2LolVu0vyKZeYi0AH20vaLdvHbaNVudgExX1k=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=cr6VMqcoMBTgsYzUlJJYsdiE+zDrfQIK/GA+Cq1xJ0J/k9/J8PfqWf6ib09iTaxgN 8vkfyHfarMLjZDzELT4WIFySokVJLNkFpe8PKNlb8w0ztoXKbIRrwZxTmjvhQ+55fL xREbriIlp6vwInLKzDFKWtX7WxKhkB72UsuRHfHU= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wA7DLvaY006245 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 7 Nov 2018 07:21:57 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Wed, 7 Nov 2018 07:21:56 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Wed, 7 Nov 2018 07:21:56 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id wA7DLq9E019374; Wed, 7 Nov 2018 07:21:55 -0600 From: Peter Ujfalusi To: Mark Brown , Liam Girdwood , Date: Wed, 7 Nov 2018 15:23:04 +0200 Message-ID: <20181107132310.29597-2-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181107132310.29597-1-peter.ujfalusi@ti.com> References: <20181107132310.29597-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: alsa-devel@alsa-project.org, linux-omap@vger.kernel.org Subject: [alsa-devel] [PATCH v2 1/7] ASoC: omap-mcbsp: Clean up dma_data addr initialization code 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The dma_data.maxburst is configured runtime so no need to initialize it. Make the omap_mcbsp_dma_reg_params() a bit more intuitive to read for the first glance by using SNDRV_PCM_STREAM_PLAYBACK/CAPTURE and to group the outermost if case by stream direction. While there, fix the outdated comment for the function. Signed-off-by: Peter Ujfalusi --- sound/soc/omap/mcbsp.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c index 79d4dc785e5c..8c3cedfcb878 100644 --- a/sound/soc/omap/mcbsp.c +++ b/sound/soc/omap/mcbsp.c @@ -227,28 +227,27 @@ void omap_mcbsp_config(struct omap_mcbsp *mcbsp, /** * omap_mcbsp_dma_reg_params - returns the address of mcbsp data register - * @id - mcbsp id - * @stream - indicates the direction of data flow (rx or tx) + * @mcbsp: omap_mcbsp struct for the McBSP instance + * @stream: Stream direction (playback/capture) * * Returns the address of mcbsp data transmit register or data receive register - * to be used by DMA for transferring/receiving data based on the value of - * @stream for the requested mcbsp given by @id + * to be used by DMA for transferring/receiving data */ static int omap_mcbsp_dma_reg_params(struct omap_mcbsp *mcbsp, unsigned int stream) { int data_reg; - if (mcbsp->pdata->reg_size == 2) { - if (stream) - data_reg = OMAP_MCBSP_REG_DRR1; - else + if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (mcbsp->pdata->reg_size == 2) data_reg = OMAP_MCBSP_REG_DXR1; - } else { - if (stream) - data_reg = OMAP_MCBSP_REG_DRR; else data_reg = OMAP_MCBSP_REG_DXR; + } else { + if (mcbsp->pdata->reg_size == 2) + data_reg = OMAP_MCBSP_REG_DRR1; + else + data_reg = OMAP_MCBSP_REG_DRR; } return mcbsp->phys_dma_base + data_reg * mcbsp->pdata->reg_step; @@ -1034,11 +1033,10 @@ int omap_mcbsp_init(struct platform_device *pdev) mcbsp->dma_data[1].filter_data = "rx"; } - mcbsp->dma_data[0].addr = omap_mcbsp_dma_reg_params(mcbsp, 0); - mcbsp->dma_data[0].maxburst = 4; - - mcbsp->dma_data[1].addr = omap_mcbsp_dma_reg_params(mcbsp, 1); - mcbsp->dma_data[1].maxburst = 4; + mcbsp->dma_data[0].addr = omap_mcbsp_dma_reg_params(mcbsp, + SNDRV_PCM_STREAM_PLAYBACK); + mcbsp->dma_data[1].addr = omap_mcbsp_dma_reg_params(mcbsp, + SNDRV_PCM_STREAM_CAPTURE); mcbsp->fclk = clk_get(&pdev->dev, "fck"); if (IS_ERR(mcbsp->fclk)) {