summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorViorel Suman <viorel.suman@nxp.com>2018-07-04 11:58:49 +0300
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit927b61369d8ad7f7a92db05fac6f804a26f14507 (patch)
treee05aea983fc97a3c9aa639632969540f4184d668 /sound
parent1aca5f4ce0558164ba84a820f0bfe9fdcc3f4ad8 (diff)
MLK-18737: move 'pair_streams' to 'struct fsl_asrc_pair'
For multi p2p instance an ASRC device cannot be closed successfully when two threads plays streams simultaneously on same ASRC device. 'pair_streams' variable shall be moved to 'struct fsl_asrc_pair' for multi p2p instance in order to handle pair release properly. Signed-off-by: Viorel Suman <viorel.suman@nxp.com> Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/fsl_asrc.c10
-rw-r--r--sound/soc/fsl/fsl_asrc.h2
2 files changed, 5 insertions, 7 deletions
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index da902f6fe22e..26891f555d78 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -582,7 +582,7 @@ static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
return ret;
}
- asrc_priv->pair_streams |= BIT(substream->stream);
+ pair->pair_streams |= BIT(substream->stream);
pair->config = &config;
if (width == 16)
@@ -639,14 +639,12 @@ static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
static int fsl_asrc_dai_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
- struct fsl_asrc *asrc_priv = snd_soc_dai_get_drvdata(dai);
struct snd_pcm_runtime *runtime = substream->runtime;
struct fsl_asrc_pair *pair = runtime->private_data;
- if (asrc_priv->pair_streams & BIT(substream->stream)) {
- if (pair)
- fsl_asrc_release_pair(pair);
- asrc_priv->pair_streams &= ~BIT(substream->stream);
+ if (pair && (pair->pair_streams & BIT(substream->stream))) {
+ fsl_asrc_release_pair(pair);
+ pair->pair_streams &= ~BIT(substream->stream);
}
return 0;
diff --git a/sound/soc/fsl/fsl_asrc.h b/sound/soc/fsl/fsl_asrc.h
index 890820245eb2..0faaadcb3bad 100644
--- a/sound/soc/fsl/fsl_asrc.h
+++ b/sound/soc/fsl/fsl_asrc.h
@@ -323,6 +323,7 @@ struct fsl_asrc_pair {
struct dma_chan *dma_chan[2];
struct imx_dma_data dma_data;
unsigned int pos;
+ unsigned int pair_streams;
void *private;
};
@@ -366,7 +367,6 @@ struct fsl_asrc {
struct miscdevice asrc_miscdev;
unsigned int channel_bits;
unsigned int channel_avail;
- unsigned int pair_streams;
int asrc_rate;
int asrc_width;