Skip to content

Commit d3ac31f

Browse files
Lekensteynalexdeucher
authored andcommitted
drm/radeon: fix power state when port pm is unavailable (v2)
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. v2: agd: fix typo Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98505 Signed-off-by: Peter Wu <peter@lekensteyn.nl> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: <stable@vger.kernel.org> # 4.8+ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 1db4496 commit d3ac31f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/gpu/drm/radeon/radeon_atpx_handler.c

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

3535
static struct radeon_atpx_priv {
3636
bool atpx_detected;
37+
bool bridge_pm_usable;
3738
/* handle for device - and atpx */
3839
acpi_handle dhandle;
3940
struct radeon_atpx atpx;
@@ -203,7 +204,11 @@ static int radeon_atpx_validate(struct radeon_atpx *atpx)
203204
atpx->is_hybrid = false;
204205
if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
205206
printk("ATPX Hybrid Graphics\n");
206-
atpx->functions.power_cntl = false;
207+
/*
208+
* Disable legacy PM methods only when pcie port PM is usable,
209+
* otherwise the device might fail to power off or power on.
210+
*/
211+
atpx->functions.power_cntl = !radeon_atpx_priv.bridge_pm_usable;
207212
atpx->is_hybrid = true;
208213
}
209214

@@ -474,6 +479,7 @@ static int radeon_atpx_power_state(enum vga_switcheroo_client_id id,
474479
*/
475480
static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
476481
{
482+
struct pci_dev *parent_pdev = pci_upstream_bridge(pdev);
477483
acpi_handle dhandle, atpx_handle;
478484
acpi_status status;
479485

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

488494
radeon_atpx_priv.dhandle = dhandle;
489495
radeon_atpx_priv.atpx.handle = atpx_handle;
496+
radeon_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3;
490497
return true;
491498
}
492499

0 commit comments

Comments
 (0)