[PATCH v3 0/3] ASoC: SOF: sof-audio: Fixes for widget prepare and unprepare (for 6.2)
Hi,
Changes since v2: - re-based on v6.2-rc4 (and tested) - tags added from AngeloGioacchino Del Regno for patch 2
Changes since v1: - patches got re-ordered to make them (hopefully) apply on stable when picked - Added stable tag for 6.1 for the patches - Added Fixes tag for the swidget NULL check on unprepare
This series contains one fix (first patch) followed by a nice to have safety belts in case we get a widget from topology which is not handled by SOF and will not have corresponding swidget associated with.
Mark: these patches now on top of 6.2-rc4 and will not apply without conflict on next (patch 2 and 3 will ahve conflict)
Regards, Peter --- Bard Liao (2): ASoC: SOF: sof-audio: unprepare when swidget->use_count > 0 ASoC: SOF: keep prepare/unprepare widgets in sink path
Ranjani Sridharan (1): ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL
sound/soc/sof/sof-audio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
From: Bard Liao yung-chuan.liao@linux.intel.com
We should unprepare the widget if its use_count = 1.
Fixes: 9862dcf70245 ("ASoC: SOF: don't unprepare widget used other pipelines") Cc: stable@vger.kernel.org # 6.1 Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com Reviewed-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 Signed-off-by: Peter Ujfalusi peter.ujfalusi@linux.intel.com --- sound/soc/sof/sof-audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index 7306a2649857..e52ef62ce7a3 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -272,7 +272,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg struct snd_soc_dapm_path *p;
/* return if the widget is in use or if it is already unprepared */ - if (!swidget->prepared || swidget->use_count > 1) + if (!swidget->prepared || swidget->use_count > 0) return;
if (widget_ops[widget->id].ipc_unprepare)
From: Ranjani Sridharan ranjani.sridharan@linux.intel.com
Skip preparing/unpreparing widgets if the swidget pointer is NULL. This will be true in the case of virtual widgets in topology that were added for reusing the legacy HDA machine driver with SOF.
Fixes: 9862dcf70245 ("ASoC: SOF: don't unprepare widget used other pipelines") Cc: stable@vger.kernel.org # 6.1 Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Signed-off-by: Peter Ujfalusi peter.ujfalusi@linux.intel.com Reviewed-by: Rander Wang rander.wang@intel.com Reviewed-by: AngeloGioacchino Del Regno angelogioacchino.delregno@collabora.com Tested-by: AngeloGioacchino Del Regno angelogioacchino.delregno@collabora.com Signed-off-by: Peter Ujfalusi peter.ujfalusi@linux.intel.com --- sound/soc/sof/sof-audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index e52ef62ce7a3..8c114e6a23c6 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -272,7 +272,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg struct snd_soc_dapm_path *p;
/* return if the widget is in use or if it is already unprepared */ - if (!swidget->prepared || swidget->use_count > 0) + if (!swidget || !swidget->prepared || swidget->use_count > 0) return;
if (widget_ops[widget->id].ipc_unprepare) @@ -303,7 +303,7 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget struct snd_soc_dapm_path *p; int ret;
- if (!widget_ops[widget->id].ipc_prepare || swidget->prepared) + if (!swidget || !widget_ops[widget->id].ipc_prepare || swidget->prepared) goto sink_prepare;
/* prepare the source widget */
From: Bard Liao yung-chuan.liao@linux.intel.com
The existing code return when a widget doesn't need to prepare/unprepare. This will prevent widgets in the sink path from being prepared/unprepared.
Cc: stable@vger.kernel.org # 6.1 Link: https://github.com/thesofproject/linux/issues/4021 Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com Reviewed-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 Signed-off-by: Peter Ujfalusi peter.ujfalusi@linux.intel.com --- sound/soc/sof/sof-audio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index 8c114e6a23c6..ff716bfbcb67 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -271,9 +271,9 @@ 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;
- /* return if the widget is in use or if it is already unprepared */ + /* skip if the widget is in use or if it is already unprepared */ if (!swidget || !swidget->prepared || swidget->use_count > 0) - return; + goto sink_unprepare;
if (widget_ops[widget->id].ipc_unprepare) /* unprepare the source widget */ @@ -281,6 +281,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg
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) {
On Wed, 18 Jan 2023 12:12:52 +0200, Peter Ujfalusi wrote:
Changes since v2:
- re-based on v6.2-rc4 (and tested)
- tags added from AngeloGioacchino Del Regno for patch 2
Changes since v1:
- patches got re-ordered to make them (hopefully) apply on stable when picked
- Added stable tag for 6.1 for the patches
- Added Fixes tag for the swidget NULL check on unprepare
[...]
Applied to
broonie/sound.git for-next
Thanks!
[1/3] ASoC: SOF: sof-audio: unprepare when swidget->use_count > 0 commit: 7d2a67e02549c4b1feaac4d8b4151bf46424a047 [2/3] ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL commit: 0ad84b11f2f8dd19d62d0b2ffd95ece897e6c3dc [3/3] ASoC: SOF: keep prepare/unprepare widgets in sink path commit: cc755b4377b0520d594ae573497cf0824baea648
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
participants (2)
-
Mark Brown
-
Peter Ujfalusi