1
0
Fork 0

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>
pull/10/head
Viorel Suman 2018-07-04 11:58:49 +03:00 committed by Jason Liu
parent 0e7d97faaa
commit a464d15efd
2 changed files with 5 additions and 7 deletions

View File

@ -584,7 +584,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)
@ -641,14 +641,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;

View File

@ -324,6 +324,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;
};
@ -367,7 +368,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;