[PATCH 11/29] drm/i915: Add asserts that detect doesn't run unexpectedly
Imre Deak
imre.deak at intel.com
Wed Dec 20 00:53:50 UTC 2023
Signed-off-by: Imre Deak <imre.deak at intel.com>
---
drivers/gpu/drm/i915/display/intel_crt.c | 2 ++
drivers/gpu/drm/i915/display/intel_dp.c | 5 +++++
drivers/gpu/drm/i915/display/intel_dp_mst.c | 2 ++
drivers/gpu/drm/i915/display/intel_dvo.c | 3 +++
drivers/gpu/drm/i915/display/intel_hdmi.c | 5 +++++
drivers/gpu/drm/i915/display/intel_hotplug.c | 6 ++++++
drivers/gpu/drm/i915/display/intel_hotplug.h | 1 +
drivers/gpu/drm/i915/display/intel_panel.c | 3 +++
drivers/gpu/drm/i915/display/intel_sdvo.c | 2 ++
drivers/gpu/drm/i915/display/intel_tv.c | 2 ++
10 files changed, 31 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_crt.c b/drivers/gpu/drm/i915/display/intel_crt.c
index abaacea5c2cc4..7abf795728bf6 100644
--- a/drivers/gpu/drm/i915/display/intel_crt.c
+++ b/drivers/gpu/drm/i915/display/intel_crt.c
@@ -843,6 +843,8 @@ intel_crt_detect(struct drm_connector *connector,
connector->base.id, connector->name,
force);
+ intel_hotplug_detection_assert_handler_enabled(dev_priv);
+
if (!intel_display_device_enabled(dev_priv))
return connector_status_disconnected;
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 92a1ca4aa5fb0..58063686acfe5 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -5686,6 +5686,8 @@ intel_dp_detect(struct drm_connector *connector,
if (!intel_display_device_enabled(dev_priv))
return connector_status_disconnected;
+ intel_hotplug_detection_assert_handler_enabled(dev_priv);
+
/* Can't disconnect eDP */
if (intel_dp_is_edp(intel_dp))
status = edp_detect(intel_dp);
@@ -5786,6 +5788,9 @@ intel_dp_force(struct drm_connector *connector)
drm_dbg_kms(&dev_priv->drm, "[CONNECTOR:%d:%s]\n",
connector->base.id, connector->name);
+
+ intel_hotplug_detection_assert_handler_enabled(dev_priv);
+
intel_dp_unset_edid(intel_dp);
if (connector->status != connector_status_connected)
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index 8a94323350303..2b4432f7464a2 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -1407,6 +1407,8 @@ intel_dp_mst_detect(struct drm_connector *connector,
if (!intel_display_device_enabled(i915))
return connector_status_disconnected;
+ intel_hotplug_detection_assert_handler_enabled(i915);
+
if (drm_connector_is_unregistered(connector))
return connector_status_disconnected;
diff --git a/drivers/gpu/drm/i915/display/intel_dvo.c b/drivers/gpu/drm/i915/display/intel_dvo.c
index 9111e9d46486d..ffe3bb9ed0dd3 100644
--- a/drivers/gpu/drm/i915/display/intel_dvo.c
+++ b/drivers/gpu/drm/i915/display/intel_dvo.c
@@ -34,6 +34,7 @@
#include "i915_drv.h"
#include "i915_reg.h"
#include "intel_connector.h"
+#include "intel_hotplug.h"
#include "intel_de.h"
#include "intel_display_types.h"
#include "intel_dvo.h"
@@ -328,6 +329,8 @@ intel_dvo_detect(struct drm_connector *_connector, bool force)
if (!intel_display_device_enabled(i915))
return connector_status_disconnected;
+ intel_hotplug_detection_assert_handler_enabled(i915);
+
return intel_dvo->dev.dev_ops->detect(&intel_dvo->dev);
}
diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
index 39e4f5f7c8171..fe172079dfdbe 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -55,6 +55,7 @@
#include "intel_hdcp.h"
#include "intel_hdcp_regs.h"
#include "intel_hdmi.h"
+#include "intel_hotplug.h"
#include "intel_lspcon.h"
#include "intel_panel.h"
#include "intel_snps_phy.h"
@@ -2503,6 +2504,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
if (!intel_display_device_enabled(dev_priv))
return connector_status_disconnected;
+ intel_hotplug_detection_assert_handler_enabled(dev_priv);
+
wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
if (DISPLAY_VER(dev_priv) >= 11 &&
@@ -2531,6 +2534,8 @@ intel_hdmi_force(struct drm_connector *connector)
drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s]\n",
connector->base.id, connector->name);
+ intel_hotplug_detection_assert_handler_enabled(i915);
+
intel_hdmi_unset_edid(connector);
if (connector->status != connector_status_connected)
diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c b/drivers/gpu/drm/i915/display/intel_hotplug.c
index 4d8fa57a0ea75..618d7a8c919ff 100644
--- a/drivers/gpu/drm/i915/display/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
@@ -351,6 +351,12 @@ static void intel_hotplug_detection_mod_work(struct drm_i915_private *i915, int
&i915->display.hotplug.hotplug_work, delay);
}
+void intel_hotplug_detection_assert_handler_enabled(struct drm_i915_private *i915)
+{
+ drm_WARN_ON(&i915->drm,
+ i915->display.hotplug.detection_state < HOTPLUG_DETECTION_HANDLER_ENABLED);
+}
+
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 ec55fa523de09..2fe215652f69f 100644
--- a/drivers/gpu/drm/i915/display/intel_hotplug.h
+++ b/drivers/gpu/drm/i915/display/intel_hotplug.h
@@ -35,5 +35,6 @@ 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);
void intel_hotplug_detection_queue_work(struct drm_i915_private *i915, int delay);
+void intel_hotplug_detection_assert_handler_enabled(struct drm_i915_private *i915);
#endif /* __INTEL_HOTPLUG_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
index 0d8e5320a4f88..3bb1d68d04bcb 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -39,6 +39,7 @@
#include "intel_de.h"
#include "intel_display_types.h"
#include "intel_drrs.h"
+#include "intel_hotplug.h"
#include "intel_lvds_regs.h"
#include "intel_panel.h"
#include "intel_quirks.h"
@@ -683,6 +684,8 @@ intel_panel_detect(struct drm_connector *connector, bool force)
if (!intel_display_device_enabled(i915))
return connector_status_disconnected;
+ intel_hotplug_detection_assert_handler_enabled(i915);
+
return connector_status_connected;
}
diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
index 9218047495fb4..fce9dccc2bc88 100644
--- a/drivers/gpu/drm/i915/display/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
@@ -2140,6 +2140,8 @@ intel_sdvo_detect(struct drm_connector *connector, bool force)
if (!intel_display_device_enabled(i915))
return connector_status_disconnected;
+ intel_hotplug_detection_assert_handler_enabled(i915);
+
if (!intel_sdvo_set_target_output(intel_sdvo,
intel_sdvo_connector->output_flag))
return connector_status_unknown;
diff --git a/drivers/gpu/drm/i915/display/intel_tv.c b/drivers/gpu/drm/i915/display/intel_tv.c
index d4386cb3569e0..9a3a438204004 100644
--- a/drivers/gpu/drm/i915/display/intel_tv.c
+++ b/drivers/gpu/drm/i915/display/intel_tv.c
@@ -1720,6 +1720,8 @@ intel_tv_detect(struct drm_connector *connector,
drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s] force=%d\n",
connector->base.id, connector->name, force);
+ intel_hotplug_detection_assert_handler_enabled(i915);
+
if (!intel_display_device_enabled(i915))
return connector_status_disconnected;
--
2.39.2
More information about the Intel-gfx-trybot
mailing list