diff options
author | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> | 2016-10-31 07:25:44 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-10-31 14:31:10 -0400 |
commit | 4314f928f79f816367a4f09539aeebf7c5b4f5fa (patch) | |
tree | 67ceac70e6fbc82c344396eb626c8d953085387a | |
parent | e9a16e4ad74cc03f121893250631895755bb763d (diff) |
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: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/qcom/lpass-platform.c | 46 |
1 files changed, 9 insertions, 37 deletions
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c index 07000f53db44..ca5e19f55a28 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c | |||
@@ -25,8 +25,7 @@ | |||
25 | #include "lpass.h" | 25 | #include "lpass.h" |
26 | 26 | ||
27 | struct lpass_pcm_data { | 27 | struct lpass_pcm_data { |
28 | int rdma_ch; | 28 | int dma_ch; |
29 | int wrdma_ch; | ||
30 | int i2s_port; | 29 | int i2s_port; |
31 | }; | 30 | }; |
32 | 31 | ||
@@ -91,10 +90,7 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) | |||
91 | return ret; | 90 | return ret; |
92 | } | 91 | } |
93 | 92 | ||
94 | if (dir == SNDRV_PCM_STREAM_PLAYBACK) | 93 | data->dma_ch = dma_ch; |
95 | data->rdma_ch = dma_ch; | ||
96 | else | ||
97 | data->wrdma_ch = dma_ch; | ||
98 | 94 | ||
99 | snd_soc_set_runtime_hwparams(substream, &lpass_platform_pcm_hardware); | 95 | snd_soc_set_runtime_hwparams(substream, &lpass_platform_pcm_hardware); |
100 | 96 | ||
@@ -121,20 +117,12 @@ static int lpass_platform_pcmops_close(struct snd_pcm_substream *substream) | |||
121 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 117 | snd_soc_platform_get_drvdata(soc_runtime->platform); |
122 | struct lpass_variant *v = drvdata->variant; | 118 | struct lpass_variant *v = drvdata->variant; |
123 | struct lpass_pcm_data *data; | 119 | struct lpass_pcm_data *data; |
124 | int dma_ch, dir = substream->stream; | ||
125 | 120 | ||
126 | data = runtime->private_data; | 121 | data = runtime->private_data; |
127 | v = drvdata->variant; | 122 | v = drvdata->variant; |
128 | 123 | drvdata->substream[data->dma_ch] = NULL; | |
129 | if (dir == SNDRV_PCM_STREAM_PLAYBACK) | ||
130 | dma_ch = data->rdma_ch; | ||
131 | else | ||
132 | dma_ch = data->wrdma_ch; | ||
133 | |||
134 | drvdata->substream[dma_ch] = NULL; | ||
135 | |||
136 | if (v->free_dma_channel) | 124 | if (v->free_dma_channel) |
137 | v->free_dma_channel(drvdata, dma_ch); | 125 | v->free_dma_channel(drvdata, data->dma_ch); |
138 | 126 | ||
139 | return 0; | 127 | return 0; |
140 | } | 128 | } |
@@ -155,10 +143,7 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream, | |||
155 | int bitwidth; | 143 | int bitwidth; |
156 | int ret, dma_port = pcm_data->i2s_port + v->dmactl_audif_start; | 144 | int ret, dma_port = pcm_data->i2s_port + v->dmactl_audif_start; |
157 | 145 | ||
158 | if (dir == SNDRV_PCM_STREAM_PLAYBACK) | 146 | ch = pcm_data->dma_ch; |
159 | ch = pcm_data->rdma_ch; | ||
160 | else | ||
161 | ch = pcm_data->wrdma_ch; | ||
162 | 147 | ||
163 | bitwidth = snd_pcm_format_width(format); | 148 | bitwidth = snd_pcm_format_width(format); |
164 | if (bitwidth < 0) { | 149 | if (bitwidth < 0) { |
@@ -245,11 +230,7 @@ static int lpass_platform_pcmops_hw_free(struct snd_pcm_substream *substream) | |||
245 | unsigned int reg; | 230 | unsigned int reg; |
246 | int ret; | 231 | int ret; |
247 | 232 | ||
248 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 233 | reg = LPAIF_DMACTL_REG(v, pcm_data->dma_ch, substream->stream); |
249 | reg = LPAIF_RDMACTL_REG(v, pcm_data->rdma_ch); | ||
250 | else | ||
251 | reg = LPAIF_WRDMACTL_REG(v, pcm_data->wrdma_ch); | ||
252 | |||
253 | ret = regmap_write(drvdata->lpaif_map, reg, 0); | 234 | ret = regmap_write(drvdata->lpaif_map, reg, 0); |
254 | if (ret) | 235 | if (ret) |
255 | dev_err(soc_runtime->dev, "%s() error writing to rdmactl reg: %d\n", | 236 | 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 | struct lpass_variant *v = drvdata->variant; | 250 | struct lpass_variant *v = drvdata->variant; |
270 | int ret, ch, dir = substream->stream; | 251 | int ret, ch, dir = substream->stream; |
271 | 252 | ||
272 | if (dir == SNDRV_PCM_STREAM_PLAYBACK) | 253 | ch = pcm_data->dma_ch; |
273 | ch = pcm_data->rdma_ch; | ||
274 | else | ||
275 | ch = pcm_data->wrdma_ch; | ||
276 | 254 | ||
277 | ret = regmap_write(drvdata->lpaif_map, | 255 | ret = regmap_write(drvdata->lpaif_map, |
278 | LPAIF_DMABASE_REG(v, ch, dir), | 256 | LPAIF_DMABASE_REG(v, ch, dir), |
@@ -324,10 +302,7 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream, | |||
324 | struct lpass_variant *v = drvdata->variant; | 302 | struct lpass_variant *v = drvdata->variant; |
325 | int ret, ch, dir = substream->stream; | 303 | int ret, ch, dir = substream->stream; |
326 | 304 | ||
327 | if (dir == SNDRV_PCM_STREAM_PLAYBACK) | 305 | ch = pcm_data->dma_ch; |
328 | ch = pcm_data->rdma_ch; | ||
329 | else | ||
330 | ch = pcm_data->wrdma_ch; | ||
331 | 306 | ||
332 | switch (cmd) { | 307 | switch (cmd) { |
333 | case SNDRV_PCM_TRIGGER_START: | 308 | case SNDRV_PCM_TRIGGER_START: |
@@ -402,10 +377,7 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer( | |||
402 | unsigned int base_addr, curr_addr; | 377 | unsigned int base_addr, curr_addr; |
403 | int ret, ch, dir = substream->stream; | 378 | int ret, ch, dir = substream->stream; |
404 | 379 | ||
405 | if (dir == SNDRV_PCM_STREAM_PLAYBACK) | 380 | ch = pcm_data->dma_ch; |
406 | ch = pcm_data->rdma_ch; | ||
407 | else | ||
408 | ch = pcm_data->wrdma_ch; | ||
409 | 381 | ||
410 | ret = regmap_read(drvdata->lpaif_map, | 382 | ret = regmap_read(drvdata->lpaif_map, |
411 | LPAIF_DMABASE_REG(v, ch, dir), &base_addr); | 383 | LPAIF_DMABASE_REG(v, ch, dir), &base_addr); |