From patchwork Mon Oct 31 11:25:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 80160 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp62032qge; Mon, 31 Oct 2016 04:26:24 -0700 (PDT) X-Received: by 10.99.110.14 with SMTP id j14mr40320498pgc.135.1477913184197; Mon, 31 Oct 2016 04:26:24 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si3357871pfj.200.2016.10.31.04.26.23; Mon, 31 Oct 2016 04:26:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941014AbcJaL0G (ORCPT + 27 others); Mon, 31 Oct 2016 07:26:06 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:37188 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S940867AbcJaLZ6 (ORCPT ); Mon, 31 Oct 2016 07:25:58 -0400 Received: by mail-wm0-f53.google.com with SMTP id t79so43577117wmt.0 for ; Mon, 31 Oct 2016 04:25:58 -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=m7Fj5QqNN8GJD2fYbwVLWp8115iwlPcSBy8XJHgHwrc=; b=FojwiIpZ11HKWROMZlp73uoDbNW7ysQOzh+Yy+EmViJt0wywQKdj7svXmU9hMQUj/r 3DzSStNBERgXZijC+ce9QTs5DomKU8JPCnBiBLuJ5UQWZumSx70M/5U+PlkkxQoghmiE 8cQ71u/80wEQPNH4ywm95BqLitxvFMWeD9FnI= 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=m7Fj5QqNN8GJD2fYbwVLWp8115iwlPcSBy8XJHgHwrc=; b=L/9s5kFbSdfS/3ty789kQlQlHy/emlv5i+A9ALoLlpEej/nTMPGM+rMJBWBrbD/3Gs dhJ8vNTgVpmYeoTSC8YgVi3NvY215GLg4ndvDiQGusnhlNdd12CIjIE3hvnQrvEotSSg ZSi98iW4Z8tO6/PDQji4y9xdterZkSqZxF2YoWtiz5Uk9rbEfA/SJPWzWzVDNorfIM/C CISQs6LxpQxKOa9+w693nc60c1MhFO6J456xF3dEQ40qwC8imH+IzyORhXEy2qG6hrMA lVsItZesQ47zEIaGBzkdp9btxQk9yKm9q7/F90wMZ2LyMfpkQCYk3BsvogsHQwPg7N7L MnWw== X-Gm-Message-State: ABUngvcZ9crOXDGIKvypYUVuZ9JYW579NWauSmHofSvI+W3QaSIwkhSxBFCOI7jOGAY4k4ny X-Received: by 10.28.153.76 with SMTP id b73mr10816118wme.60.1477913157226; Mon, 31 Oct 2016 04:25:57 -0700 (PDT) Received: from localhost.localdomain (host-2-98-102-117.as13285.net. [2.98.102.117]) by smtp.gmail.com with ESMTPSA id ma5sm29404414wjb.47.2016.10.31.04.25.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 31 Oct 2016 04:25:56 -0700 (PDT) From: Srinivas Kandagatla To: Mark Brown , alsa-devel@alsa-project.org Cc: Banajit Goswami , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linux-kernel@vger.kernel.org, Kenneth Westfield , Kuninori Morimoto , Srinivas Kandagatla Subject: [PATCH v2 2/3] ASoC: lpass-platform: use dma_ch instead of rdma_ch/wrdma_ch Date: Mon, 31 Oct 2016 11:25:44 +0000 Message-Id: <1477913145-8259-3-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477913145-8259-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1477913145-8259-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 46 ++++++++--------------------------------- 1 file changed, 9 insertions(+), 37 deletions(-) -- 2.10.1 diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c index 07000f5..ca5e19f 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; }; @@ -91,10 +90,7 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) return ret; } - if (dir == SNDRV_PCM_STREAM_PLAYBACK) - data->rdma_ch = dma_ch; - else - data->wrdma_ch = dma_ch; + data->dma_ch = dma_ch; snd_soc_set_runtime_hwparams(substream, &lpass_platform_pcm_hardware); @@ -121,20 +117,12 @@ static int lpass_platform_pcmops_close(struct snd_pcm_substream *substream) snd_soc_platform_get_drvdata(soc_runtime->platform); struct lpass_variant *v = drvdata->variant; struct lpass_pcm_data *data; - int dma_ch, dir = substream->stream; data = runtime->private_data; v = drvdata->variant; - - if (dir == SNDRV_PCM_STREAM_PLAYBACK) - dma_ch = data->rdma_ch; - else - dma_ch = data->wrdma_ch; - - drvdata->substream[dma_ch] = NULL; - + drvdata->substream[data->dma_ch] = NULL; if (v->free_dma_channel) - v->free_dma_channel(drvdata, dma_ch); + v->free_dma_channel(drvdata, data->dma_ch); return 0; } @@ -155,10 +143,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) { @@ -245,11 +230,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", @@ -269,10 +250,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), @@ -324,10 +302,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: @@ -402,10 +377,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);