Skip to content

Commit 38c4090

Browse files
ujfalusiranj063
authored andcommitted
fixup! ASoC: SOF: pcm: Split up widget prepare and setup
The patch splits up the prepare and setup, it also needs to split up the flag to track the prepare and setup. Closes: #5321 Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent d8eeac1 commit 38c4090

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

sound/soc/sof/sof-audio.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,8 +736,8 @@ int sof_widget_list_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm,
736736
struct snd_soc_dapm_widget *widget;
737737
int i, ret;
738738

739-
/* nothing to set up */
740-
if (!list)
739+
/* nothing to set up or setup has been already done */
740+
if (!list || spcm->setup_done[dir])
741741
return 0;
742742

743743
/* Set up is used to send the IPC to the DSP to create the widget */
@@ -794,6 +794,8 @@ int sof_widget_list_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm,
794794
}
795795
}
796796

797+
spcm->setup_done[dir] = true;
798+
797799
return 0;
798800

799801
widget_free:
@@ -811,12 +813,13 @@ int sof_widget_list_free(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm, int
811813
int ret;
812814

813815
/* nothing to free */
814-
if (!list)
816+
if (!list || !spcm->setup_done[dir])
815817
return 0;
816818

817819
/* send IPC to free widget in the DSP */
818820
ret = sof_walk_widgets_in_order(sdev, spcm, NULL, NULL, dir, SOF_WIDGET_FREE);
819821

822+
spcm->setup_done[dir] = false;
820823
pipeline_list->count = 0;
821824

822825
return ret;

sound/soc/sof/sof-audio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ struct snd_sof_pcm {
356356
struct snd_pcm_hw_params params[2];
357357
struct snd_sof_platform_stream_params platform_params[2];
358358
bool prepared[2]; /* PCM_PARAMS set successfully */
359+
bool setup_done[2]; /* the setup of the SOF PCM device is done */
359360
bool pending_stop[2]; /* only used if (!pcm_ops->platform_stop_during_hw_free) */
360361

361362
/* Must be last - ends in a flex-array member. */

0 commit comments

Comments
 (0)