[14/17] drm/i915: Rewrite bxt_hpd_handler() to look like everyone else
diff mbox

Message ID 1440708972-17112-15-git-send-email-ville.syrjala@linux.intel.com
State New
Headers show

Commit Message

Ville Syrjala Aug. 27, 2015, 8:56 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

bxt_hpd_handler() looks different to everyone else for no good reason.
Rewrite it to use the standard variable namees etc.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c | 37 ++++++++++++++++---------------------
 1 file changed, 16 insertions(+), 21 deletions(-)

Comments

Paulo Zanoni Aug. 28, 2015, 9:01 p.m. UTC | #1
2015-08-27 17:56 GMT-03:00  <ville.syrjala@linux.intel.com>:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> bxt_hpd_handler() looks different to everyone else for no good reason.
> Rewrite it to use the standard variable namees etc.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_irq.c | 37 ++++++++++++++++---------------------
>  1 file changed, 16 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 53e51b5..f7f18a9 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -2122,27 +2122,17 @@ 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)
> +static void bxt_hpd_irq_handler(struct drm_device *dev, u32 hotplug_trigger)
>  {
> -       struct drm_i915_private *dev_priv = dev->dev_private;
> -       u32 hp_control, hp_trigger;
> -       u32 pin_mask = 0, long_mask = 0;
> -
> -       /* 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;
> -       }
> +       struct drm_i915_private *dev_priv = to_i915(dev);
> +       u32 dig_hotplug_reg, pin_mask = 0, long_mask = 0;
>
> -       /* Clear sticky bits in hpd status */
> -       I915_WRITE(BXT_HOTPLUG_CTL, hp_control);
> +       dig_hotplug_reg = I915_READ(BXT_HOTPLUG_CTL);
> +       I915_WRITE(BXT_HOTPLUG_CTL, dig_hotplug_reg);
>
> -       intel_get_hpd_pins(&pin_mask, &long_mask, hp_trigger, hp_control,
> -                          hpd_bxt, bxt_port_hotplug_long_detect);
> +       intel_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
> +                          dig_hotplug_reg, hpd_bxt,
> +                          bxt_port_hotplug_long_detect);
>         intel_hpd_irq_handler(dev, pin_mask, long_mask);
>  }
>
> @@ -2192,7 +2182,12 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
>                 tmp = I915_READ(GEN8_DE_PORT_IIR);
>                 if (tmp) {
>                         bool found = false;
> -                       u32 hotplug_trigger = tmp & GEN8_PORT_DP_A_HOTPLUG;
> +                       u32 hotplug_trigger = 0;
> +
> +                       if (IS_BROXTON(dev_priv))
> +                               hotplug_trigger = tmp & BXT_DE_PORT_HOTPLUG_MASK;
> +                       else if (IS_BROADWELL(dev_priv))
> +                               hotplug_trigger = tmp & GEN8_PORT_DP_A_HOTPLUG;
>
>                         I915_WRITE(GEN8_DE_PORT_IIR, tmp);
>                         ret = IRQ_HANDLED;
> @@ -2215,8 +2210,8 @@ static irqreturn_t gen8_irq_handler(int irq, void *arg)
>                                 found = true;
>                         }
>
> -                       if (IS_BROXTON(dev) && tmp & BXT_DE_PORT_HOTPLUG_MASK) {
> -                               bxt_hpd_handler(dev, tmp);
> +                       if (IS_BROXTON(dev) && hotplug_trigger) {
> +                               bxt_hpd_irq_handler(dev, hotplug_trigger);
>                                 found = true;
>                         }
>
> --
> 2.4.6
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 53e51b5..f7f18a9 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -2122,27 +2122,17 @@  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)
+static void bxt_hpd_irq_handler(struct drm_device *dev, u32 hotplug_trigger)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	u32 hp_control, hp_trigger;
-	u32 pin_mask = 0, long_mask = 0;
-
-	/* 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;
-	}
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 dig_hotplug_reg, pin_mask = 0, long_mask = 0;
 
-	/* Clear sticky bits in hpd status */
-	I915_WRITE(BXT_HOTPLUG_CTL, hp_control);
+	dig_hotplug_reg = I915_READ(BXT_HOTPLUG_CTL);
+	I915_WRITE(BXT_HOTPLUG_CTL, dig_hotplug_reg);
 
-	intel_get_hpd_pins(&pin_mask, &long_mask, hp_trigger, hp_control,
-			   hpd_bxt, bxt_port_hotplug_long_detect);
+	intel_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+			   dig_hotplug_reg, hpd_bxt,
+			   bxt_port_hotplug_long_detect);
 	intel_hpd_irq_handler(dev, pin_mask, long_mask);
 }
 
@@ -2192,7 +2182,12 @@  static irqreturn_t gen8_irq_handler(int irq, void *arg)
 		tmp = I915_READ(GEN8_DE_PORT_IIR);
 		if (tmp) {
 			bool found = false;
-			u32 hotplug_trigger = tmp & GEN8_PORT_DP_A_HOTPLUG;
+			u32 hotplug_trigger = 0;
+
+			if (IS_BROXTON(dev_priv))
+				hotplug_trigger = tmp & BXT_DE_PORT_HOTPLUG_MASK;
+			else if (IS_BROADWELL(dev_priv))
+				hotplug_trigger = tmp & GEN8_PORT_DP_A_HOTPLUG;
 
 			I915_WRITE(GEN8_DE_PORT_IIR, tmp);
 			ret = IRQ_HANDLED;
@@ -2215,8 +2210,8 @@  static irqreturn_t gen8_irq_handler(int irq, void *arg)
 				found = true;
 			}
 
-			if (IS_BROXTON(dev) && tmp & BXT_DE_PORT_HOTPLUG_MASK) {
-				bxt_hpd_handler(dev, tmp);
+			if (IS_BROXTON(dev) && hotplug_trigger) {
+				bxt_hpd_irq_handler(dev, hotplug_trigger);
 				found = true;
 			}