Skip to content

Commit bcfdd5d

Browse files
committed
drm/radeon: fix check for port PM availability
The ATPX method does not always exist on the dGPU, it may be located at the iGPU. The parent device of the iGPU is the root port for which bridge_d3 is false. This accidentally enables the legacy PM method which conflicts with port PM and prevented the dGPU from powering on. Ported from amdgpu commit: drm/amdgpu: fix check for port PM availability from Peter Wu. Fixes: d3ac31f (drm/radeon: fix power state when port pm is unavailable (v2)) Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: Peter Wu <peter@lekensteyn.nl> Cc: <stable@vger.kernel.org> # 4.8+
1 parent 7ac33e4 commit bcfdd5d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/gpu/drm/radeon/radeon_atpx_handler.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,6 @@ static int radeon_atpx_power_state(enum vga_switcheroo_client_id id,
479479
*/
480480
static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
481481
{
482-
struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
483482
acpi_handle dhandle, atpx_handle;
484483
acpi_status status;
485484

@@ -493,7 +492,6 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
493492

494493
radeon_atpx_priv.dhandle = dhandle;
495494
radeon_atpx_priv.atpx.handle = atpx_handle;
496-
radeon_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
497495
return true;
498496
}
499497

@@ -555,25 +553,34 @@ static bool radeon_atpx_detect(void)
555553
struct pci_dev *pdev = NULL;
556554
bool has_atpx = false;
557555
int vga_count = 0;
556+
bool d3_supported = false;
557+
struct pci_dev *parent_pdev;
558558

559559
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
560560
vga_count++;
561561

562562
has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
563+
564+
parent_pdev = pci_upstream_bridge(pdev);
565+
d3_supported |= parent_pdev && parent_pdev->bridge_d3;
563566
}
564567

565568
/* some newer PX laptops mark the dGPU as a non-VGA display device */
566569
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
567570
vga_count++;
568571

569572
has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true);
573+
574+
parent_pdev = pci_upstream_bridge(pdev);
575+
d3_supported |= parent_pdev && parent_pdev->bridge_d3;
570576
}
571577

572578
if (has_atpx && vga_count == 2) {
573579
acpi_get_name(radeon_atpx_priv.atpx.handle, ACPI_FULL_PATHNAME, &buffer);
574580
printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n",
575581
acpi_method_name);
576582
radeon_atpx_priv.atpx_detected = true;
583+
radeon_atpx_priv.bridge_pm_usable = d3_supported;
577584
radeon_atpx_init();
578585
return true;
579586
}

0 commit comments

Comments
 (0)