Skip to contentSkip to conversation

ALSA: hda: Fix hang during shutdown due to link reset

PATCH Applied Imre Deak 2 participants 2 messages Aug 16, 2021 – Aug 17, 2021 Sound

lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 ALSA: hda: Fix hang during shutdown due to link reset

During system shutdown codecs may be still active, and resetting the controller->codec HW link in this state - based on the bug reporter's tests - leads to the shutdown sequence to get stuck. This happens at least on the reporter's KBL system with an ALC662 codec.

For now fix the issue by skipping the link reset step.

Fixes 472e18f63c42 ("ALSA: hda: Release controller display power during shutdown/reboot")

References: https://bugzilla.kernel.org/show_bug.cgi?id=214045
References: https://gitlab.freedesktop.org/drm/intel/-/issues/3618#note_1024665

Reported-and-tested-by [email protected]
Cc Takashi Iwai <[email protected]>
---
 sound/pci/hda/hda_intel.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
sound/pci/hda/hda_intel.c +9 -3
index 0322b289505e7..0062c18b646af 100644
@@ -883,10 +883,11 @@ static unsigned int azx_get_pos_skl(struct azx *chip, struct azx_dev *azx_dev)
 	return azx_get_pos_posbuf(chip, azx_dev);
 }
 
-static void azx_shutdown_chip(struct azx *chip)
+static void __azx_shutdown_chip(struct azx *chip, bool skip_link_reset)
 {
 	azx_stop_chip(chip);
-	azx_enter_link_reset(chip);
+	if (!skip_link_reset)
+		azx_enter_link_reset(chip);
 	azx_clear_irq_pending(chip);
 	display_power(chip, false);
 }
@@ -895,6 +896,11 @@ static void azx_shutdown_chip(struct azx *chip)
 static DEFINE_MUTEX(card_list_lock);
 static LIST_HEAD(card_list);
 
+static void azx_shutdown_chip(struct azx *chip)
+{
+	__azx_shutdown_chip(chip, false);
+}
+
 static void azx_add_card_list(struct azx *chip)
 {
 	struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
@@ -2385,7 +2391,7 @@ static void azx_shutdown(struct pci_dev *pci)
 		return;
 	chip = card->private_data;
 	if (chip && chip->running)
-		azx_shutdown_chip(chip);
+		__azx_shutdown_chip(chip, true);
 }
 
 /* PCI IDs */
Signature · 1 line
2.27.0
Applied
#1 lore raw
Quoted 8 lines · Imre Deak

During system shutdown codecs may be still active, and resetting the controller->codec HW link in this state - based on the bug reporter's tests - leads to the shutdown sequence to get stuck. This happens at least on the reporter's KBL system with an ALC662 codec.

For now fix the issue by skipping the link reset step.

Quoted 7 lines
Fixes 472e18f63c42 ("ALSA: hda: Release controller display power during shutdown/reboot")

References: https://bugzilla.kernel.org/show_bug.cgi?id=214045
References: https://gitlab.freedesktop.org/drm/intel/-/issues/3618#note_1024665

Reported-and-tested-by [email protected]
Cc Takashi Iwai <[email protected]>

Thanks, applied now.

Takashi