summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2022-09-20 22:32:16 +0100
committerMark Brown <broonie@kernel.org>2022-09-20 22:32:16 +0100
commit08820902ef25d8a2b7c23297d7b73da657d52da0 (patch)
tree0ddb36bc521712e2596d7860f705cff6a2c388ce
parent899a8e7ddc44c23d75ed7fce7b7962f2da95dd33 (diff)
parent9862dcf70245c2d03764012b81966d8c2ea95a48 (diff)
downloadlinux-stable-08820902ef25d8a2b7c23297d7b73da657d52da0.tar.gz
linux-stable-08820902ef25d8a2b7c23297d7b73da657d52da0.tar.bz2
linux-stable-08820902ef25d8a2b7c23297d7b73da657d52da0.zip
ASoC: SOF: sof-audio: fix prepare/unprepare
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>: 2 patches from Rander required to enable mixing usages with multiple pipelines.
-rw-r--r--sound/soc/sof/sof-audio.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
index a3d3dd7a0037..62092e2d609c 100644
--- a/sound/soc/sof/sof-audio.c
+++ b/sound/soc/sof/sof-audio.c
@@ -271,14 +271,16 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg
struct snd_sof_widget *swidget = widget->dobj.private;
struct snd_soc_dapm_path *p;
- if (!widget_ops[widget->id].ipc_unprepare || !swidget->prepared)
- goto sink_unprepare;
+ /* return if the widget is in use or if it is already unprepared */
+ if (!swidget->prepared || swidget->use_count > 1)
+ return;
+
+ if (widget_ops[widget->id].ipc_unprepare)
+ /* unprepare the source widget */
+ widget_ops[widget->id].ipc_unprepare(swidget);
- /* unprepare the source widget */
- widget_ops[widget->id].ipc_unprepare(swidget);
swidget->prepared = false;
-sink_unprepare:
/* unprepare all widgets in the sink paths */
snd_soc_dapm_widget_for_each_sink_path(widget, p) {
if (!p->walking && p->sink->dobj.private) {