Skip to content

Commit

Permalink
ASoC: Blackfin: keep better track of SPORT configuration state
Browse files Browse the repository at this point in the history
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: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Cliff Cai authored and Mark Brown committed Jun 20, 2009
1 parent ef39412 commit 895c9c0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sound/soc/blackfin/bf5xx-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct bf5xx_i2s_port {
u16 tcr2;
u16 rcr2;
int counter;
int configured;
};

static struct bf5xx_i2s_port bf5xx_i2s;
Expand Down Expand Up @@ -168,7 +169,7 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
break;
}

if (bf5xx_i2s.counter == 1) {
if (!bf5xx_i2s.configured) {
/*
* TX and RX are not independent,they are enabled at the
* same time, even if only one side is running. So, we
Expand All @@ -177,6 +178,7 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
*
* CPU DAI:slave mode.
*/
bf5xx_i2s.configured = 1;
ret = sport_config_rx(sport_handle, bf5xx_i2s.rcr1,
bf5xx_i2s.rcr2, 0, 0);
if (ret) {
Expand All @@ -200,6 +202,9 @@ static void bf5xx_i2s_shutdown(struct snd_pcm_substream *substream,
{
pr_debug("%s enter\n", __func__);
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,
Expand Down

0 comments on commit 895c9c0

Please sign in to comment.