diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c index 02ca5dd978f6..6c343a933182 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | |||
@@ -485,7 +485,6 @@ static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id, | |||
485 | */ | 485 | */ |
486 | static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev) | 486 | static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev) |
487 | { | 487 | { |
488 | struct pci_dev *parent_pdev = pci_upstream_bridge(pdev); | ||
489 | acpi_handle dhandle, atpx_handle; | 488 | acpi_handle dhandle, atpx_handle; |
490 | acpi_status status; | 489 | acpi_status status; |
491 | 490 | ||
@@ -500,7 +499,6 @@ static bool amdgpu_atpx_pci_probe_handle(struct pci_dev *pdev) | |||
500 | } | 499 | } |
501 | amdgpu_atpx_priv.dhandle = dhandle; | 500 | amdgpu_atpx_priv.dhandle = dhandle; |
502 | amdgpu_atpx_priv.atpx.handle = atpx_handle; | 501 | amdgpu_atpx_priv.atpx.handle = atpx_handle; |
503 | amdgpu_atpx_priv.bridge_pm_usable = parent_pdev && parent_pdev->bridge_d3; | ||
504 | return true; | 502 | return true; |
505 | } | 503 | } |
506 | 504 | ||
@@ -562,17 +560,25 @@ static bool amdgpu_atpx_detect(void) | |||
562 | struct pci_dev *pdev = NULL; | 560 | struct pci_dev *pdev = NULL; |
563 | bool has_atpx = false; | 561 | bool has_atpx = false; |
564 | int vga_count = 0; | 562 | int vga_count = 0; |
563 | bool d3_supported = false; | ||
564 | struct pci_dev *parent_pdev; | ||
565 | 565 | ||
566 | while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { | 566 | while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { |
567 | vga_count++; | 567 | vga_count++; |
568 | 568 | ||
569 | has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true); | 569 | 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; | ||
570 | } | 573 | } |
571 | 574 | ||
572 | while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) { | 575 | while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) { |
573 | vga_count++; | 576 | vga_count++; |
574 | 577 | ||
575 | has_atpx |= (amdgpu_atpx_pci_probe_handle(pdev) == true); | 578 | 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; | ||
576 | } | 582 | } |
577 | 583 | ||
578 | if (has_atpx && vga_count == 2) { | 584 | if (has_atpx && vga_count == 2) { |
@@ -580,6 +586,7 @@ static bool amdgpu_atpx_detect(void) | |||
580 | printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n", | 586 | printk(KERN_INFO "vga_switcheroo: detected switching method %s handle\n", |
581 | acpi_method_name); | 587 | acpi_method_name); |
582 | amdgpu_atpx_priv.atpx_detected = true; | 588 | amdgpu_atpx_priv.atpx_detected = true; |
589 | amdgpu_atpx_priv.bridge_pm_usable = d3_supported; | ||
583 | amdgpu_atpx_init(); | 590 | amdgpu_atpx_init(); |
584 | return true; | 591 | return true; |
585 | } | 592 | } |