Commit 975786ee authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Extract intel_ddi_get_buf_trans_hdmi()

Introduce intel_ddi_get_buf_trans_hdmi() and start using it where we
can.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171016145705.11780-3-ville.syrjala@linux.intel.comReviewed-by: default avatarJames Ausmus <james.ausmus@intel.com>
Reviewed-by: default avatarManasi Navare <manasi.d.navare@intel.com>
parent d8fe2c7f
...@@ -641,6 +641,24 @@ intel_ddi_get_buf_trans_fdi(struct drm_i915_private *dev_priv, ...@@ -641,6 +641,24 @@ intel_ddi_get_buf_trans_fdi(struct drm_i915_private *dev_priv,
return NULL; return NULL;
} }
static const struct ddi_buf_trans *
intel_ddi_get_buf_trans_hdmi(struct drm_i915_private *dev_priv,
int *n_entries)
{
if (IS_GEN9_BC(dev_priv)) {
return skl_get_buf_trans_hdmi(dev_priv, n_entries);
} else if (IS_BROADWELL(dev_priv)) {
*n_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
return bdw_ddi_translations_hdmi;
} else if (IS_HASWELL(dev_priv)) {
*n_entries = ARRAY_SIZE(hsw_ddi_translations_hdmi);
return hsw_ddi_translations_hdmi;
}
*n_entries = 0;
return NULL;
}
static const struct cnl_ddi_buf_trans * static const struct cnl_ddi_buf_trans *
cnl_get_buf_trans_hdmi(struct drm_i915_private *dev_priv, int *n_entries) cnl_get_buf_trans_hdmi(struct drm_i915_private *dev_priv, int *n_entries)
{ {
...@@ -723,18 +741,17 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por ...@@ -723,18 +741,17 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
cnl_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries); cnl_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
hdmi_default_entry = n_hdmi_entries - 1; hdmi_default_entry = n_hdmi_entries - 1;
} else if (IS_GEN9_BC(dev_priv)) { } else if (IS_GEN9_BC(dev_priv)) {
skl_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries); intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
hdmi_default_entry = 8; hdmi_default_entry = 8;
} else if (IS_BROADWELL(dev_priv)) { } else if (IS_BROADWELL(dev_priv)) {
n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi); intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
hdmi_default_entry = 7; hdmi_default_entry = 7;
} else if (IS_HASWELL(dev_priv)) { } else if (IS_HASWELL(dev_priv)) {
n_hdmi_entries = ARRAY_SIZE(hsw_ddi_translations_hdmi); intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
hdmi_default_entry = 6; hdmi_default_entry = 6;
} else { } else {
WARN(1, "ddi translation table missing\n"); WARN(1, "ddi translation table missing\n");
n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi); return 0;
hdmi_default_entry = 7;
} }
/* Choose a good default if VBT is badly populated */ /* Choose a good default if VBT is badly populated */
...@@ -810,23 +827,12 @@ static void intel_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder) ...@@ -810,23 +827,12 @@ static void intel_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder)
hdmi_level = intel_ddi_hdmi_level(dev_priv, port); hdmi_level = intel_ddi_hdmi_level(dev_priv, port);
if (IS_GEN9_BC(dev_priv)) { ddi_translations_hdmi = intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
ddi_translations_hdmi = skl_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
/* If we're boosting the current, set bit 31 of trans1 */ /* If we're boosting the current, set bit 31 of trans1 */
if (dev_priv->vbt.ddi_port_info[port].hdmi_boost_level) if (IS_GEN9_BC(dev_priv) &&
dev_priv->vbt.ddi_port_info[port].hdmi_boost_level)
iboost_bit = DDI_BUF_BALANCE_LEG_ENABLE; iboost_bit = DDI_BUF_BALANCE_LEG_ENABLE;
} else if (IS_BROADWELL(dev_priv)) {
ddi_translations_hdmi = bdw_ddi_translations_hdmi;
n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
} else if (IS_HASWELL(dev_priv)) {
ddi_translations_hdmi = hsw_ddi_translations_hdmi;
n_hdmi_entries = ARRAY_SIZE(hsw_ddi_translations_hdmi);
} else {
WARN(1, "ddi translation table missing\n");
ddi_translations_hdmi = bdw_ddi_translations_hdmi;
n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
}
/* Entry 9 is for HDMI: */ /* Entry 9 is for HDMI: */
I915_WRITE(DDI_BUF_TRANS_LO(port, 9), I915_WRITE(DDI_BUF_TRANS_LO(port, 9),
...@@ -1820,7 +1826,7 @@ static void skl_ddi_set_iboost(struct intel_encoder *encoder, u32 level) ...@@ -1820,7 +1826,7 @@ static void skl_ddi_set_iboost(struct intel_encoder *encoder, u32 level)
if (hdmi_iboost) { if (hdmi_iboost) {
iboost = hdmi_iboost; iboost = hdmi_iboost;
} else { } else {
ddi_translations = skl_get_buf_trans_hdmi(dev_priv, &n_entries); ddi_translations = intel_ddi_get_buf_trans_hdmi(dev_priv, &n_entries);
iboost = ddi_translations[level].i_boost; iboost = ddi_translations[level].i_boost;
} }
} else { } else {
......
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