[PATCH 13/31] drm/{i915,xe}: Consolidate display suspend functions

Rodrigo Vivi rodrigo.vivi at intel.com
Tue Sep 24 20:35:34 UTC 2024


Same sequences are currently executed by i915 and xe during
system suspend. Consolidate them in the intel_display_driver
side.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
 .../gpu/drm/i915/display/intel_display_driver.c   |  9 +++++++++
 drivers/gpu/drm/i915/i915_driver.c                | 12 ------------
 drivers/gpu/drm/xe/display/xe_display.c           | 15 ++-------------
 3 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
index 86d6ebf0c82f..f509ed1503c1 100644
--- a/drivers/gpu/drm/i915/display/intel_display_driver.c
+++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
@@ -670,6 +670,15 @@ int intel_display_driver_suspend(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return 0;
 
+	/* We do a lot of poking in a lot of registers, make sure they work properly. */
+	intel_power_domains_disable(i915);
+
+	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true);
+
+	drm_kms_helper_poll_disable(&i915->drm);
+
+	intel_display_driver_disable_user_access(i915);
+
 	state = drm_atomic_helper_suspend(&i915->drm);
 	ret = PTR_ERR_OR_ZERO(state);
 	if (ret)
diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index 4fc9d8bce1fd..12639fa232b3 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -43,7 +43,6 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_managed.h>
-#include <drm/drm_probe_helper.h>
 
 #include "display/i9xx_display_sr.h"
 #include "display/intel_acpi.h"
@@ -55,7 +54,6 @@
 #include "display/intel_dp.h"
 #include "display/intel_dpt.h"
 #include "display/intel_encoder.h"
-#include "display/intel_fbdev.h"
 #include "display/intel_hotplug.h"
 #include "display/intel_overlay.h"
 #include "display/intel_pch_refclk.h"
@@ -995,19 +993,9 @@ static int i915_drm_suspend(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_display *display = &dev_priv->display;
-	struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
 
 	disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
 
-	/* We do a lot of poking in a lot of registers, make sure they work
-	 * properly. */
-	intel_power_domains_disable(dev_priv);
-	intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED, true);
-	if (HAS_DISPLAY(dev_priv)) {
-		drm_kms_helper_poll_disable(dev);
-		intel_display_driver_disable_user_access(dev_priv);
-	}
-
 	intel_display_driver_suspend(dev_priv);
 
 	intel_irq_suspend(dev_priv);
diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
index 98ff603a1f84..45949b095d7e 100644
--- a/drivers/gpu/drm/xe/display/xe_display.c
+++ b/drivers/gpu/drm/xe/display/xe_display.c
@@ -346,22 +346,11 @@ void xe_display_pm_suspend(struct xe_device *xe)
 {
 	struct intel_display *display = &xe->display;
 	bool s2idle = suspend_to_idle();
+
 	if (!xe->info.probe_display)
 		return;
 
-	/*
-	 * We do a lot of poking in a lot of registers, make sure they work
-	 * properly.
-	 */
-	intel_power_domains_disable(xe);
-
-	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
-
-	if (has_display(xe)) {
-		drm_kms_helper_poll_disable(&xe->drm);
-		intel_display_driver_disable_user_access(xe);
-		intel_display_driver_suspend(xe);
-	}
+	intel_display_driver_suspend(xe);
 
 	xe_display_flush_cleanup_work(xe);
 
-- 
2.46.0



More information about the Intel-gfx mailing list