Skip to content

Commit 97ae1d5

Browse files
gentoo-rootgregkh
authored andcommitted
ALSA: hda: intel: Fix Optimus when GPU has no sound
[ Upstream commit 2b360ba ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 25490b4 commit 97ae1d5

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

sound/pci/hda/hda_intel.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,8 +1360,21 @@ static void azx_free(struct azx *chip)
13601360
if (use_vga_switcheroo(hda)) {
13611361
if (chip->disabled && hda->probe_continued)
13621362
snd_hda_unlock_devices(&chip->bus);
1363-
if (hda->vga_switcheroo_registered)
1363+
if (hda->vga_switcheroo_registered) {
13641364
vga_switcheroo_unregister_client(chip->pci);
1365+
1366+
/* Some GPUs don't have sound, and azx_first_init fails,
1367+
* leaving the device probed but non-functional. As long
1368+
* as it's probed, the PCI subsystem keeps its runtime
1369+
* PM status as active. Force it to suspended (as we
1370+
* actually stop the chip) to allow GPU to suspend via
1371+
* vga_switcheroo, and print a warning.
1372+
*/
1373+
dev_warn(&pci->dev, "GPU sound probed, but not operational: please add a quirk to driver_denylist\n");
1374+
pm_runtime_disable(&pci->dev);
1375+
pm_runtime_set_suspended(&pci->dev);
1376+
pm_runtime_enable(&pci->dev);
1377+
}
13651378
}
13661379

13671380
if (bus->chip_init) {

0 commit comments

Comments
 (0)