Skip to content

Commit bacd861

Browse files
khfengtiwai
authored andcommitted
ALSA: hda: Allow HDA to be runtime suspended when dGPU is not bound to a driver
Nvidia proprietary driver doesn't support runtime power management, so when a user only wants to use the integrated GPU, it's a common practice to let dGPU not to bind any driver, and let its upstream port to be runtime suspended. At the end of runtime suspension the port uses platform power management to disable power through _OFF method of power resource, which is listed by _PR3. After commit b516ea5 ("PCI: Enable NVIDIA HDA controllers"), when the dGPU comes with an HDA function, the HDA won't be suspended if the dGPU is unbound, so the power resource can't be turned off by its upstream port driver. Commit 37a3a98 ("ALSA: hda - Enable runtime PM only for discrete GPU") only allows HDA to be runtime suspended once GPU is bound, to keep APU's HDA working. However, HDA on dGPU isn't that useful if dGPU is not bound to any driver. So let's relax the runtime suspend requirement for dGPU's HDA function, to disable the power source to save lots of power. BugLink: https://bugs.launchpad.net/bugs/1840835 Fixes: b516ea5 ("PCI: Enable NVIDIA HDA controllers") Signed-off-by: Kai-Heng Feng <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 52525b7 commit bacd861

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sound/pci/hda/hda_intel.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1280,11 +1280,17 @@ static void init_vga_switcheroo(struct azx *chip)
12801280
{
12811281
struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
12821282
struct pci_dev *p = get_bound_vga(chip->pci);
1283+
struct pci_dev *parent;
12831284
if (p) {
12841285
dev_info(chip->card->dev,
12851286
"Handle vga_switcheroo audio client\n");
12861287
hda->use_vga_switcheroo = 1;
1287-
chip->bus.keep_power = 1; /* cleared in either gpu_bound op or codec probe */
1288+
1289+
/* cleared in either gpu_bound op or codec probe, or when its
1290+
* upstream port has _PR3 (i.e. dGPU).
1291+
*/
1292+
parent = pci_upstream_bridge(p);
1293+
chip->bus.keep_power = parent ? !pci_pr3_present(parent) : 1;
12881294
chip->driver_caps |= AZX_DCAPS_PM_RUNTIME;
12891295
pci_dev_put(p);
12901296
}

0 commit comments

Comments
 (0)