* [PATCH 0/3] ASoC: SOF: sof-audio: Fixes for widget prepare and unprepare
@ 2023-01-13 16:18 Peter Ujfalusi
2023-01-13 16:18 ` [PATCH 1/3] ASoC: SOF: sof-audio: Unprepare when swidget->use_count > 0 Peter Ujfalusi
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2023-01-13 16:18 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: alsa-devel, kai.vehmanen, pierre-louis.bossart, rander.wang,
ranjani.sridharan, yung-chuan.liao, angelogioacchino.delregno
Hi,
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.
I think these can be sent selectively to stable kernels with appropriate
adjustments to apply.
I was not comfortable to add Fixes or Complements tags since the last patch for
sure going to conflict in some stable variants.
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(-)
--
2.39.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] ASoC: SOF: sof-audio: Unprepare when swidget->use_count > 0
2023-01-13 16:18 [PATCH 0/3] ASoC: SOF: sof-audio: Fixes for widget prepare and unprepare Peter Ujfalusi
@ 2023-01-13 16:18 ` Peter Ujfalusi
2023-01-13 16:18 ` [PATCH 2/3] ASoC: SOF: sof-audio: keep prepare/unprepare widgets in sink path Peter Ujfalusi
2023-01-13 16:18 ` [PATCH 3/3] ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL Peter Ujfalusi
2 siblings, 0 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2023-01-13 16:18 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: alsa-devel, kai.vehmanen, pierre-louis.bossart, rander.wang,
ranjani.sridharan, yung-chuan.liao, angelogioacchino.delregno
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")
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;
--
2.39.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] ASoC: SOF: sof-audio: keep prepare/unprepare widgets in sink path
2023-01-13 16:18 [PATCH 0/3] ASoC: SOF: sof-audio: Fixes for widget prepare and unprepare Peter Ujfalusi
2023-01-13 16:18 ` [PATCH 1/3] ASoC: SOF: sof-audio: Unprepare when swidget->use_count > 0 Peter Ujfalusi
@ 2023-01-13 16:18 ` Peter Ujfalusi
2023-01-13 16:18 ` [PATCH 3/3] ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL Peter Ujfalusi
2 siblings, 0 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2023-01-13 16:18 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: alsa-devel, kai.vehmanen, pierre-louis.bossart, rander.wang,
ranjani.sridharan, yung-chuan.liao, angelogioacchino.delregno
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.
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 068501ed7951..721de96fdb83 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->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) {
--
2.39.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL
2023-01-13 16:18 [PATCH 0/3] ASoC: SOF: sof-audio: Fixes for widget prepare and unprepare Peter Ujfalusi
2023-01-13 16:18 ` [PATCH 1/3] ASoC: SOF: sof-audio: Unprepare when swidget->use_count > 0 Peter Ujfalusi
2023-01-13 16:18 ` [PATCH 2/3] ASoC: SOF: sof-audio: keep prepare/unprepare widgets in sink path Peter Ujfalusi
@ 2023-01-13 16:18 ` Peter Ujfalusi
2023-01-16 9:22 ` AngeloGioacchino Del Regno
2 siblings, 1 reply; 5+ messages in thread
From: Peter Ujfalusi @ 2023-01-13 16:18 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: alsa-devel, kai.vehmanen, pierre-louis.bossart, rander.wang,
ranjani.sridharan, yung-chuan.liao, angelogioacchino.delregno
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.
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 721de96fdb83..5c878788dedb 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;
/* skip 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)
goto sink_unprepare;
widget_ops = tplg_ops ? tplg_ops->widget : NULL;
@@ -311,7 +311,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 */
--
2.39.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 3/3] ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL
2023-01-13 16:18 ` [PATCH 3/3] ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL Peter Ujfalusi
@ 2023-01-16 9:22 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 5+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-01-16 9:22 UTC (permalink / raw)
To: Peter Ujfalusi, lgirdwood, broonie
Cc: alsa-devel, kai.vehmanen, pierre-louis.bossart, rander.wang,
ranjani.sridharan, yung-chuan.liao
Il 13/01/23 17:18, 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.
>
> 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>
I asked you to add a Fixes tag to this commit before you pushed it.
Please add a Fixes tag.
Regards,
Angelo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-16 9:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-13 16:18 [PATCH 0/3] ASoC: SOF: sof-audio: Fixes for widget prepare and unprepare Peter Ujfalusi
2023-01-13 16:18 ` [PATCH 1/3] ASoC: SOF: sof-audio: Unprepare when swidget->use_count > 0 Peter Ujfalusi
2023-01-13 16:18 ` [PATCH 2/3] ASoC: SOF: sof-audio: keep prepare/unprepare widgets in sink path Peter Ujfalusi
2023-01-13 16:18 ` [PATCH 3/3] ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL Peter Ujfalusi
2023-01-16 9:22 ` AngeloGioacchino Del Regno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox