Skip to contentSkip to conversation

ALSA: hda: Disable runtime resume at shutdown

PATCH New Takashi Iwai 1 participant 1 message Aug 26, 2021 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda: Disable runtime resume at shutdown

Although we modified the codec shutdown callback to perform runtime-suspend, it's still not fully effective, as this may be resumed again at any time later.

For fixing such an unwanted resume, this patch replaces pm_runtime_suspend() with pm_runtime_force_suspend(), and call pm_runtime_disable() afterward. It assures to keep the device suspended.

Also for code simplification, we apply the code unconditionally; when it's been already suspended, nothing would happen by calls of snd_pcm_suspend_all() and pm_runtime_force_suspend(), just proceed to pm_runtime_disable().

Fixes b98444ed597d ("ALSA: hda: Suspend codec at shutdown")
---
 sound/pci/hda/hda_codec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
sound/pci/hda/hda_codec.c +2 -4
index 2c91c92c9ab2..a9ebefd60cf6 100644
@@ -2986,13 +2986,11 @@ void snd_hda_codec_shutdown(struct hda_codec *codec)
 {
 	struct hda_pcm *cpcm;
 
-	if (pm_runtime_suspended(hda_codec_dev(codec)))
-		return;
-
 	list_for_each_entry(cpcm, &codec->pcm_list_head, list)
 		snd_pcm_suspend_all(cpcm->pcm);
 
-	pm_runtime_suspend(hda_codec_dev(codec));
+	pm_runtime_force_suspend(hda_codec_dev(codec));
+	pm_runtime_disable(hda_codec_dev(codec));
 }
 
 /*
Signature · 1 line
2.31.1