[Intel-gfx] [PATCH v3 6/7] drm/i915: Add bit field to record which pins have received HPD events (v2)

Jani Nikula jani.nikula at linux.intel.com
Thu Apr 11 15:21:54 CEST 2013


On Tue, 09 Apr 2013, Egbert Eich <eich at freedesktop.org> wrote:
> From: Egbert Eich <eich at suse.de>
>
> This way it is possible to limit 're'-detect() of displays to connectors
> which have received an HPD event.

I'd like you to be more explicit that this patch doesn't in fact add
such stuff in itself.

>
> v2: Reordered drm_i915_private: Move hpd_event_bits to hpd state tracking.
>
> Signed-off-by: Egbert Eich <eich at suse.de>
> ---
>  drivers/gpu/drm/i915/i915_drv.h |  1 +
>  drivers/gpu/drm/i915/i915_irq.c | 10 ++++++++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index a3ed2e3..907e290 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -938,6 +938,7 @@ typedef struct drm_i915_private {
>  			HPD_MARK_DISABLED = 2
>  		} hpd_mark;
>  	} hpd_stats[HPD_NUM_PINS];
> +	u32 hpd_event_bits;
>  #define I915_REENABLE_HOTPLUG_DELAY (2*60*1000)
>  	struct timer_list hotplug_reenable_timer;
>  
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 1a00533..92041b9 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -348,6 +348,7 @@ static void i915_hotplug_work_func(struct work_struct *work)
>  	struct drm_connector *connector;
>  	unsigned long irqflags;
>  	bool connector_disabled = false;
> +	u32 hpd_event_bits;
>  
>  	/* HPD irq before everything is fully set up. */
>  	if (!dev_priv->enable_hotplug_processing)
> @@ -357,6 +358,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;
> @@ -370,6 +374,10 @@ static void i915_hotplug_work_func(struct work_struct *work)
>  				| DRM_CONNECTOR_POLL_DISCONNECT;
>  			connector_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);
> +		}

I fear this may end up being a bit excessive debug printing.

BR,
Jani.

>  	}
>  	if (connector_disabled) {
>  		drm_kms_helper_poll_enable(dev); /* if there were no outputs to poll, poll is disabled */
> @@ -626,6 +634,7 @@ static inline bool hotplug_irq_storm_detect(struct drm_device *dev,
>  	for (i = 1; i < HPD_NUM_PINS; i++) {
>  		if ((hpd[i] & hotplug_trigger) &&
>  		    dev_priv->hpd_stats[i].hpd_mark == HPD_ENABLED) {
> +			dev_priv->hpd_event_bits |= (1 << i);
>  			if (!time_in_range(jiffies, dev_priv->hpd_stats[i].hpd_last_jiffies,
>  					  dev_priv->hpd_stats[i].hpd_last_jiffies
>  					  + msecs_to_jiffies(HPD_STORM_DETECT_PERIOD))) {
> @@ -633,6 +642,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 > 5) {
>  				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
> -- 
> 1.8.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



More information about the Intel-gfx mailing list