[Intel-gfx] [PATCH v2 25/49] drm/i915/bxt: Add DDI hpd handler

Jani Nikula jani.nikula at intel.com
Mon Apr 13 06:45:37 PDT 2015


On Fri, 10 Apr 2015, Imre Deak <imre.deak at intel.com> wrote:
> From: Shashank Sharma <shashank.sharma at intel.com>
>
> This patch adds a hot plug interrupt handler function for BXT.
> What this function typically does is:
> 1. Check if hot plug is enabled from hot plug control register.
> 2. Call hpd_irq_handler with appropriate trigger to detect a
>    plug storm and schedule a bottom half.
> 3. Clear sticky status bits in hot plug control register..
>
> v2: (jani)
> - drop redundant unlikely()
> - s/Todo/FIXME:/ in code comment
> - declare 'found' var in the scope where it's used
> - check for IS_BROXTON before handling BXT_DE_PORT_HOTPLUG_MASK
>
> Reviewed-by: Satheeshakrishna M<satheeshakrishna.m at intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma at intel.com>
> Sigend-off-by: Imre Deak <imre.deak at intel.com>

Reviewed-by: Jani Nikula <jani.nikula at intel.com>

> ---
>  drivers/gpu/drm/i915/i915_irq.c | 46 +++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 44 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 631484d..b06364f 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -2152,6 +2152,38 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
>  	return ret;
>  }
>  
> +static void bxt_hpd_handler(struct drm_device *dev, uint32_t iir_status)
> +{
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	uint32_t hp_control;
> +	uint32_t hp_trigger;
> +
> +	/* Get the status */
> +	hp_trigger = iir_status & BXT_DE_PORT_HOTPLUG_MASK;
> +	hp_control = I915_READ(BXT_HOTPLUG_CTL);
> +
> +	/* Hotplug not enabled ? */
> +	if (!(hp_control & BXT_HOTPLUG_CTL_MASK)) {
> +		DRM_ERROR("Interrupt when HPD disabled\n");
> +		return;
> +	}
> +
> +	DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n",
> +		hp_control & BXT_HOTPLUG_CTL_MASK);
> +
> +	/* Check for HPD storm and schedule bottom half */
> +	intel_hpd_irq_handler(dev, hp_trigger, hp_control, hpd_bxt);
> +
> +	/*
> +	 * FIXME: Save the hot plug status for bottom half before
> +	 * clearing the sticky status bits, else the status will be
> +	 * lost.
> +	 */
> +
> +	/* Clear sticky bits in hpd status */
> +	I915_WRITE(BXT_HOTPLUG_CTL, hp_control);
> +}
> +
>  static irqreturn_t gen8_irq_handler(int irq, void *arg)
>  {
>  	struct drm_device *dev = arg;
> @@ -2197,12 +2229,22 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
>  	if (master_ctl & GEN8_DE_PORT_IRQ) {
>  		tmp = I915_READ(GEN8_DE_PORT_IIR);
>  		if (tmp) {
> +			bool found = false;
> +
>  			I915_WRITE(GEN8_DE_PORT_IIR, tmp);
>  			ret = IRQ_HANDLED;
>  
> -			if (tmp & aux_mask)
> +			if (tmp & aux_mask) {
>  				dp_aux_irq_handler(dev);
> -			else
> +				found = true;
> +			}
> +
> +			if (IS_BROXTON(dev) && tmp & BXT_DE_PORT_HOTPLUG_MASK) {
> +				bxt_hpd_handler(dev, tmp);
> +				found = true;
> +			}
> +
> +			if (!found)
>  				DRM_ERROR("Unexpected DE Port interrupt\n");
>  		}
>  		else
> -- 
> 1.9.1
>

-- 
Jani Nikula, Intel Open Source Technology Center


More information about the Intel-gfx mailing list