* [PATCH v2 0/2] ASoC: dpcm: fix BE dai not hw_free and shutdown
@ 2018-05-28 2:18 KaiChieh Chuang
2018-05-28 2:18 ` [PATCH v2 1/2] " KaiChieh Chuang
[not found] ` <1527473899-23079-1-git-send-email-kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
0 siblings, 2 replies; 4+ messages in thread
From: KaiChieh Chuang @ 2018-05-28 2:18 UTC (permalink / raw)
To: broonie; +Cc: alsa-devel, linux-mediatek, wsd_upstream, kaichieh.chuang
These two patch is to solve problem found
in the case of one BE is used by multiple FE.
The error log "ASoC: Unable to apply rate constraint"
will happen when be_substream->runtime is use after free.
Which is due to BE not being hw_free/shutdown correctly.
Also to resolve fe_substream->runtime is not
constrained by BE dai symmetry property.
v2:
remove flag condition
KaiChieh Chuang (2):
ASoC: dpcm: fix BE dai not hw_free and shutdown
ASoC: dpcm: symmetry constraint on FE substream
sound/soc/soc-pcm.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v2 1/2] ASoC: dpcm: fix BE dai not hw_free and shutdown 2018-05-28 2:18 [PATCH v2 0/2] ASoC: dpcm: fix BE dai not hw_free and shutdown KaiChieh Chuang @ 2018-05-28 2:18 ` KaiChieh Chuang 2018-05-29 14:59 ` Applied "ASoC: dpcm: fix BE dai not hw_free and shutdown" to the asoc tree Mark Brown [not found] ` <1527473899-23079-1-git-send-email-kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 1 sibling, 1 reply; 4+ messages in thread From: KaiChieh Chuang @ 2018-05-28 2:18 UTC (permalink / raw) To: broonie; +Cc: alsa-devel, linux-mediatek, wsd_upstream, kaichieh.chuang In case, one BE is used by two FE1/FE2 FE1--->BE--> | FE2----] when FE1/FE2 call dpcm_be_dai_hw_free() together the BE users will be 2 (> 1), hence cannot be hw_free the be state will leave at, ex. SND_SOC_DPCM_STATE_STOP later FE1/FE2 call dpcm_be_dai_shutdown(), will be skip due to wrong state. leaving the BE not being hw_free and shutdown. The BE dai will be hw_free later when calling dpcm_be_dai_shutdown() if still in invalid state. Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com> --- sound/soc/soc-pcm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 87c9af2..ffdbbd9 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1866,8 +1866,10 @@ int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) continue; if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && - (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) - continue; + (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) { + soc_pcm_hw_free(be_substream); + be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; + } dev_dbg(be->dev, "ASoC: close BE %s\n", be->dai_link->name); -- 1.9.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Applied "ASoC: dpcm: fix BE dai not hw_free and shutdown" to the asoc tree 2018-05-28 2:18 ` [PATCH v2 1/2] " KaiChieh Chuang @ 2018-05-29 14:59 ` Mark Brown 0 siblings, 0 replies; 4+ messages in thread From: Mark Brown @ 2018-05-29 14:59 UTC (permalink / raw) Cc: alsa-devel, broonie, linux-mediatek, wsd_upstream, kaichieh.chuang The patch ASoC: dpcm: fix BE dai not hw_free and shutdown has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 9c0ac70ad24d76b873c1551e27790c7f6a815d5c Mon Sep 17 00:00:00 2001 From: Kai Chieh Chuang <kaichieh.chuang@mediatek.com> Date: Mon, 28 May 2018 10:18:18 +0800 Subject: [PATCH] ASoC: dpcm: fix BE dai not hw_free and shutdown In case, one BE is used by two FE1/FE2 FE1--->BE--> | FE2----] when FE1/FE2 call dpcm_be_dai_hw_free() together the BE users will be 2 (> 1), hence cannot be hw_free the be state will leave at, ex. SND_SOC_DPCM_STATE_STOP later FE1/FE2 call dpcm_be_dai_shutdown(), will be skip due to wrong state. leaving the BE not being hw_free and shutdown. The BE dai will be hw_free later when calling dpcm_be_dai_shutdown() if still in invalid state. Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com> Signed-off-by: Mark Brown <broonie@kernel.org> --- sound/soc/soc-pcm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 2df4719a84db..2d846b3dd70c 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1866,8 +1866,10 @@ int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream) continue; if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && - (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) - continue; + (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) { + soc_pcm_hw_free(be_substream); + be->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; + } dev_dbg(be->dev, "ASoC: close BE %s\n", be->dai_link->name); -- 2.17.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <1527473899-23079-1-git-send-email-kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>]
* [PATCH v2 2/2] ASoC: dpcm: symmetry constraint on FE substream [not found] ` <1527473899-23079-1-git-send-email-kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> @ 2018-05-28 2:18 ` KaiChieh Chuang 0 siblings, 0 replies; 4+ messages in thread From: KaiChieh Chuang @ 2018-05-28 2:18 UTC (permalink / raw) To: broonie-DgEjT+Ai2ygdnm+yROfE0A Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, wsd_upstream-NuS5LvNUpcJWk0Htik3J/w, kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w We should set BE symmetric constraint on FE substream. in case one BE is used by two FE1/FE2, the first BE runtime will use FE1's substream->runtime. hence the FE1's will be constrained by BE symmetry property. Though, second FE2 call dpcm_apply_symmetry, the be_substream->runtime == FE1's substream->runtime. The FE2's substream->runtime will not be constrained by BE's symmetry property. Signed-off-by: KaiChieh Chuang <kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> --- sound/soc/soc-pcm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index ffdbbd9..61494f7 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1779,14 +1779,15 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream, /* Symmetry only applies if we've got an active stream. */ if (rtd->cpu_dai->active) { - err = soc_pcm_apply_symmetry(be_substream, rtd->cpu_dai); + err = soc_pcm_apply_symmetry(fe_substream, + rtd->cpu_dai); if (err < 0) return err; } for (i = 0; i < rtd->num_codecs; i++) { if (rtd->codec_dais[i]->active) { - err = soc_pcm_apply_symmetry(be_substream, + err = soc_pcm_apply_symmetry(fe_substream, rtd->codec_dais[i]); if (err < 0) return err; -- 1.9.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-29 14:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-28 2:18 [PATCH v2 0/2] ASoC: dpcm: fix BE dai not hw_free and shutdown KaiChieh Chuang
2018-05-28 2:18 ` [PATCH v2 1/2] " KaiChieh Chuang
2018-05-29 14:59 ` Applied "ASoC: dpcm: fix BE dai not hw_free and shutdown" to the asoc tree Mark Brown
[not found] ` <1527473899-23079-1-git-send-email-kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2018-05-28 2:18 ` [PATCH v2 2/2] ASoC: dpcm: symmetry constraint on FE substream KaiChieh Chuang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox