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.

Reviewed-by: Ville Syrjälä <[email protected]>
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 5f6c3d741196..462f78d5b020 100644
--- a/drivers/gpu/drm/i915/display/intel_display_driver.c
+++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
@@ -684,13 +684,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);
 }
 
@@ -748,6 +741,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 2458a8a684e9..0520cd124686 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"
@@ -1107,15 +1106,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 4460438b966f..a5768736dbbc 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"
@@ -278,15 +277,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