[PATCH v2 0/3] ASoC: SOF: sof-audio: Fixes for widget prepare and unprepare
Hi,
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: can these be picked for 6.2?
Regards, Peter --- Bard Liao (2): ASoC: SOF: sof-audio: Unprepare when swidget->use_count > 0 ASoC: SOF: sof-audio: 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 e1ab8380e7d8..068501ed7951 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -274,7 +274,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;
widget_ops = tplg_ops ? tplg_ops->widget : NULL;
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 Reviewed-by: Rander Wang rander.wang@intel.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 068501ed7951..739afb8df590 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -274,7 +274,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;
widget_ops = tplg_ops ? tplg_ops->widget : NULL; @@ -310,7 +310,7 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget if (!widget_ops) return 0;
- 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 */
Il 16/01/23 13:55, Peter Ujfalusi ha scritto:
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 Reviewed-by: Rander Wang rander.wang@intel.com Signed-off-by: Peter Ujfalusi peter.ujfalusi@linux.intel.com
Reviewed-by: AngeloGioacchino Del Regno angelogioacchino.delregno@collabora.com
[Angelo: Tested on MT8195 Tomato Chromebook] Tested-by: AngeloGioacchino Del Regno angelogioacchino.delregno@collabora.com
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 739afb8df590..5c878788dedb 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -273,9 +273,9 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg const struct sof_ipc_tplg_widget_ops *widget_ops; 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;
widget_ops = tplg_ops ? tplg_ops->widget : NULL; if (widget_ops && widget_ops[widget->id].ipc_unprepare) @@ -284,6 +284,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 Mon, Jan 16, 2023 at 02:55:03PM +0200, Peter Ujfalusi wrote:
Mark: can these be picked for 6.2?
Well, patch 2 doesn't apply so not right now...
Applying: ASoC: SOF: sof-audio: Unprepare when swidget->use_count > 0 Using index info to reconstruct a base tree... M sound/soc/sof/sof-audio.c Falling back to patching base and 3-way merge... Auto-merging sound/soc/sof/sof-audio.c Applying: ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL Using index info to reconstruct a base tree... M sound/soc/sof/sof-audio.c Falling back to patching base and 3-way merge... Auto-merging sound/soc/sof/sof-audio.c CONFLICT (content): Merge conflict in sound/soc/sof/sof-audio.c
On 17/01/2023 15:16, Mark Brown wrote:
On Mon, Jan 16, 2023 at 02:55:03PM +0200, Peter Ujfalusi wrote:
Mark: can these be picked for 6.2?
Well, patch 2 doesn't apply so not right now...
oh. Let me see what is missing.
Applying: ASoC: SOF: sof-audio: Unprepare when swidget->use_count > 0 Using index info to reconstruct a base tree... M sound/soc/sof/sof-audio.c Falling back to patching base and 3-way merge... Auto-merging sound/soc/sof/sof-audio.c Applying: ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL Using index info to reconstruct a base tree... M sound/soc/sof/sof-audio.c Falling back to patching base and 3-way merge... Auto-merging sound/soc/sof/sof-audio.c CONFLICT (content): Merge conflict in sound/soc/sof/sof-audio.c
On 17/01/2023 15:48, Péter Ujfalusi wrote:
On 17/01/2023 15:16, Mark Brown wrote:
On Mon, Jan 16, 2023 at 02:55:03PM +0200, Peter Ujfalusi wrote:
Mark: can these be picked for 6.2?
Well, patch 2 doesn't apply so not right now...
oh. Let me see what is missing.
It is the topology ops optionality stuff. It is in itself a trivial (for my eyes) conflict, but it is a conflict never the less.
This is not going to backport cleanly to stable either.
What would be the preferred way to handle this (for next, for 6.2 and for 6.1.x)?
Applying: ASoC: SOF: sof-audio: Unprepare when swidget->use_count > 0 Using index info to reconstruct a base tree... M sound/soc/sof/sof-audio.c Falling back to patching base and 3-way merge... Auto-merging sound/soc/sof/sof-audio.c Applying: ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL Using index info to reconstruct a base tree... M sound/soc/sof/sof-audio.c Falling back to patching base and 3-way merge... Auto-merging sound/soc/sof/sof-audio.c CONFLICT (content): Merge conflict in sound/soc/sof/sof-audio.c
On Tue, Jan 17, 2023 at 04:05:18PM +0200, Péter Ujfalusi wrote:
It is the topology ops optionality stuff. It is in itself a trivial (for my eyes) conflict, but it is a conflict never the less.
This is not going to backport cleanly to stable either.
What would be the preferred way to handle this (for next, for 6.2 and for 6.1.x)?
Can you send me a version that applies against for-6.2, if it doesn't backport to stable you can send an explicit backport patch once that becomes an issue. I'm much happier resolving a merge between 6.2 and 6.3 than on initial application.
On 17/01/2023 16:18, Mark Brown wrote:
On Tue, Jan 17, 2023 at 04:05:18PM +0200, Péter Ujfalusi wrote:
It is the topology ops optionality stuff. It is in itself a trivial (for my eyes) conflict, but it is a conflict never the less.
This is not going to backport cleanly to stable either.
What would be the preferred way to handle this (for next, for 6.2 and for 6.1.x)?
Can you send me a version that applies against for-6.2, if it doesn't backport to stable you can send an explicit backport patch once that becomes an issue. I'm much happier resolving a merge between 6.2 and 6.3 than on initial application.
Sure, just to be sure: v3 which is against 6.2-rc, right?
I can assist you in case of a conflict.
On Mon, 16 Jan 2023 14:55:03 +0200, Peter Ujfalusi wrote:
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.
[...]
Applied to
broonie/sound.git for-next
Thanks!
[1/3] ASoC: SOF: sof-audio: Unprepare when swidget->use_count > 0 (no commit info) [2/3] ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL commit: 0ad84b11f2f8dd19d62d0b2ffd95ece897e6c3dc [3/3] ASoC: SOF: sof-audio: keep prepare/unprepare widgets in sink path (no commit info)
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 (3)
-
AngeloGioacchino Del Regno
-
Mark Brown
-
Peter Ujfalusi