drm/i915: extract AUX mask assignment to separate function
authorLucas De Marchi <lucas.demarchi@intel.com>
Tue, 26 Feb 2019 00:49:00 +0000 (16:49 -0800)
committerLucas De Marchi <lucas.demarchi@intel.com>
Sat, 2 Mar 2019 00:50:18 +0000 (16:50 -0800)
No change in behavior, this only allows to more easily follow the flow
of gen8_de_irq_handler without the mask assignments for each platform.
This also re-organizes the branches a little bit, so the one-off case
for CNL_WITH_PORT_F is separate from the generic gen >= 11.

v2: rename de_port_iir_aux_mask -> gen8_de_port_aux_mask (Ville)

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jose Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190226004900.26047-1-lucas.demarchi@intel.com
drivers/gpu/drm/i915/i915_irq.c

index 7c7e84e86c6a1adc8a7571cd964d2d87706b1dad..a42eb6394b69f665d6d25a2ac1111e764e58d7f6 100644 (file)
@@ -2676,6 +2676,25 @@ static void gen11_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
                DRM_ERROR("Unexpected DE HPD interrupt 0x%08x\n", iir);
 }
 
+static u32 gen8_de_port_aux_mask(struct drm_i915_private *dev_priv)
+{
+       u32 mask = GEN8_AUX_CHANNEL_A;
+
+       if (INTEL_GEN(dev_priv) >= 9)
+               mask |= GEN9_AUX_CHANNEL_B |
+                       GEN9_AUX_CHANNEL_C |
+                       GEN9_AUX_CHANNEL_D;
+
+       if (IS_CNL_WITH_PORT_F(dev_priv))
+               mask |= CNL_AUX_CHANNEL_F;
+
+       if (INTEL_GEN(dev_priv) >= 11)
+               mask |= ICL_AUX_CHANNEL_E |
+                       CNL_AUX_CHANNEL_F;
+
+       return mask;
+}
+
 static irqreturn_t
 gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 {
@@ -2731,20 +2750,7 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
                        I915_WRITE(GEN8_DE_PORT_IIR, iir);
                        ret = IRQ_HANDLED;
 
-                       tmp_mask = GEN8_AUX_CHANNEL_A;
-                       if (INTEL_GEN(dev_priv) >= 9)
-                               tmp_mask |= GEN9_AUX_CHANNEL_B |
-                                           GEN9_AUX_CHANNEL_C |
-                                           GEN9_AUX_CHANNEL_D;
-
-                       if (INTEL_GEN(dev_priv) >= 11)
-                               tmp_mask |= ICL_AUX_CHANNEL_E;
-
-                       if (IS_CNL_WITH_PORT_F(dev_priv) ||
-                           INTEL_GEN(dev_priv) >= 11)
-                               tmp_mask |= CNL_AUX_CHANNEL_F;
-
-                       if (iir & tmp_mask) {
+                       if (iir & gen8_de_port_aux_mask(dev_priv)) {
                                dp_aux_irq_handler(dev_priv);
                                found = true;
                        }