ASoC: SOF: sof-audio: Fixes for widget prepare and unprepare (for 6.2)
Subsystems (3)
Peter Ujfalusi
maintainerv3 cover 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(-)
Signature · 1 line
2.39.0
Peter Ujfalusi
maintainerPATCH v3 1/3 ASoC: SOF: sof-audio: unprepare when swidget->use_count > 0
From: Bard Liao <[email protected]>
We should unprepare the widget if its use_count = 1.
--- sound/soc/sof/sof-audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/sof-audio.c +1 -1
@@ -272,7 +272,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widgstruct 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)
Signature · 1 line
2.39.0
Peter Ujfalusi
maintainerPATCH v3 2/3 ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL
In reply to Peter UjfalusiFrom: Ranjani Sridharan <[email protected]>
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.
--- sound/soc/sof/sof-audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sof/sof-audio.c +2 -2
@@ -272,7 +272,7 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widgstruct 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_widgetstruct 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 */
Signature · 1 line
2.39.0
Peter Ujfalusi
maintainerPATCH v3 3/3 ASoC: SOF: keep prepare/unprepare widgets in sink path
In reply to Peter UjfalusiFrom: Bard Liao <[email protected]>
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.
--- sound/soc/sof/sof-audio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/sof/sof-audio.c +3 -2
@@ -271,9 +271,9 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widgstruct 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) {
Signature · 1 line
2.39.0
Mark Brown
maintainerQuoted 10 lines · Peter Ujfalusi
Changes since v2:
- re-based on v6.2-rc4 (and tested)
- tags added from AngeloGioacchino Del Regno for patch 2Changes 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: cc755b4377b0520d594ae573497cf0824baea648All 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