Skip to content

Commit c0c4249

Browse files
committed
Merge branch 'drm-fixes-4.9' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
Regression fixes for PX and a powerplay fix. * 'drm-fixes-4.9' of git://people.freedesktop.org/~agd5f/linux: drm/radeon: fix check for port PM availability drm/amdgpu: fix check for port PM availability drm/amd/powerplay: initialize the soft_regs offset in struct smu7_hwmgr
2 parents e5517c2 + bcfdd5d commit c0c4249

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
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
}

drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2214,6 +2214,7 @@ uint32_t polaris10_get_mac_definition(uint32_t value)
22142214
int polaris10_process_firmware_header(struct pp_hwmgr *hwmgr)
22152215
{
22162216
struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smumgr->backend);
2217+
struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
22172218
uint32_t tmp;
22182219
int result;
22192220
bool error = false;
@@ -2233,8 +2234,10 @@ int polaris10_process_firmware_header(struct pp_hwmgr *hwmgr)
22332234
offsetof(SMU74_Firmware_Header, SoftRegisters),
22342235
&tmp, SMC_RAM_END);
22352236

2236-
if (!result)
2237+
if (!result) {
2238+
data->soft_regs_start = tmp;
22372239
smu_data->smu7_data.soft_regs_start = tmp;
2240+
}
22382241

22392242
error |= (0 != result);
22402243

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)