aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sound/soc/sof/sof-audio.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2023-01-18 15:33:51 +0000
committerMark Brown <broonie@kernel.org>2023-01-18 15:33:51 +0000
commit309d401452b96f23abe2572d290c51c548d9f728 (patch)
tree28aae1adcf60a890dcf17c676b241db07bef98c1 /sound/soc/sof/sof-audio.c
parentASoC: samsung: fsd: audio support for FSD SoC (diff)
parentASoC: SOF: sof-audio: Fixes for widget prepare and (diff)
downloadwireguard-linux-309d401452b96f23abe2572d290c51c548d9f728.tar.xz
wireguard-linux-309d401452b96f23abe2572d290c51c548d9f728.zip
ASoC: Merge up 6.2 fixes
To resolve a conflict and support further development.
Diffstat (limited to 'sound/soc/sof/sof-audio.c')
-rw-r--r--sound/soc/sof/sof-audio.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
index e1ab8380e7d8..f17d405a9da9 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 */
- if (!swidget->prepared || swidget->use_count > 1)
- return;
+ /* skip if the widget is in use or if it is already unprepared */
+ if (!swidget || !swidget->prepared || swidget->use_count > 0)
+ 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) {
@@ -310,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 */
@@ -436,11 +437,11 @@ sof_walk_widgets_in_order(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget_l
for_each_dapm_widgets(list, i, widget) {
/* starting widget for playback is AIF type */
- if (dir == SNDRV_PCM_STREAM_PLAYBACK && !WIDGET_IS_AIF(widget->id))
+ if (dir == SNDRV_PCM_STREAM_PLAYBACK && widget->id != snd_soc_dapm_aif_in)
continue;
/* starting widget for capture is DAI type */
- if (dir == SNDRV_PCM_STREAM_CAPTURE && !WIDGET_IS_DAI(widget->id))
+ if (dir == SNDRV_PCM_STREAM_CAPTURE && widget->id != snd_soc_dapm_dai_out)
continue;
switch (op) {