This adds more information to the hotplug uevent and lets user-space
know that it's about a particular connector only.

Signed-off-by: Simon Ser <cont...@emersion.fr>
Cc: Jani Nikula <jani.nik...@intel.com>
Cc: Ville Syrjälä <ville.syrj...@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.v...@intel.com>
Cc: Gustavo Sousa <gustavo.so...@intel.com>
Cc: Imre Deak <imre.d...@intel.com>
Cc: Lucas De Marchi <lucas.demar...@intel.com>
---
 drivers/gpu/drm/i915/display/intel_hotplug.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
b/drivers/gpu/drm/i915/display/intel_hotplug.c
index 1160fa20433b..605c6e05a169 100644
--- a/drivers/gpu/drm/i915/display/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
@@ -376,6 +376,7 @@ static void i915_hotplug_work_func(struct work_struct *work)
        u32 changed = 0, retry = 0;
        u32 hpd_event_bits;
        u32 hpd_retry_bits;
+       struct drm_connector *first_changed_connector = NULL;
 
        mutex_lock(&dev_priv->drm.mode_config.mutex);
        drm_dbg_kms(&dev_priv->drm, "running encoder hotplug functions\n");
@@ -428,6 +429,10 @@ static void i915_hotplug_work_func(struct work_struct 
*work)
                                break;
                        case INTEL_HOTPLUG_CHANGED:
                                changed |= hpd_bit;
+                               if (!first_changed_connector) {
+                                       drm_connector_get(&connector->base);
+                                       first_changed_connector = 
&connector->base;
+                               }
                                break;
                        case INTEL_HOTPLUG_RETRY:
                                retry |= hpd_bit;
@@ -438,9 +443,14 @@ static void i915_hotplug_work_func(struct work_struct 
*work)
        drm_connector_list_iter_end(&conn_iter);
        mutex_unlock(&dev_priv->drm.mode_config.mutex);
 
-       if (changed)
+       if (hweight32(changed) == 1)
+               drm_kms_helper_connector_hotplug_event(first_changed_connector);
+       else if (changed)
                drm_kms_helper_hotplug_event(&dev_priv->drm);
 
+       if (first_changed_connector)
+               drm_connector_put(first_changed_connector);
+
        /* Remove shared HPD pins that have changed */
        retry &= ~changed;
        if (retry) {
-- 
2.41.0


Reply via email to