The calls leading up to __intel_display_driver_pm_suspend() are
surrounded by near identical display calls. Move the calls inside
__intel_display_driver_pm_suspend() to clean up and deduplicate.

There's a slight functional change in that
intel_display_driver_pm_suspend() returns early for
!HAS_DISPLAY(). Assume this is what we want, and there are no cases
where display engine is present but all pipes have been fused off.

Signed-off-by: Jani Nikula <[email protected]>
---
 .../gpu/drm/i915/display/intel_display_driver.c   | 15 ++++++++-------
 drivers/gpu/drm/i915/i915_driver.c                | 10 ----------
 drivers/gpu/drm/xe/display/xe_display.c           | 10 ----------
 3 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c 
b/drivers/gpu/drm/i915/display/intel_display_driver.c
index 0dd0b15641eb..bc632ac8c9b4 100644
--- a/drivers/gpu/drm/i915/display/intel_display_driver.c
+++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
@@ -690,13 +690,6 @@ void intel_display_driver_shutdown(struct intel_display 
*display)
 
        __intel_display_driver_pm_suspend(display, true);
 
-       intel_encoder_block_all_hpds(display);
-
-       intel_hpd_cancel_work(display);
-
-       intel_display_driver_suspend_access(display);
-
-       intel_encoder_suspend_all(display);
        intel_encoder_shutdown_all(display);
 }
 
@@ -754,6 +747,14 @@ static int __intel_display_driver_pm_suspend(struct 
intel_display *display, bool
 
        intel_dp_mst_suspend(display);
 
+       intel_encoder_block_all_hpds(display);
+
+       intel_hpd_cancel_work(display);
+
+       intel_display_driver_suspend_access(display);
+
+       intel_encoder_suspend_all(display);
+
        return ret;
 }
 
diff --git a/drivers/gpu/drm/i915/i915_driver.c 
b/drivers/gpu/drm/i915/i915_driver.c
index 80313ee07b07..209ac512455d 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -61,7 +61,6 @@
 #include "display/intel_dp.h"
 #include "display/intel_dpt.h"
 #include "display/intel_dram.h"
-#include "display/intel_encoder.h"
 #include "display/intel_fbdev.h"
 #include "display/intel_gmbus.h"
 #include "display/intel_hotplug.h"
@@ -1105,15 +1104,6 @@ static int i915_drm_suspend(struct drm_device *dev)
 
        intel_display_driver_pm_suspend(display);
 
-       intel_encoder_block_all_hpds(display);
-
-       intel_hpd_cancel_work(display);
-
-       if (intel_display_device_present(display))
-               intel_display_driver_suspend_access(display);
-
-       intel_encoder_suspend_all(display);
-
        intel_irq_suspend(dev_priv);
 
        /* Must be called before GGTT is suspended. */
diff --git a/drivers/gpu/drm/xe/display/xe_display.c 
b/drivers/gpu/drm/xe/display/xe_display.c
index 99bcaa49d11a..561ec1ed6845 100644
--- a/drivers/gpu/drm/xe/display/xe_display.c
+++ b/drivers/gpu/drm/xe/display/xe_display.c
@@ -30,7 +30,6 @@
 #include "intel_dmc_wl.h"
 #include "intel_dp.h"
 #include "intel_dram.h"
-#include "intel_encoder.h"
 #include "intel_fbdev.h"
 #include "intel_hdcp.h"
 #include "intel_hotplug.h"
@@ -276,15 +275,6 @@ void xe_display_pm_suspend(struct xe_device *xe)
 
        intel_display_driver_pm_suspend(display);
 
-       intel_encoder_block_all_hpds(display);
-
-       intel_hpd_cancel_work(display);
-
-       if (intel_display_device_present(display)) {
-               intel_display_driver_suspend_access(display);
-               intel_encoder_suspend_all(display);
-       }
-
        intel_opregion_suspend(display, s2idle ? PCI_D1 : PCI_D3cold);
 
        intel_dmc_suspend(display);
-- 
2.47.3

Reply via email to