summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZidan Wang <zidan.wang@freescale.com>2015-04-10 09:52:36 +0800
committerFrank Li <Frank.Li@freescale.com>2015-04-24 23:03:41 +0800
commit4ced940b30bc99c8300b57106e8ec9b60e81bd68 (patch)
tree8c7b02ae238c66ca15e4cb3e04debe33a08314e4
parentd3f6c7a5b4be99e91cba9134cb3423804ee4916b (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>
-rw-r--r--sound/soc/fsl/fsl_sai.c13
-rw-r--r--sound/soc/fsl/fsl_sai.h3
2 files changed, 12 insertions, 4 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 c398b1c3c6d2..f9eed5b4cd3a 100644
--- a/sound/soc/fsl/fsl_sai.h
+++ b/sound/soc/fsl/fsl_sai.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 Freescale Semiconductor, Inc.
+ * Copyright 2012-2015 Freescale Semiconductor, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -139,6 +139,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;