This is a note to let you know that I've just added the patch titled ASoC: SOF: free widgets in sof_tear_down_pipelines() for static pipelines to the 5.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: asoc-sof-free-widgets-in-sof_tear_down_pipelines-for-static-pipelines.patch and it can be found in the queue-5.16 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From b2ebcf42a48f4560862bb811f3268767d17ebdcd Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx> Date: Fri, 19 Nov 2021 21:26:18 +0200 Subject: ASoC: SOF: free widgets in sof_tear_down_pipelines() for static pipelines From: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx> commit b2ebcf42a48f4560862bb811f3268767d17ebdcd upstream. Free widgets for static pipelines in sof_tear_down_pipelines(). But this feature is unavailable in older firmware with ABI < 3.19. Just reset widget use_count's for this case. This would ensure that the secondary cores enabled required for topology setup are powered down properly before the primary core is powered off during system suspend. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@xxxxxxxxxxxxxxx> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx> Signed-off-by: Kai Vehmanen <kai.vehmanen@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20211119192621.4096077-8-kai.vehmanen@xxxxxxxxxxxxxxx Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- sound/soc/sof/sof-audio.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -665,11 +665,12 @@ int sof_set_up_pipelines(struct snd_sof_ } /* - * This function doesn't free widgets during suspend. It only resets the set up status for all - * routes and use_count for all widgets. + * For older firmware, this function doesn't free widgets for static pipelines during suspend. + * It only resets use_count for all widgets. */ int sof_tear_down_pipelines(struct snd_sof_dev *sdev, bool verify) { + struct sof_ipc_fw_version *v = &sdev->fw_ready.version; struct snd_sof_widget *swidget; struct snd_sof_route *sroute; int ret; @@ -681,8 +682,14 @@ int sof_tear_down_pipelines(struct snd_s * loading the sound card unavailable to open PCMs. */ list_for_each_entry_reverse(swidget, &sdev->widget_list, list) { - if (!verify) { + if (swidget->dynamic_pipeline_widget) + continue; + + /* Do not free widgets for static pipelines with FW ABI older than 3.19 */ + if (!verify && !swidget->dynamic_pipeline_widget && + v->abi_version < SOF_ABI_VER(3, 19, 0)) { swidget->use_count = 0; + swidget->complete = 0; continue; } Patches currently in stable-queue which might be from ranjani.sridharan@xxxxxxxxxxxxxxx are queue-5.16/asoc-sof-sof-audio-setup-sched-widgets-during-pipeline-complete-step.patch queue-5.16/asoc-sof-intel-hda-add-quirks-for-hdaudio-dma-positi.patch queue-5.16/asoc-sof-free-widgets-in-sof_tear_down_pipelines-for-static-pipelines.patch queue-5.16/asoc-intel-sof_sdw-fix-jack-detection-on-hp-spectre-.patch queue-5.16/asoc-sof-handle-paused-streams-during-system-suspend.patch queue-5.16/asoc-sof-ipc-add-null-pointer-check-for-substream-ru.patch queue-5.16/asoc-sof-topology-remove-sof_load_pipeline_ipc.patch