[PATCH 07/29] drm/i915: Add helpers to init/enable/disable hotplug detection

Imre Deak imre.deak at intel.com
Wed Dec 20 00:53:46 UTC 2023


Signed-off-by: Imre Deak <imre.deak at intel.com>
---
 .../drm/i915/display/intel_display_driver.c   | 10 ++++-----
 drivers/gpu/drm/i915/display/intel_hotplug.c  | 22 +++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hotplug.h  |  5 +++++
 drivers/gpu/drm/i915/i915_driver.c            |  2 +-
 4 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
index 190e1c6d00438..907c24a326a04 100644
--- a/drivers/gpu/drm/i915/display/intel_display_driver.c
+++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
@@ -373,8 +373,7 @@ int intel_display_driver_probe(struct drm_i915_private *i915)
 		return ret;
 
 	/* Only enable hotplug handling once the fbdev is fully set up. */
-	intel_hpd_init(i915);
-	intel_hpd_poll_disable(i915);
+	intel_hotplug_detection_init(i915);
 
 	skl_watermark_ipc_init(i915);
 
@@ -444,7 +443,7 @@ void intel_display_driver_remove_noirq(struct drm_i915_private *i915)
 	 * Due to the hpd irq storm handling the hotplug work can re-arm the
 	 * poll handlers. Hence disable polling after hpd handling is shut down.
 	 */
-	intel_hpd_poll_fini(i915);
+	intel_hotplug_detection_cleanup(i915);
 
 	/* poll work can call into fbdev, hence clean that up afterwards */
 	intel_fbdev_fini(i915);
@@ -512,7 +511,7 @@ int intel_display_driver_suspend(struct drm_i915_private *i915)
 	if (!HAS_DISPLAY(i915))
 		return 0;
 
-	drm_kms_helper_poll_disable(&i915->drm);
+	intel_hotplug_detection_disable(i915);
 
 	state = drm_atomic_helper_suspend(&i915->drm);
 	ret = PTR_ERR_OR_ZERO(state);
@@ -606,6 +605,5 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
 	if (state)
 		drm_atomic_state_put(state);
 
-	intel_hpd_poll_disable(i915);
-	drm_kms_helper_poll_enable(&i915->drm);
+	intel_hotplug_detection_enable(i915);
 }
diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c b/drivers/gpu/drm/i915/display/intel_hotplug.c
index 0c0700c6ec66d..5b4061db3b6b4 100644
--- a/drivers/gpu/drm/i915/display/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
@@ -300,6 +300,28 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
 	return intel_hotplug_detect_connector(connector);
 }
 
+void intel_hotplug_detection_init(struct drm_i915_private *i915)
+{
+	intel_hpd_init(i915);
+	intel_hpd_poll_disable(i915);
+}
+
+void intel_hotplug_detection_cleanup(struct drm_i915_private *i915)
+{
+	intel_hpd_poll_fini(i915);
+}
+
+void intel_hotplug_detection_disable(struct drm_i915_private *i915)
+{
+	drm_kms_helper_poll_disable(&i915->drm);
+}
+
+void intel_hotplug_detection_enable(struct drm_i915_private *i915)
+{
+	intel_hpd_poll_disable(i915);
+	drm_kms_helper_poll_enable(&i915->drm);
+}
+
 static bool intel_encoder_has_hpd_pulse(struct intel_encoder *encoder)
 {
 	return intel_encoder_is_dig_port(encoder) &&
diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.h b/drivers/gpu/drm/i915/display/intel_hotplug.h
index 424ae5dbf5a0e..5f5f1d72e8d72 100644
--- a/drivers/gpu/drm/i915/display/intel_hotplug.h
+++ b/drivers/gpu/drm/i915/display/intel_hotplug.h
@@ -30,4 +30,9 @@ bool intel_hpd_disable(struct drm_i915_private *dev_priv, enum hpd_pin pin);
 void intel_hpd_enable(struct drm_i915_private *dev_priv, enum hpd_pin pin);
 void intel_hpd_debugfs_register(struct drm_i915_private *i915);
 
+void intel_hotplug_detection_init(struct drm_i915_private *i915);
+void intel_hotplug_detection_cleanup(struct drm_i915_private *i915);
+void intel_hotplug_detection_disable(struct drm_i915_private *i915);
+void intel_hotplug_detection_enable(struct drm_i915_private *i915);
+
 #endif /* __INTEL_HOTPLUG_H__ */
diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index 7825257f7643d..1818c2c94561d 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -1004,7 +1004,7 @@ void i915_driver_shutdown(struct drm_i915_private *i915)
 	intel_power_domains_disable(i915);
 
 	if (HAS_DISPLAY(i915)) {
-		drm_kms_helper_poll_disable(&i915->drm);
+		intel_hotplug_detection_disable(i915);
 
 		drm_atomic_helper_shutdown(&i915->drm);
 	}
-- 
2.39.2



More information about the Intel-gfx-trybot mailing list