Skip to content

Commit

Permalink
ALSA: hda: intel: Fix Optimus when GPU has no sound
Browse files Browse the repository at this point in the history
quirk_nvidia_hda() forcefully enables HDA controller on all NVIDIA GPUs,
because some buggy BIOSes leave it disabled. However, some dual-GPU
laptops do not have a functional HDA controller in DGPU, and BIOS
disables it on purpose. After quirk_nvidia_hda() reenables this dummy
HDA controller, attempting to probe it fails at azx_first_init(), which
is too late to cancel the probe, as it happens in azx_probe_continue().

The sna_hda_intel driver calls azx_free() and stops the chip, however,
it stays probed, and from the runtime PM point of view, the device
remains active (it was set as active by the PCI subsystem on probe). It
prevents vga_switcheroo from turning off the DGPU, because
pci_create_device_link() syncs power management for video and audio
devices.

Affected devices should be added to driver_denylist to prevent them from
probing early. This patch helps identify such devices by printing a
warning, and also forces the device to the suspended state to allow
vga_switcheroo turn off DGPU.

Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
Link: https://patch.msgid.link/20250208214602.39607-2-maxtram95@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Maxim Mikityanskiy authored and Takashi Iwai committed Feb 10, 2025
1 parent de7d2a7 commit 2b360ba
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1352,8 +1352,21 @@ static void azx_free(struct azx *chip)
if (use_vga_switcheroo(hda)) {
if (chip->disabled && hda->probe_continued)
snd_hda_unlock_devices(&chip->bus);
if (hda->vga_switcheroo_registered)
if (hda->vga_switcheroo_registered) {
vga_switcheroo_unregister_client(chip->pci);

/* Some GPUs don't have sound, and azx_first_init fails,
* leaving the device probed but non-functional. As long
* as it's probed, the PCI subsystem keeps its runtime
* PM status as active. Force it to suspended (as we
* actually stop the chip) to allow GPU to suspend via
* vga_switcheroo, and print a warning.
*/
dev_warn(&pci->dev, "GPU sound probed, but not operational: please add a quirk to driver_denylist\n");
pm_runtime_disable(&pci->dev);
pm_runtime_set_suspended(&pci->dev);
pm_runtime_enable(&pci->dev);
}
}

if (bus->chip_init) {
Expand Down

0 comments on commit 2b360ba

Please sign in to comment.