diff options
author | Rander Wang <rander.wang@intel.com> | 2022-09-20 17:01:06 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-09-20 19:07:33 +0100 |
commit | ce59804d26432d7e2c1a8c906245a230a2b4505c (patch) | |
tree | 03102a8d50463aceea7b16abc915951f41f55fee /sound/soc/sof/sof-audio.c | |
parent | 9f27530a7357c69865da6177db02d3eb230c33a1 (diff) | |
download | linux-stable-ce59804d26432d7e2c1a8c906245a230a2b4505c.tar.gz linux-stable-ce59804d26432d7e2c1a8c906245a230a2b4505c.tar.bz2 linux-stable-ce59804d26432d7e2c1a8c906245a230a2b4505c.zip |
ASoC: SOF: clear prepare state when widget is unprepared
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>
Link: https://lore.kernel.org/r/20220920150107.2090695-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/sof-audio.c')
-rw-r--r-- | sound/soc/sof/sof-audio.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index a3d3dd7a0037..71cea83889fb 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) { |