Skip to content

Commit 1db4496

Browse files
Lekensteynalexdeucher
authored andcommitted
drm/amdgpu: fix power state when port pm is unavailable
When PCIe port PM is not enabled (system BIOS is pre-2015 or the pcie_port_pm=off parameter is set), legacy ATPX PM should still be marked as supported. Otherwise the GPU can fail to power on after runtime suspend. This affected a Dell Inspiron 5548. Ideally the BIOS date in the PCI core is lowered to 2013 (the first year where hybrid graphics platforms using power resources was introduced), but that seems more risky at this point and would not solve the pcie_port_pm=off issue. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505 Reported-and-tested-by: Nayan Deshmukh <nayan26deshmukh@gmail.com> Signed-off-by: Peter Wu <peter@lekensteyn.nl> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: <stable@vger.kernel.org> # 4.8+ Acked-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
1 parent da7800a commit 1db4496

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct amdgpu_atpx {
3434

3535
static struct amdgpu_atpx_priv {
3636
bool atpx_detected;
37+
bool bridge_pm_usable;
3738
/* handle for device - and atpx */
3839
acpi_handle dhandle;
3940
acpi_handle other_handle;
@@ -205,7 +206,11 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
205206
atpx->is_hybrid = false;
206207
if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
207208
printk("ATPX Hybrid Graphics\n");
208-
atpx->functions.power_cntl = false;
209+
/*
210+
* Disable legacy PM methods only when pcie port PM is usable,
211+
* otherwise the device might fail to power off or power on.
212+
*/
213+
atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable;
209214
atpx->is_hybrid = true;
210215
}
211216

@@ -480,6 +485,7 @@ static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id,
480485
*/
481486
static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
482487
{
488+
struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
483489
acpi_handle dhandle, atpx_handle;
484490
acpi_status status;
485491

@@ -494,6 +500,7 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev)
494500
}
495501
amdgpu_atpx_priv.dhandle = dhandle;
496502
amdgpu_atpx_priv.atpx.handle = atpx_handle;
503+
amdgpu_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
497504
return true;
498505
}
499506

0 commit comments

Comments
 (0)