From patchwork Fri Oct 28 15:32:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 9402235 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 0F70D60588 for ; Fri, 28 Oct 2016 16:09:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 018E52A8A1 for ; Fri, 28 Oct 2016 16:09:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA5892A8A3; Fri, 28 Oct 2016 16:09:31 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=no 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 F1A772A8A1 for ; Fri, 28 Oct 2016 16:09:30 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 41246267684; Fri, 28 Oct 2016 18:09:29 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1192B266B24; Fri, 28 Oct 2016 18:07:11 +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 A2BEA26767B; Fri, 28 Oct 2016 17:32:34 +0200 (CEST) Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by alsa0.perex.cz (Postfix) with ESMTP id 7433A26767B for ; Fri, 28 Oct 2016 17:32:25 +0200 (CEST) Received: by mail-wm0-f50.google.com with SMTP id p190so18657681wmp.1 for ; Fri, 28 Oct 2016 08:32:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A9+gxdtkSOri0YiOYRtsYm2ogppw/sHvozKOvm/XCUE=; b=ekL3kOIQoA2igawka0CzpyTO49JHlt3LGTo9DMzAf788fbFg1Sn1S2qNvxdVUf12Qe eQQIGOHMf5jRHOagYqHdyYiyW7M64CRYTCPLZLUrv0qj8fCNoMsyh+ErCZ1zjLcy7uNe WrrC+uNez/p2dzFf3OV2vECn7bqPIiq8JLbaM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=A9+gxdtkSOri0YiOYRtsYm2ogppw/sHvozKOvm/XCUE=; b=fe7tIDmwiZoZnnX0Cd72Tgj/SvphiTLfrqE12O95ht5jGG1L4BhQUrUhLb6WxRXusp eXcakbw9bcLceVRhqC0O9xVl5dL5sBePz4Sbs0bE/nmKHrykisLC08xQQfxSvWd8u1W1 rH33Qww2U5fYIeDi7i9bsJobouap5PAB+TSdc+mtR3kq+Tgw2yynL+vnYKjxUbmHsOgG qXN9QF+mUekqyY3adRqQiTA+yMtyQjhe41Rticnt7C/BKP6srWik38t2+YKXwFUbehHY hyBXH3taavw1AEjn36eHV6N8Ipybxo5YD52A5GNIpD12xXPBAo6TiA46Z83WDycpBBQW PSSg== X-Gm-Message-State: ABUngvcZb04eHe6/omHq1wDHx9Um2sOEpEx6H4egDGO0KEKRgBXutw/hD67xv9lzLqZtSde/ X-Received: by 10.28.12.77 with SMTP id 74mr4526831wmm.115.1477668745369; Fri, 28 Oct 2016 08:32:25 -0700 (PDT) Received: from localhost.localdomain (host-2-98-102-117.as13285.net. [2.98.102.117]) by smtp.gmail.com with ESMTPSA id za1sm14708033wjb.8.2016.10.28.08.32.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Oct 2016 08:32:24 -0700 (PDT) From: Srinivas Kandagatla To: Mark Brown , alsa-devel@alsa-project.org Date: Fri, 28 Oct 2016 16:32:18 +0100 Message-Id: <1477668740-30389-2-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477668740-30389-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1477668740-30389-1-git-send-email-srinivas.kandagatla@linaro.org> Cc: Kenneth Westfield , Banajit Goswami , Kuninori Morimoto , Liam Girdwood , linux-kernel@vger.kernel.org, Takashi Iwai , Srinivas Kandagatla Subject: [alsa-devel] [PATCH 1/3] ASoC: lpass-platform: use dma_ch instead of rdma_ch/wrdma_ch 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 This patch cleans up usage of wrdma_ch and rdma_ch variables into a common variable dma_ch, As there is no real use of tracking the dma channel in two different variables based on stream direction. Signed-off-by: Srinivas Kandagatla Acked-by: Kenneth Westfield --- sound/soc/qcom/lpass-platform.c | 53 +++++++++++++---------------------------- 1 file changed, 17 insertions(+), 36 deletions(-) diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c index e2ff538..2570c96 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c @@ -25,8 +25,7 @@ #include "lpass.h" struct lpass_pcm_data { - int rdma_ch; - int wrdma_ch; + int dma_ch; int i2s_port; }; @@ -95,10 +94,7 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream, int bitwidth; int ret, dma_port = pcm_data->i2s_port + v->dmactl_audif_start; - if (dir == SNDRV_PCM_STREAM_PLAYBACK) - ch = pcm_data->rdma_ch; - else - ch = pcm_data->wrdma_ch; + ch = pcm_data->dma_ch; bitwidth = snd_pcm_format_width(format); if (bitwidth < 0) { @@ -184,11 +180,7 @@ static int lpass_platform_pcmops_hw_free(struct snd_pcm_substream *substream) unsigned int reg; int ret; - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - reg = LPAIF_RDMACTL_REG(v, pcm_data->rdma_ch); - else - reg = LPAIF_WRDMACTL_REG(v, pcm_data->wrdma_ch); - + reg = LPAIF_DMACTL_REG(v, pcm_data->dma_ch, substream->stream); ret = regmap_write(drvdata->lpaif_map, reg, 0); if (ret) dev_err(soc_runtime->dev, "%s() error writing to rdmactl reg: %d\n", @@ -207,10 +199,7 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream) struct lpass_variant *v = drvdata->variant; int ret, ch, dir = substream->stream; - if (dir == SNDRV_PCM_STREAM_PLAYBACK) - ch = pcm_data->rdma_ch; - else - ch = pcm_data->wrdma_ch; + ch = pcm_data->dma_ch; ret = regmap_write(drvdata->lpaif_map, LPAIF_DMABASE_REG(v, ch, dir), @@ -261,10 +250,7 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream, struct lpass_variant *v = drvdata->variant; int ret, ch, dir = substream->stream; - if (dir == SNDRV_PCM_STREAM_PLAYBACK) - ch = pcm_data->rdma_ch; - else - ch = pcm_data->wrdma_ch; + ch = pcm_data->dma_ch; switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -338,10 +324,7 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer( unsigned int base_addr, curr_addr; int ret, ch, dir = substream->stream; - if (dir == SNDRV_PCM_STREAM_PLAYBACK) - ch = pcm_data->rdma_ch; - else - ch = pcm_data->wrdma_ch; + ch = pcm_data->dma_ch; ret = regmap_read(drvdata->lpaif_map, LPAIF_DMABASE_REG(v, ch, dir), &base_addr); @@ -488,13 +471,13 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime) psubstream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; if (psubstream) { if (v->alloc_dma_channel) - data->rdma_ch = v->alloc_dma_channel(drvdata, + data->dma_ch = v->alloc_dma_channel(drvdata, SNDRV_PCM_STREAM_PLAYBACK); - if (data->rdma_ch < 0) - return data->rdma_ch; + if (data->dma_ch < 0) + return data->dma_ch; - drvdata->substream[data->rdma_ch] = psubstream; + drvdata->substream[data->dma_ch] = psubstream; ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, soc_runtime->platform->dev, @@ -503,7 +486,7 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime) goto playback_alloc_err; ret = regmap_write(drvdata->lpaif_map, - LPAIF_RDMACTL_REG(v, data->rdma_ch), 0); + LPAIF_RDMACTL_REG(v, data->dma_ch), 0); if (ret) { dev_err(soc_runtime->dev, "%s() error writing to rdmactl reg: %d\n", @@ -515,15 +498,15 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime) csubstream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; if (csubstream) { if (v->alloc_dma_channel) - data->wrdma_ch = v->alloc_dma_channel(drvdata, + data->dma_ch = v->alloc_dma_channel(drvdata, SNDRV_PCM_STREAM_CAPTURE); - if (data->wrdma_ch < 0) { - ret = data->wrdma_ch; + if (data->dma_ch < 0) { + ret = data->dma_ch; goto capture_alloc_err; } - drvdata->substream[data->wrdma_ch] = csubstream; + drvdata->substream[data->dma_ch] = csubstream; ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, soc_runtime->platform->dev, @@ -532,7 +515,7 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime) goto capture_alloc_err; ret = regmap_write(drvdata->lpaif_map, - LPAIF_WRDMACTL_REG(v, data->wrdma_ch), 0); + LPAIF_WRDMACTL_REG(v, data->dma_ch), 0); if (ret) { dev_err(soc_runtime->dev, "%s() error writing to wrdmactl reg: %d\n", @@ -573,9 +556,7 @@ static void lpass_platform_pcm_free(struct snd_pcm *pcm) drvdata = snd_soc_platform_get_drvdata(rt->platform); data = drvdata->private_data; - ch = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - ? data->rdma_ch - : data->wrdma_ch; + ch = data->dma_ch; v = drvdata->variant; drvdata->substream[ch] = NULL; if (v->free_dma_channel)