drm/amdgpu: simplify runtime suspend
Subsystems (2)
PATCH 1/1 drm/amdgpu: simplify runtime suspend
In the standard _PR3 case, the pci core handles the pci state. The driver only needs to handle it in the legacy ATPX case.
This may fix issues with runtime suspend/resume on certain hybrid graphics laptops.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 35 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +22 -13
@@ -1227,13 +1227,17 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev) ret =amdgpu_device_suspend (drm_dev, false, false);if (amdgpu_device_supports_boco (drm_dev)) { -pci_save_state (pdev); -pci_disable_device (pdev); -pci_ignore_hotplug (pdev); -if (amdgpu_is_atpx_hybrid ()) +/* Only need to handle PCI state in the driver for ATPX +* PCI core handles it for _PR3. +*/ +if (amdgpu_is_atpx_hybrid ()) { +pci_ignore_hotplug (pdev); + }else { +pci_save_state (pdev); +pci_disable_device (pdev); +pci_ignore_hotplug (pdev);pci_set_power_state (pdev, PCI_D3cold); -else if (!amdgpu_has_atpx_dgpu_power_cntl ()) -pci_set_power_state (pdev, PCI_D3hot); + } drm_dev->switch_power_state =DRM_SWITCH_POWER_DYNAMIC_OFF ; }else if (amdgpu_device_supports_baco (drm_dev)) {amdgpu_device_baco_enter (drm_dev);
@@ -1255,14 +1259,19 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)if (amdgpu_device_supports_boco (drm_dev)) { drm_dev->switch_power_state =DRM_SWITCH_POWER_CHANGING ; -if (amdgpu_is_atpx_hybrid () || - !amdgpu_has_atpx_dgpu_power_cntl ()) +/* Only need to handle PCI state in the driver for ATPX +* PCI core handles it for _PR3. +*/ +if (amdgpu_is_atpx_hybrid ()) { +pci_set_master (pdev); + }else {pci_set_power_state (pdev,PCI_D0 ); -pci_restore_state (pdev); - ret =pci_enable_device (pdev); -if (ret) -return ret; -pci_set_master (pdev); +pci_restore_state (pdev); + ret =pci_enable_device (pdev); +if (ret) +return ret; +pci_set_master (pdev); + } }else if (amdgpu_device_supports_baco (drm_dev)) {amdgpu_device_baco_exit (drm_dev); }
Signature · 6 lines
2.23.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20191120192253.1299713-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Quan, Evan
Acked-by Evan QuanQuoted 82 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Thursday, November 21, 2019 3:23 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: simplify runtime suspendIn the standard
_PR3case, the pci core handles the pci state. The driver only needs to handle it in the legacy ATPX case.This may fix issues with runtime suspend/resume on certain hybrid graphics laptops.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 35 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 13 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +10
-6@@ -1227,13 +1227,17 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev) ret =amdgpu_device_suspend (drm_dev, false, false);if (amdgpu_device_supports_boco (drm_dev)) { -pci_save_state (pdev); -pci_disable_device (pdev); -pci_ignore_hotplug (pdev); -if (amdgpu_is_atpx_hybrid ()) +/* Only need to handle PCI state in the driver for ATPX +* PCI core handles it for _PR3. +*/ +if (amdgpu_is_atpx_hybrid ()) { +pci_ignore_hotplug (pdev); + }else { +pci_save_state (pdev); +pci_disable_device (pdev); +pci_ignore_hotplug (pdev);pci_set_power_state (pdev, PCI_D3cold); -else if (!amdgpu_has_atpx_dgpu_power_cntl ()) -pci_set_power_state (pdev, PCI_D3hot); + } drm_dev->switch_power_state =DRM_SWITCH_POWER_DYNAMIC_OFF ;drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +12
-7}else if (amdgpu_device_supports_baco (drm_dev)) {amdgpu_device_baco_enter (drm_dev);@@ -1255,14 +1259,19 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) if (amdgpu_device_supports_boco(drm_dev)) { drm_dev->switch_power_state =DRM_SWITCH_POWER_CHANGING ; -if (amdgpu_is_atpx_hybrid () || - !amdgpu_has_atpx_dgpu_power_cntl ()) +/* Only need to handle PCI state in the driver for ATPX +* PCI core handles it for _PR3. +*/ +if (amdgpu_is_atpx_hybrid ()) { +pci_set_master (pdev); + }else {pci_set_power_state (pdev,PCI_D0 ); -pci_restore_state (pdev); - ret =pci_enable_device (pdev); -if (ret) -return ret; -pci_set_master (pdev); +pci_restore_state (pdev); + ret =pci_enable_device (pdev); +if (ret) +return ret; +pci_set_master (pdev); + } } else if (amdgpu_device_supports_baco(drm_dev)) {drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-1amdgpu_device_baco_exit (drm_dev); } --2.23.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx