drm/i915: Move intel_aux_ch() to intel_bios.c
authorImre Deak <imre.deak@intel.com>
Thu, 1 Nov 2018 14:04:20 +0000 (16:04 +0200)
committerImre Deak <imre.deak@intel.com>
Thu, 1 Nov 2018 23:23:58 +0000 (01:23 +0200)
From ICL onwards all the DDI/TypeC ports - even working in HDMI mode -
need to know their corresponding AUX channel, so move the corresponding
helper to a common place.

No functional change.

v4:
- Fix 'no space is necessary after a cast' checkpatch warn.

Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181101140427.31026-2-imre.deak@intel.com
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_bios.c
drivers/gpu/drm/i915/intel_dp.c

index c9e5bab6861b02d46f02a3e0c78114336d94a06b..c57b701f72a7e398b2c559ee9350ba17dff61bc5 100644 (file)
@@ -3445,6 +3445,7 @@ bool intel_bios_is_port_hpd_inverted(struct drm_i915_private *dev_priv,
                                     enum port port);
 bool intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
                                enum port port);
+enum aux_ch intel_aux_ch(struct drm_i915_private *dev_priv, enum port port);
 
 /* intel_acpi.c */
 #ifdef CONFIG_ACPI
index 5fa2133f801d9d13afdd8ca44baf454cfb15de55..0ad2304457ab2e4c3e08e8772f6bd6b67975042e 100644 (file)
@@ -2159,3 +2159,48 @@ intel_bios_is_lspcon_present(struct drm_i915_private *dev_priv,
 
        return false;
 }
+
+enum aux_ch intel_aux_ch(struct drm_i915_private *dev_priv, enum port port)
+{
+       const struct ddi_vbt_port_info *info =
+               &dev_priv->vbt.ddi_port_info[port];
+       enum aux_ch aux_ch;
+
+       if (!info->alternate_aux_channel) {
+               aux_ch = (enum aux_ch)port;
+
+               DRM_DEBUG_KMS("using AUX %c for port %c (platform default)\n",
+                             aux_ch_name(aux_ch), port_name(port));
+               return aux_ch;
+       }
+
+       switch (info->alternate_aux_channel) {
+       case DP_AUX_A:
+               aux_ch = AUX_CH_A;
+               break;
+       case DP_AUX_B:
+               aux_ch = AUX_CH_B;
+               break;
+       case DP_AUX_C:
+               aux_ch = AUX_CH_C;
+               break;
+       case DP_AUX_D:
+               aux_ch = AUX_CH_D;
+               break;
+       case DP_AUX_E:
+               aux_ch = AUX_CH_E;
+               break;
+       case DP_AUX_F:
+               aux_ch = AUX_CH_F;
+               break;
+       default:
+               MISSING_CASE(info->alternate_aux_channel);
+               aux_ch = AUX_CH_A;
+               break;
+       }
+
+       DRM_DEBUG_KMS("using AUX %c for port %c (VBT)\n",
+                     aux_ch_name(aux_ch), port_name(port));
+
+       return aux_ch;
+}
index 9a2db61c1ba7dbdbbaf0da4b14c9536408bbefcd..ec0ae1f7a18794cf373d104033bdb17bc922a728 100644 (file)
@@ -1551,54 +1551,6 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
        return ret;
 }
 
-static enum aux_ch intel_aux_ch(struct intel_dp *intel_dp)
-{
-       struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
-       struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-       enum port port = encoder->port;
-       const struct ddi_vbt_port_info *info =
-               &dev_priv->vbt.ddi_port_info[port];
-       enum aux_ch aux_ch;
-
-       if (!info->alternate_aux_channel) {
-               aux_ch = (enum aux_ch) port;
-
-               DRM_DEBUG_KMS("using AUX %c for port %c (platform default)\n",
-                             aux_ch_name(aux_ch), port_name(port));
-               return aux_ch;
-       }
-
-       switch (info->alternate_aux_channel) {
-       case DP_AUX_A:
-               aux_ch = AUX_CH_A;
-               break;
-       case DP_AUX_B:
-               aux_ch = AUX_CH_B;
-               break;
-       case DP_AUX_C:
-               aux_ch = AUX_CH_C;
-               break;
-       case DP_AUX_D:
-               aux_ch = AUX_CH_D;
-               break;
-       case DP_AUX_E:
-               aux_ch = AUX_CH_E;
-               break;
-       case DP_AUX_F:
-               aux_ch = AUX_CH_F;
-               break;
-       default:
-               MISSING_CASE(info->alternate_aux_channel);
-               aux_ch = AUX_CH_A;
-               break;
-       }
-
-       DRM_DEBUG_KMS("using AUX %c for port %c (VBT)\n",
-                     aux_ch_name(aux_ch), port_name(port));
-
-       return aux_ch;
-}
-
 static enum intel_display_power_domain
 intel_aux_power_domain(struct intel_dp *intel_dp)
 {
@@ -1739,7 +1691,7 @@ intel_dp_aux_init(struct intel_dp *intel_dp)
        struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
        struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
 
-       intel_dp->aux_ch = intel_aux_ch(intel_dp);
+       intel_dp->aux_ch = intel_aux_ch(dev_priv, encoder->port);
        intel_dp->aux_power_domain = intel_aux_power_domain(intel_dp);
 
        if (INTEL_GEN(dev_priv) >= 9) {