aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQiao Zhou <zhouqiao@marvell.com>2014-12-02 21:13:43 -0500
committerMark Brown <broonie@kernel.org>2014-12-04 17:41:58 -0500
commit36fba62cce8184ea6a0cecfa43f07f712716a6f8 (patch)
tree9ccbbb4e3b4834c61046d52646c24f457f44fce7
parentf114040e3ea6e07372334ade75d1ee0775c355e1 (diff)
ASoC: soc-pcm: do not hw_free BE if it's still used
Do not free BE hw if it's still used by other FE during dpcm runtime shutdown. Otherwise the BE runtime state will be STATE_HW_FREE and won't be updated to STATE_CLOSE when shutdown ends, because BE dai shutdown function won't close pcm when detecting BE is still under use. With STATE_HW_FREE, BE can't be triggered start again. This corner case can easily appear when one BE is used by two FE, without this patch "ASoC: dpcm: Fix race between FE/BE updates and trigger"(ea9d0d771fcd32cd56070819749477d511ec9117). One FE tries to shutdown but it's raced against xrun on another FE. It improves the be dai hw_free logic. Signed-off-by: Qiao Zhou <zhouqiao@marvell.com> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-pcm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 002311afdeaa..84357193c044 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1641,6 +1641,10 @@ int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
1641 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) 1641 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))
1642 continue; 1642 continue;
1643 1643
1644 /* do not free hw if this BE is used by other FE */
1645 if (be->dpcm[stream].users > 1)
1646 continue;
1647
1644 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && 1648 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) &&
1645 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && 1649 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
1646 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && 1650 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) &&