[PATCH 04/29] drm: Add support for disabling/enabling hotplug events

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


Signed-off-by: Imre Deak <imre.deak at intel.com>
---
 drivers/gpu/drm/drm_probe_helper.c | 18 ++++++++++++++++++
 include/drm/drm_mode_config.h      |  2 ++
 include/drm/drm_probe_helper.h     |  2 ++
 3 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 3f479483d7d80..969325f1d4be5 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -714,6 +714,9 @@ EXPORT_SYMBOL(drm_helper_probe_single_connector_modes);
  */
 void drm_kms_helper_hotplug_event(struct drm_device *dev)
 {
+	if (dev->mode_config.hotplug_event_disabled)
+		return;
+
 	/* send a uevent + call fbdev */
 	drm_sysfs_hotplug_event(dev);
 	if (dev->mode_config.funcs->output_poll_changed)
@@ -734,6 +737,9 @@ void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
 
+	if (dev->mode_config.hotplug_event_disabled)
+		return;
+
 	/* send a uevent + call fbdev */
 	drm_sysfs_connector_hotplug_event(connector);
 	if (dev->mode_config.funcs->output_poll_changed)
@@ -743,6 +749,18 @@ void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector)
 }
 EXPORT_SYMBOL(drm_kms_helper_connector_hotplug_event);
 
+void drm_kms_helper_hotplug_event_enable(struct drm_device *dev)
+{
+	dev->mode_config.hotplug_event_disabled = false;
+}
+EXPORT_SYMBOL(drm_kms_helper_hotplug_event_enable);
+
+void drm_kms_helper_hotplug_event_disable(struct drm_device *dev)
+{
+	dev->mode_config.hotplug_event_disabled = true;
+}
+EXPORT_SYMBOL(drm_kms_helper_hotplug_event_disable);
+
 static void output_poll_execute(struct work_struct *work)
 {
 	struct delayed_work *delayed_work = to_delayed_work(work);
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 973119a9176b2..c09087a2e9ac2 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -548,6 +548,8 @@ struct drm_mode_config {
 	bool delayed_event;
 	struct delayed_work output_poll_work;
 
+	bool hotplug_event_disabled;
+
 	/**
 	 * @blob_lock:
 	 *
diff --git a/include/drm/drm_probe_helper.h b/include/drm/drm_probe_helper.h
index fad3c4003b2b5..9bf07e6387338 100644
--- a/include/drm/drm_probe_helper.h
+++ b/include/drm/drm_probe_helper.h
@@ -22,6 +22,8 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev);
 bool drm_connector_helper_hpd_irq_event(struct drm_connector *connector);
 void drm_kms_helper_hotplug_event(struct drm_device *dev);
 void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector);
+void drm_kms_helper_hotplug_event_enable(struct drm_device *dev);
+void drm_kms_helper_hotplug_event_disable(struct drm_device *dev);
 
 void drm_kms_helper_poll_disable(struct drm_device *dev);
 void drm_kms_helper_poll_enable(struct drm_device *dev);
-- 
2.39.2



More information about the Intel-gfx-trybot mailing list