]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
drm/i915: Add bit field to record which pins have received HPD events (v3)
authorEgbert Eich <eich@suse.de>
Thu, 11 Apr 2013 13:57:57 +0000 (15:57 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 23 Apr 2013 12:24:23 +0000 (14:24 +0200)
This way it is possible to limit 're'-detect() of displays to connectors
which have received an HPD event.

v2: Reordered drm_i915_private: Move hpd_event_bits to hpd state tracking.
v3: Fixed merge conflicts with previous patches.

Signed-off-by: Egbert Eich <eich@suse.de>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_irq.c

index d80bced96cea411e9547800021ba7b6656aa48ff..9a171dd83dcf3536ae8adeba5cae67eee2ee7ead 100644 (file)
@@ -951,6 +951,7 @@ typedef struct drm_i915_private {
                        HPD_MARK_DISABLED = 2
                } hpd_mark;
        } hpd_stats[HPD_NUM_PINS];
+       u32 hpd_event_bits;
        struct timer_list hotplug_reenable_timer;
 
        int num_pch_pll;
index dae8953d29128583514b5762a59e5a20e9e0a21d..e37820199b26f7c04463c6a54f08fbf2fffc2a50 100644 (file)
@@ -557,6 +557,7 @@ static void i915_hotplug_work_func(struct work_struct *work)
        struct drm_connector *connector;
        unsigned long irqflags;
        bool hpd_disabled = false;
+       u32 hpd_event_bits;
 
        /* HPD irq before everything is fully set up. */
        if (!dev_priv->enable_hotplug_processing)
@@ -566,6 +567,9 @@ static void i915_hotplug_work_func(struct work_struct *work)
        DRM_DEBUG_KMS("running encoder hotplug functions\n");
 
        spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
+
+       hpd_event_bits = dev_priv->hpd_event_bits;
+       dev_priv->hpd_event_bits = 0;
        list_for_each_entry(connector, &mode_config->connector_list, head) {
                intel_connector = to_intel_connector(connector);
                intel_encoder = intel_connector->encoder;
@@ -580,6 +584,10 @@ static void i915_hotplug_work_func(struct work_struct *work)
                                | DRM_CONNECTOR_POLL_DISCONNECT;
                        hpd_disabled = true;
                }
+               if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) {
+                       DRM_DEBUG_KMS("Connector %s (pin %i) received hotplug event.\n",
+                                     drm_get_connector_name(connector), intel_encoder->hpd_pin);
+               }
        }
         /* if there were no outputs to poll, poll was disabled,
          * therefore make sure it's enabled when disabling HPD on
@@ -844,6 +852,7 @@ static inline bool hotplug_irq_storm_detect(struct drm_device *dev,
 
                if (!(hpd[i] & hotplug_trigger) ||
                    dev_priv->hpd_stats[i].hpd_mark != HPD_ENABLED)
+                       dev_priv->hpd_event_bits |= (1 << i);
                        continue;
 
                if (!time_in_range(jiffies, dev_priv->hpd_stats[i].hpd_last_jiffies,
@@ -853,6 +862,7 @@ static inline bool hotplug_irq_storm_detect(struct drm_device *dev,
                        dev_priv->hpd_stats[i].hpd_cnt = 0;
                } else if (dev_priv->hpd_stats[i].hpd_cnt > HPD_STORM_THRESHOLD) {
                        dev_priv->hpd_stats[i].hpd_mark = HPD_MARK_DISABLED;
+                       dev_priv->hpd_event_bits &= ~(1 << i);
                        DRM_DEBUG_KMS("HPD interrupt storm detected on PIN %d\n", i);
                        ret = true;
                } else {