drm/i915/ddi: Move DDI port detection to the corresponding helper
authorImre Deak <imre.deak@intel.com>
Thu, 20 Dec 2018 13:26:02 +0000 (15:26 +0200)
committerImre Deak <imre.deak@intel.com>
Tue, 15 Jan 2019 14:18:23 +0000 (16:18 +0200)
We have already a function to detect DDI ports using VBT, so instead of
opencoding the DDI specific version of this, move the opencoded part to
the existing helper.

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181220132604.25222-1-imre.deak@intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/intel_bios.c
drivers/gpu/drm/i915/intel_display.c

index 140c218..561a4f9 100644 (file)
@@ -1946,6 +1946,15 @@ bool intel_bios_is_port_present(struct drm_i915_private *dev_priv, enum port por
        };
        int i;
 
+       if (HAS_DDI(dev_priv)) {
+               const struct ddi_vbt_port_info *port_info =
+                       &dev_priv->vbt.ddi_port_info[port];
+
+               return port_info->supports_dp ||
+                      port_info->supports_dvi ||
+                      port_info->supports_hdmi;
+       }
+
        /* FIXME maybe deal with port A as well? */
        if (WARN_ON(port == PORT_A) || port >= ARRAY_SIZE(port_mapping))
                return false;
index accb308..3d1e1e6 100644 (file)
@@ -14362,9 +14362,7 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
                 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
                 */
                if (IS_GEN9_BC(dev_priv) &&
-                   (dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
-                    dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
-                    dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi))
+                   intel_bios_is_port_present(dev_priv, PORT_E))
                        intel_ddi_init(dev_priv, PORT_E);
 
        } else if (HAS_PCH_SPLIT(dev_priv)) {