]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ASoC: dpcm: fix BE dai not hw_free and shutdown
authorKai Chieh Chuang <kaichieh.chuang@mediatek.com>
Mon, 28 May 2018 02:18:18 +0000 (10:18 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 1 Mar 2019 13:20:35 +0000 (14:20 +0100)
BugLink: http://bugs.launchpad.net/bugs/1815234
[ Upstream commit 9c0ac70ad24d76b873c1551e27790c7f6a815d5c ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
sound/soc/soc-pcm.c

index 8075856668c23b10e0f16eebb78cb59b8c7a233a..ff077c00e0ba8708e84e938d33f0ca6fcfbf7bd1 100644 (file)
@@ -1954,8 +1954,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);