diff options
author | Zidan Wang <zidan.wang@freescale.com> | 2015-04-10 09:52:36 +0800 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2015-05-08 16:34:33 +0800 |
commit | 7981a488c4da440db21f0544b519b44636a0cabb (patch) | |
tree | 871ff69410baa988a275c0fae2ab32edfc0c8161 /sound | |
parent | 919b4d0609a259bd9eb41d41efdca76afeaa04ea (diff) |
MLK-10611-1 ASoC: fsl-sai: Just one device can playback(captrue) when using the same SAI
Just one device can playback(captrue) when using the same SAI.
Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/fsl/fsl_sai.c | 13 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_sai.h | 1 |
2 files changed, 11 insertions, 3 deletions
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index b28f88b5e0ab..4a38085b5cfc 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -548,6 +548,11 @@ static int fsl_sai_startup(struct snd_pcm_substream *substream, struct device *dev = &sai->pdev->dev; int ret; + if (sai->is_stream_opened[tx]) + return -EBUSY; + else + sai->is_stream_opened[tx] = true; + ret = clk_prepare_enable(sai->bus_clk); if (ret) { dev_err(dev, "failed to enable bus clock: %d\n", ret); @@ -572,9 +577,11 @@ static void fsl_sai_shutdown(struct snd_pcm_substream *substream, struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai); bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; - regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx), FSL_SAI_CR3_TRCE, 0); - - clk_disable_unprepare(sai->bus_clk); + if (sai->is_stream_opened[tx]) { + regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx), FSL_SAI_CR3_TRCE, 0); + clk_disable_unprepare(sai->bus_clk); + sai->is_stream_opened[tx] = false; + } } static const struct snd_soc_dai_ops fsl_sai_pcm_dai_ops = { diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h index 76275f987e94..95d351114cf9 100644 --- a/sound/soc/fsl/fsl_sai.h +++ b/sound/soc/fsl/fsl_sai.h @@ -140,6 +140,7 @@ struct fsl_sai { bool is_dsp_mode; bool sai_on_imx; bool synchronous[2]; + bool is_stream_opened[2]; unsigned int mclk_id; unsigned int mclk_streams; |