]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - sound/soc/qcom/lpass-platform.c
Merge remote-tracking branches 'asoc/topic/of-graph', 'asoc/topic/pxa', 'asoc/topic...
[mirror_ubuntu-zesty-kernel.git] / sound / soc / qcom / lpass-platform.c
index 420d200f9a0533bd335224784c2e7933a0c8c3b1..dd5bdd0da73048c627417c45980dde5032043656 100644 (file)
@@ -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_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);
 
@@ -125,20 +121,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;
 }
@@ -159,10 +147,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) {
@@ -249,11 +234,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",
@@ -273,10 +254,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),
@@ -328,10 +306,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:
@@ -406,10 +381,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);