Commit fc213aa3 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Treehugger Robot
Browse files

BACKPORT: ASoC: soc-pcm: test refcount before triggering



[ Upstream commit 848aedfd ]

On start/pause_release/resume, when more than one FE is connected to
the same BE, it's possible that the trigger is sent more than
once. This is not desirable, we only want to trigger a BE once, which
is straightforward to implement with a refcount.

For stop/pause/suspend, the problem is more complicated: the check
implemented in snd_soc_dpcm_can_be_free_stop() may fail due to a
conceptual deadlock when we trigger the BE before the FE. In this
case, the FE states have not yet changed, so there are corner cases
where the TRIGGER_STOP is never sent - the dual case of start where
multiple triggers might be sent.

This patch suggests an unconditional trigger in all cases, without
checking the FE states, using a refcount protected by the BE PCM
stream lock.

Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211207173745.15850-6-pierre-louis.bossart@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Fixes: aa9ff6a4 ("ASoC: soc-compress: Reposition and add pcm_mutex")
Signed-off-by: default avatarYixuan Jiang <yixuanjiang@google.com>
Cc: stable@vger.kernel.org # 5.15+

Bug: 287928097
Bug: 277241308
Link: https://lore.kernel.org/all/20230511120841.2096524-6-yixuanjiang@google.com


Change-Id: I294e1f1b55cb1819e0510bff67db41b01c809210
Signed-off-by: default avatarYixuan Jiang <yixuanjiang@google.com>
[preserve the ABI by moving be_start to snd_soc_pcm_runtime]
Signed-off-by: default avatarWill McVicker <willmcvicker@google.com>
parent cdaafbf2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment