diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2016-12-23 03:55:21 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-12-23 03:55:20 -0800 |
commit | 25894fce14986a83c6bc67a24ab4f7bfd324a52e (patch) | |
tree | 41b218777c06a51303b53ba1a5b32b54663249ca /sound | |
parent | 27e721b8251f3679f417580a840dfaa95c33d3b9 (diff) | |
parent | 8777df6c6eabb099c5069081dc991bb819337ff6 (diff) |
Merge "ASoC: msm: decrement slim channel ref to set the property"
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/msm/qdsp6v2/msm-dai-slim.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sound/soc/msm/qdsp6v2/msm-dai-slim.c b/sound/soc/msm/qdsp6v2/msm-dai-slim.c index 7c56f4ad8884..43a27eb35a44 100644 --- a/sound/soc/msm/qdsp6v2/msm-dai-slim.c +++ b/sound/soc/msm/qdsp6v2/msm-dai-slim.c @@ -314,7 +314,7 @@ static int msm_dai_slim_prepare(struct snd_pcm_substream *substream, struct msm_slim_dai_data *dai_data = NULL; struct slim_ch prop; int rc; - u8 i, j; + u8 i; dai_data = msm_slim_get_dai_data(drv_data, dai); if (!dai_data) { @@ -331,6 +331,13 @@ static int msm_dai_slim_prepare(struct snd_pcm_substream *substream, return -EINVAL; } + if (dai_data->status & DAI_STATE_PREPARED) { + dev_dbg(dai->dev, + "%s: dai id (%d) has already prepared.\n", + __func__, dai->id); + return 0; + } + dma_data = &dai_data->dma_data; snd_soc_dai_set_dma_data(dai, substream, dma_data); @@ -344,6 +351,10 @@ static int msm_dai_slim_prepare(struct snd_pcm_substream *substream, } } + /* To decrement the channel ref count*/ + for (i = 0; i < dai_data->ch_cnt; i++) + slim_dealloc_ch(drv_data->sdev, dai_data->chan_h[i]); + prop.prot = SLIM_AUTO_ISO; prop.baser = SLIM_RATE_4000HZ; prop.dataf = SLIM_CH_DATAF_NOT_DEFINED; @@ -367,8 +378,6 @@ static int msm_dai_slim_prepare(struct snd_pcm_substream *substream, error_define_chan: error_chan_query: - for (j = 0; j < i; j++) - slim_dealloc_ch(drv_data->sdev, dai_data->chan_h[j]); return rc; } @@ -378,7 +387,6 @@ static void msm_dai_slim_shutdown(struct snd_pcm_substream *stream, struct msm_dai_slim_drv_data *drv_data = dev_get_drvdata(dai->dev); struct msm_slim_dma_data *dma_data = NULL; struct msm_slim_dai_data *dai_data; - int i, rc = 0; dai_data = msm_slim_get_dai_data(drv_data, dai); dma_data = snd_soc_dai_get_dma_data(dai, stream); @@ -397,15 +405,6 @@ static void msm_dai_slim_shutdown(struct snd_pcm_substream *stream, return; } - for (i = 0; i < dai_data->ch_cnt; i++) { - rc = slim_dealloc_ch(drv_data->sdev, dai_data->chan_h[i]); - if (rc) { - dev_err(dai->dev, - "%s: dealloc_ch failed, err = %d\n", - __func__, rc); - } - } - snd_soc_dai_set_dma_data(dai, stream, NULL); /* clear prepared state for the dai */ CLR_DAI_STATE(dai_data->status, DAI_STATE_PREPARED); |