Commit 895c9c05 authored by Cliff Cai's avatar Cliff Cai Committed by Mark Brown

ASoC: Blackfin: keep better track of SPORT configuration state

Do not let the SPORT be reconfigured until there are no more active
streams.  Then we can let the system reprogram the SPORT state.
Signed-off-by: default avatarCliff Cai <cliff.cai@analog.com>
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent ef394126
...@@ -50,6 +50,7 @@ struct bf5xx_i2s_port { ...@@ -50,6 +50,7 @@ struct bf5xx_i2s_port {
u16 tcr2; u16 tcr2;
u16 rcr2; u16 rcr2;
int counter; int counter;
int configured;
}; };
static struct bf5xx_i2s_port bf5xx_i2s; static struct bf5xx_i2s_port bf5xx_i2s;
...@@ -168,7 +169,7 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -168,7 +169,7 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
break; break;
} }
if (bf5xx_i2s.counter == 1) { if (!bf5xx_i2s.configured) {
/* /*
* TX and RX are not independent,they are enabled at the * TX and RX are not independent,they are enabled at the
* same time, even if only one side is running. So, we * same time, even if only one side is running. So, we
...@@ -177,6 +178,7 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -177,6 +178,7 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
* *
* CPU DAI:slave mode. * CPU DAI:slave mode.
*/ */
bf5xx_i2s.configured = 1;
ret = sport_config_rx(sport_handle, bf5xx_i2s.rcr1, ret = sport_config_rx(sport_handle, bf5xx_i2s.rcr1,
bf5xx_i2s.rcr2, 0, 0); bf5xx_i2s.rcr2, 0, 0);
if (ret) { if (ret) {
...@@ -200,6 +202,9 @@ static void bf5xx_i2s_shutdown(struct snd_pcm_substream *substream, ...@@ -200,6 +202,9 @@ static void bf5xx_i2s_shutdown(struct snd_pcm_substream *substream,
{ {
pr_debug("%s enter\n", __func__); pr_debug("%s enter\n", __func__);
bf5xx_i2s.counter--; bf5xx_i2s.counter--;
/* No active stream, SPORT is allowed to be configured again. */
if (!bf5xx_i2s.counter)
bf5xx_i2s.configured = 0;
} }
static int bf5xx_i2s_probe(struct platform_device *pdev, static int bf5xx_i2s_probe(struct platform_device *pdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment