Skip to content

Commit e8bc287

Browse files
RanderWangplbossart
authored andcommitted
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. Signed-off-by: Rander Wang <rander.wang@intel.com>
1 parent 25bcc05 commit e8bc287

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

sound/soc/sof/sof-audio.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,16 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg
270270
struct snd_sof_widget *swidget = widget->dobj.private;
271271
struct snd_soc_dapm_path *p;
272272

273-
if (!widget_ops[widget->id].ipc_unprepare || !swidget->prepared)
274-
goto sink_unprepare;
273+
/* it is already unprepared */
274+
if (!swidget->prepared)
275+
return;
276+
277+
if (widget_ops[widget->id].ipc_unprepare)
278+
/* unprepare the source widget */
279+
widget_ops[widget->id].ipc_unprepare(swidget);
275280

276-
/* unprepare the source widget */
277-
widget_ops[widget->id].ipc_unprepare(swidget);
278281
swidget->prepared = false;
279282

280-
sink_unprepare:
281283
/* unprepare all widgets in the sink paths */
282284
snd_soc_dapm_widget_for_each_sink_path(widget, p) {
283285
if (!p->walking && p->sink->dobj.private) {

0 commit comments

Comments
 (0)