Commit 4314f928 authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Mark Brown

ASoC: lpass-platform: use dma_ch instead of rdma_ch/wrdma_ch

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: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: default avatarKenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent e9a16e4a
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
#include "lpass.h" #include "lpass.h"
struct lpass_pcm_data { struct lpass_pcm_data {
int rdma_ch; int dma_ch;
int wrdma_ch;
int i2s_port; int i2s_port;
}; };
...@@ -91,10 +90,7 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) ...@@ -91,10 +90,7 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream)
return ret; return ret;
} }
if (dir == SNDRV_PCM_STREAM_PLAYBACK) data->dma_ch = dma_ch;
data->rdma_ch = dma_ch;
else
data->wrdma_ch = dma_ch;
snd_soc_set_runtime_hwparams(substream, &lpass_platform_pcm_hardware); 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) ...@@ -121,20 +117,12 @@ static int lpass_platform_pcmops_close(struct snd_pcm_substream *substream)
snd_soc_platform_get_drvdata(soc_runtime->platform); snd_soc_platform_get_drvdata(soc_runtime->platform);
struct lpass_variant *v = drvdata->variant; struct lpass_variant *v = drvdata->variant;
struct lpass_pcm_data *data; struct lpass_pcm_data *data;
int dma_ch, dir = substream->stream;
data = runtime->private_data; data = runtime->private_data;
v = drvdata->variant; v = drvdata->variant;
drvdata->substream[data->dma_ch] = NULL;
if (dir == SNDRV_PCM_STREAM_PLAYBACK)
dma_ch = data->rdma_ch;
else
dma_ch = data->wrdma_ch;
drvdata->substream[dma_ch] = NULL;
if (v->free_dma_channel) if (v->free_dma_channel)
v->free_dma_channel(drvdata, dma_ch); v->free_dma_channel(drvdata, data->dma_ch);
return 0; return 0;
} }
...@@ -155,10 +143,7 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream, ...@@ -155,10 +143,7 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
int bitwidth; int bitwidth;
int ret, dma_port = pcm_data->i2s_port + v->dmactl_audif_start; int ret, dma_port = pcm_data->i2s_port + v->dmactl_audif_start;
if (dir == SNDRV_PCM_STREAM_PLAYBACK) ch = pcm_data->dma_ch;
ch = pcm_data->rdma_ch;
else
ch = pcm_data->wrdma_ch;
bitwidth = snd_pcm_format_width(format); bitwidth = snd_pcm_format_width(format);
if (bitwidth < 0) { if (bitwidth < 0) {
...@@ -245,11 +230,7 @@ static int lpass_platform_pcmops_hw_free(struct snd_pcm_substream *substream) ...@@ -245,11 +230,7 @@ static int lpass_platform_pcmops_hw_free(struct snd_pcm_substream *substream)
unsigned int reg; unsigned int reg;
int ret; int ret;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) reg = LPAIF_DMACTL_REG(v, pcm_data->dma_ch, substream->stream);
reg = LPAIF_RDMACTL_REG(v, pcm_data->rdma_ch);
else
reg = LPAIF_WRDMACTL_REG(v, pcm_data->wrdma_ch);
ret = regmap_write(drvdata->lpaif_map, reg, 0); ret = regmap_write(drvdata->lpaif_map, reg, 0);
if (ret) if (ret)
dev_err(soc_runtime->dev, "%s() error writing to rdmactl reg: %d\n", 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) ...@@ -269,10 +250,7 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream)
struct lpass_variant *v = drvdata->variant; struct lpass_variant *v = drvdata->variant;
int ret, ch, dir = substream->stream; int ret, ch, dir = substream->stream;
if (dir == SNDRV_PCM_STREAM_PLAYBACK) ch = pcm_data->dma_ch;
ch = pcm_data->rdma_ch;
else
ch = pcm_data->wrdma_ch;
ret = regmap_write(drvdata->lpaif_map, ret = regmap_write(drvdata->lpaif_map,
LPAIF_DMABASE_REG(v, ch, dir), LPAIF_DMABASE_REG(v, ch, dir),
...@@ -324,10 +302,7 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream, ...@@ -324,10 +302,7 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream,
struct lpass_variant *v = drvdata->variant; struct lpass_variant *v = drvdata->variant;
int ret, ch, dir = substream->stream; int ret, ch, dir = substream->stream;
if (dir == SNDRV_PCM_STREAM_PLAYBACK) ch = pcm_data->dma_ch;
ch = pcm_data->rdma_ch;
else
ch = pcm_data->wrdma_ch;
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
...@@ -402,10 +377,7 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer( ...@@ -402,10 +377,7 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer(
unsigned int base_addr, curr_addr; unsigned int base_addr, curr_addr;
int ret, ch, dir = substream->stream; int ret, ch, dir = substream->stream;
if (dir == SNDRV_PCM_STREAM_PLAYBACK) ch = pcm_data->dma_ch;
ch = pcm_data->rdma_ch;
else
ch = pcm_data->wrdma_ch;
ret = regmap_read(drvdata->lpaif_map, ret = regmap_read(drvdata->lpaif_map,
LPAIF_DMABASE_REG(v, ch, dir), &base_addr); LPAIF_DMABASE_REG(v, ch, dir), &base_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment