[PATCH 0/2] ASoC: SOF: sof-audio: fix prepare/unprepare
2 patches from Rander required to enable mixing usages with multiple pipelines.
Rander Wang (2): ASoC: SOF: clear prepare state when widget is unprepared ASoC: SOF: don't unprepare widget used other pipelines
sound/soc/sof/sof-audio.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
From: Rander Wang rander.wang@intel.com
Playback can't work after the first try sometimes. The reason is that some widgets don't have ipc_unprepare ops and driver will jump to sink_prepare so miss to set prepare state to false. Next time these widgets will not be prepared and it will result to error with different format of audio file since the last setting is not applicable.
This patch makes sure that widget prepare state will be cleared to false when it is unprepared.
Reviewed-by: Bard Liao yung-chuan.liao@linux.intel.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Signed-off-by: Rander Wang rander.wang@intel.com Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com --- sound/soc/sof/sof-audio.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index a3d3dd7a00375..71cea83889fb0 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; + /* it is already unprepared */ + if (!swidget->prepared) + 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) {
From: Rander Wang rander.wang@intel.com
If multiple pipeline are mixed into one, we can't unprepare the widget used by other pipelines. This patch checks use_count to address this case.
Reviewed-by: Bard Liao yung-chuan.liao@linux.intel.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Signed-off-by: Rander Wang rander.wang@intel.com Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@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 71cea83889fb0..62092e2d609c7 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -271,8 +271,8 @@ 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;
- /* it is already unprepared */ - if (!swidget->prepared) + /* 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)
On Tue, 20 Sep 2022 17:01:05 +0200, Pierre-Louis Bossart wrote:
2 patches from Rander required to enable mixing usages with multiple pipelines.
Rander Wang (2): ASoC: SOF: clear prepare state when widget is unprepared ASoC: SOF: don't unprepare widget used other pipelines
[...]
Applied to
broonie/sound.git for-next
Thanks!
[1/2] ASoC: SOF: clear prepare state when widget is unprepared commit: ce59804d26432d7e2c1a8c906245a230a2b4505c [2/2] ASoC: SOF: don't unprepare widget used other pipelines commit: 9862dcf70245c2d03764012b81966d8c2ea95a48
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
-
Pierre-Louis Bossart