summaryrefslogtreecommitdiffstats
path: root/sound/soc/sof/ipc4.c
diff options
context:
space:
mode:
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>2023-01-27 14:00:27 +0200
committerMark Brown <broonie@kernel.org>2023-01-27 12:14:10 +0000
commit32c4b69872e5fe5fd9517826be31dbf2c3dd917a (patch)
tree1193add9d86c1bcfb7ef3d2c5571b12289c1485a /sound/soc/sof/ipc4.c
parent6f9eb19a33d608ba36162a9ccbd34a77249fcc2e (diff)
downloadlinux-stable-32c4b69872e5fe5fd9517826be31dbf2c3dd917a.tar.gz
linux-stable-32c4b69872e5fe5fd9517826be31dbf2c3dd917a.tar.bz2
linux-stable-32c4b69872e5fe5fd9517826be31dbf2c3dd917a.zip
ASoC: SOF: ipc4-pcm: Implement pipeline trigger reference counting
Use the started_count and paused_count to implement reference counting when making decisions to start/stop/pause pipelines during the FE DAI trigger. This is necessary to trigger the shared pipelines in the FE DAI trigger properly. With IPC4, the FE trigger will issue multiple pipeline state changes, and the triggers are propagated downstream to connected pipelines by the SOF driver - not the firmware. This creates a window for race conditions where an FE trigger preempts another one, which results in inconsistent pipeline states and refcounts. This patch introduces a mutex lock for the pcm trigger that guarantees that IPC4 state and resources are accessed in a serialized manner. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230127120031.10709-15-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/ipc4.c')
-rw-r--r--sound/soc/sof/ipc4.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/soc/sof/ipc4.c b/sound/soc/sof/ipc4.c
index 74cd7e956019..fb4760ae593f 100644
--- a/sound/soc/sof/ipc4.c
+++ b/sound/soc/sof/ipc4.c
@@ -662,6 +662,8 @@ static int sof_ipc4_init(struct snd_sof_dev *sdev)
{
struct sof_ipc4_fw_data *ipc4_data = sdev->private;
+ mutex_init(&ipc4_data->trigger_mutex);
+
xa_init_flags(&ipc4_data->fw_lib_xa, XA_FLAGS_ALLOC);
return 0;