Skip to content

Commit 7ac33e4

Browse files
Lekensteynalexdeucher
authored andcommitted
drm/amdgpu: 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. Fixes: 1db4496 ("drm/amdgpu: fix power state when port pm is unavailable") Reported-and-tested-by: Mike Lothian <mike@fireburn.co.uk> Signed-off-by: Peter Wu <peter@lekensteyn.nl> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: <stable@vger.kernel.org> # 4.8+
1 parent b64268d commit 7ac33e4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id,
485485
*/
486486
static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
487487
{
488-
struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
489488
acpi_handle dhandle, atpx_handle;
490489
acpi_status status;
491490

@@ -500,7 +499,6 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
500499
}
501500
amdgpu_atpx_priv.dhandle = dhandle;
502501
amdgpu_atpx_priv.atpx.handle = atpx_handle;
503-
amdgpu_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
504502
return true;
505503
}
506504

@@ -562,24 +560,33 @@ static bool amdgpu_atpx_detect(void)
562560
struct pci_dev *pdev = NULL;
563561
bool has_atpx = false;
564562
int vga_count = 0;
563+
bool d3_supported = false;
564+
struct pci_dev *parent_pdev;
565565

566566
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
567567
vga_count++;
568568

569569
has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);
570+
571+
parent_pdev = pci_upstream_bridge(pdev);
572+
d3_supported |= parent_pdev && parent_pdev->bridge_d3;
570573
}
571574

572575
while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) {
573576
vga_count++;
574577

575578
has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true);
579+
580+
parent_pdev = pci_upstream_bridge(pdev);
581+
d3_supported |= parent_pdev && parent_pdev->bridge_d3;
576582
}
577583

578584
if (has_atpx && vga_count == 2) {
579585
acpi_get_name(amdgpu_atpx_priv.atpx.handle, ACPI_FULL_PATHNAME, &buffer);
580586
printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n",
581587
acpi_method_name);
582588
amdgpu_atpx_priv.atpx_detected = true;
589+
amdgpu_atpx_priv.bridge_pm_usable = d3_supported;
583590
amdgpu_atpx_init();
584591
return true;
585592
}

0 commit comments

Comments
 (0)