Commit cc21f011 authored by Jani Nikula's avatar Jani Nikula

drm/i915/bios: refactor DDC pin and AUX CH sanitize functions

Add separate functions to get the port by DDC pin and AUX channel.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a8b4afc08dd03e08c1403531e7f5ab33d777b1db.1559308269.git.jani.nikula@intel.com
parent 7679f9b8
...@@ -1239,6 +1239,21 @@ static u8 translate_iboost(u8 val) ...@@ -1239,6 +1239,21 @@ static u8 translate_iboost(u8 val)
return mapping[val]; return mapping[val];
} }
static enum port get_port_by_ddc_pin(struct drm_i915_private *i915, u8 ddc_pin)
{
const struct ddi_vbt_port_info *info;
enum port port;
for (port = PORT_A; port < I915_MAX_PORTS; port++) {
info = &i915->vbt.ddi_port_info[port];
if (info->child && ddc_pin == info->alternate_ddc_pin)
return port;
}
return PORT_NONE;
}
static void sanitize_ddc_pin(struct drm_i915_private *dev_priv, static void sanitize_ddc_pin(struct drm_i915_private *dev_priv,
enum port port) enum port port)
{ {
...@@ -1248,13 +1263,8 @@ static void sanitize_ddc_pin(struct drm_i915_private *dev_priv, ...@@ -1248,13 +1263,8 @@ static void sanitize_ddc_pin(struct drm_i915_private *dev_priv,
if (!info->alternate_ddc_pin) if (!info->alternate_ddc_pin)
return; return;
for (p = PORT_A; p < I915_MAX_PORTS; p++) { p = get_port_by_ddc_pin(dev_priv, info->alternate_ddc_pin);
struct ddi_vbt_port_info *i = &dev_priv->vbt.ddi_port_info[p]; if (p != PORT_NONE) {
if (p == port || !i->child ||
info->alternate_ddc_pin != i->alternate_ddc_pin)
continue;
DRM_DEBUG_KMS("port %c trying to use the same DDC pin (0x%x) as port %c, " DRM_DEBUG_KMS("port %c trying to use the same DDC pin (0x%x) as port %c, "
"disabling port %c DVI/HDMI support\n", "disabling port %c DVI/HDMI support\n",
port_name(port), info->alternate_ddc_pin, port_name(port), info->alternate_ddc_pin,
...@@ -1275,6 +1285,21 @@ static void sanitize_ddc_pin(struct drm_i915_private *dev_priv, ...@@ -1275,6 +1285,21 @@ static void sanitize_ddc_pin(struct drm_i915_private *dev_priv,
} }
} }
static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch)
{
const struct ddi_vbt_port_info *info;
enum port port;
for (port = PORT_A; port < I915_MAX_PORTS; port++) {
info = &i915->vbt.ddi_port_info[port];
if (info->child && aux_ch == info->alternate_aux_channel)
return port;
}
return PORT_NONE;
}
static void sanitize_aux_ch(struct drm_i915_private *dev_priv, static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
enum port port) enum port port)
{ {
...@@ -1284,13 +1309,8 @@ static void sanitize_aux_ch(struct drm_i915_private *dev_priv, ...@@ -1284,13 +1309,8 @@ static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
if (!info->alternate_aux_channel) if (!info->alternate_aux_channel)
return; return;
for (p = PORT_A; p < I915_MAX_PORTS; p++) { p = get_port_by_aux_ch(dev_priv, info->alternate_aux_channel);
struct ddi_vbt_port_info *i = &dev_priv->vbt.ddi_port_info[p]; if (p != PORT_NONE) {
if (p == port || !i->child ||
info->alternate_aux_channel != i->alternate_aux_channel)
continue;
DRM_DEBUG_KMS("port %c trying to use the same AUX CH (0x%x) as port %c, " DRM_DEBUG_KMS("port %c trying to use the same AUX CH (0x%x) as port %c, "
"disabling port %c DP support\n", "disabling port %c DP support\n",
port_name(port), info->alternate_aux_channel, port_name(port), info->alternate_aux_channel,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment