Skip to content

Commit 0a0cbf9

Browse files
committed
[SQUASME]ASoC: SOF: pcm: unprepare only during hw_free
do not unprepare widgets during sof_widget_list_free. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent 6cdd1e2 commit 0a0cbf9

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

sound/soc/sof/pcm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ static int sof_pcm_hw_free(struct snd_soc_component *component,
205205

206206
ret = sof_pcm_stream_free(sdev, substream, spcm, substream->stream, true);
207207

208+
/* unprepare and free the list of DAPM widgets */
209+
sof_widget_list_unprepare(sdev, spcm, substream->stream);
210+
208211
cancel_work_sync(&spcm->stream[substream->stream].period_elapsed_work);
209212

210213
return ret;

sound/soc/sof/sof-audio.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,18 @@ int sof_widget_list_prepare(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm,
715715
dir, SOF_WIDGET_PREPARE);
716716
}
717717

718+
void sof_widget_list_unprepare(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm, int dir)
719+
{
720+
struct snd_soc_dapm_widget_list *list = spcm->stream[dir].list;
721+
722+
/* unprepare the widget */
723+
sof_walk_widgets_in_order(sdev, spcm, NULL, NULL, dir, SOF_WIDGET_UNPREPARE);
724+
725+
snd_soc_dapm_dai_free_widgets(&list);
726+
spcm->stream[dir].list = NULL;
727+
}
728+
729+
718730
int sof_widget_list_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm,
719731
struct snd_pcm_hw_params *fe_params,
720732
struct snd_sof_platform_stream_params *platform_params,
@@ -806,12 +818,6 @@ int sof_widget_list_free(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm, int
806818
/* send IPC to free widget in the DSP */
807819
ret = sof_walk_widgets_in_order(sdev, spcm, NULL, NULL, dir, SOF_WIDGET_FREE);
808820

809-
/* unprepare the widget */
810-
sof_walk_widgets_in_order(sdev, spcm, NULL, NULL, dir, SOF_WIDGET_UNPREPARE);
811-
812-
snd_soc_dapm_dai_free_widgets(&list);
813-
spcm->stream[dir].list = NULL;
814-
815821
pipeline_list->count = 0;
816822

817823
return ret;

sound/soc/sof/sof-audio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ int sof_widget_list_prepare(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm,
653653
struct snd_pcm_hw_params *fe_params,
654654
struct snd_sof_platform_stream_params *platform_params,
655655
int dir);
656+
void sof_widget_list_unprepare(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm, int dir);
656657
int sof_widget_list_free(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm, int dir);
657658
int sof_pcm_dsp_pcm_free(struct snd_pcm_substream *substream, struct snd_sof_dev *sdev,
658659
struct snd_sof_pcm *spcm);

0 commit comments

Comments
 (0)