Add intel_bios_encoder_data pointer to encoder, and use it for hdmi and dp iboost. For starters, we only set the encoder->devdata for DDI encoders, i.e. we can only use it for data that is used by DDI encoders. Cc: Lucas De Marchi <lucas.demarchi@xxxxxxxxx> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> --- drivers/gpu/drm/i915/display/intel_bios.c | 30 +++++++++++-------- drivers/gpu/drm/i915/display/intel_bios.h | 4 +-- drivers/gpu/drm/i915/display/intel_ddi.c | 9 +++--- .../drm/i915/display/intel_display_types.h | 3 ++ drivers/gpu/drm/i915/i915_drv.h | 2 -- 5 files changed, 27 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c index 13a38cd01692..e1fcaf567222 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -1819,6 +1819,7 @@ static void parse_ddi_port(struct drm_i915_private *i915, const struct child_device_config *child = &devdata->child; struct ddi_vbt_port_info *info; bool is_dvi, is_hdmi, is_dp, is_edp, is_crt, supports_typec_usb, supports_tbt; + int dp_boost_level, hdmi_boost_level; enum port port; port = dvo_port_to_port(i915, child->dvo_port); @@ -1912,17 +1913,18 @@ static void parse_ddi_port(struct drm_i915_private *i915, info->max_tmds_clock = max_tmds_clock; } - /* Parse the I_boost config for SKL and above */ - if (i915->vbt.version >= 196 && child->iboost) { - info->dp_boost_level = translate_iboost(child->dp_iboost_level); + /* I_boost config for SKL and above */ + dp_boost_level = intel_bios_encoder_dp_boost_level(devdata); + if (dp_boost_level) drm_dbg_kms(&i915->drm, "Port %c VBT (e)DP boost level: %d\n", - port_name(port), info->dp_boost_level); - info->hdmi_boost_level = translate_iboost(child->hdmi_iboost_level); + port_name(port), dp_boost_level); + + hdmi_boost_level = intel_bios_encoder_hdmi_boost_level(devdata); + if (hdmi_boost_level) drm_dbg_kms(&i915->drm, "Port %c VBT HDMI boost level: %d\n", - port_name(port), info->hdmi_boost_level); - } + port_name(port), hdmi_boost_level); /* DP max link rate for CNL+ */ if (i915->vbt.version >= 216) { @@ -2872,18 +2874,20 @@ int intel_bios_hdmi_level_shift(struct intel_encoder *encoder) return info->hdmi_level_shift_set ? info->hdmi_level_shift : -1; } -int intel_bios_dp_boost_level(struct intel_encoder *encoder) +int intel_bios_encoder_dp_boost_level(const struct intel_bios_encoder_data *devdata) { - struct drm_i915_private *i915 = to_i915(encoder->base.dev); + if (!devdata || devdata->i915->vbt.version < 196 || !devdata->child.iboost) + return 0; - return i915->vbt.ddi_port_info[encoder->port].dp_boost_level; + return translate_iboost(devdata->child.dp_iboost_level); } -int intel_bios_hdmi_boost_level(struct intel_encoder *encoder) +int intel_bios_encoder_hdmi_boost_level(const struct intel_bios_encoder_data *devdata) { - struct drm_i915_private *i915 = to_i915(encoder->base.dev); + if (!devdata || devdata->i915->vbt.version < 196 || !devdata->child.iboost) + return 0; - return i915->vbt.ddi_port_info[encoder->port].hdmi_boost_level; + return translate_iboost(devdata->child.hdmi_iboost_level); } int intel_bios_dp_max_link_rate(struct intel_encoder *encoder) diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h index f82cef29ab5a..4709c4d29805 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.h +++ b/drivers/gpu/drm/i915/display/intel_bios.h @@ -250,8 +250,6 @@ bool intel_bios_get_dsc_params(struct intel_encoder *encoder, int dsc_max_bpc); int intel_bios_max_tmds_clock(struct intel_encoder *encoder); int intel_bios_hdmi_level_shift(struct intel_encoder *encoder); -int intel_bios_dp_boost_level(struct intel_encoder *encoder); -int intel_bios_hdmi_boost_level(struct intel_encoder *encoder); int intel_bios_dp_max_link_rate(struct intel_encoder *encoder); int intel_bios_alternate_ddc_pin(struct intel_encoder *encoder); bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915, enum port port); @@ -265,5 +263,7 @@ bool intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devd bool intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata); bool intel_bios_encoder_supports_typec_usb(const struct intel_bios_encoder_data *devdata); bool intel_bios_encoder_supports_tbt(const struct intel_bios_encoder_data *devdata); +int intel_bios_encoder_dp_boost_level(const struct intel_bios_encoder_data *devdata); +int intel_bios_encoder_hdmi_boost_level(const struct intel_bios_encoder_data *devdata); #endif /* _INTEL_BIOS_H_ */ diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index 0bf783f67a59..92aad11cc0e7 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -114,7 +114,7 @@ void intel_prepare_dp_ddi_buffers(struct intel_encoder *encoder, &n_entries); /* If we're boosting the current, set bit 31 of trans1 */ - if (IS_GEN9_BC(dev_priv) && intel_bios_dp_boost_level(encoder)) + if (IS_GEN9_BC(dev_priv) && intel_bios_encoder_dp_boost_level(encoder->devdata)) iboost_bit = DDI_BUF_BALANCE_LEG_ENABLE; for (i = 0; i < n_entries; i++) { @@ -147,7 +147,7 @@ static void intel_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder, level = n_entries - 1; /* If we're boosting the current, set bit 31 of trans1 */ - if (IS_GEN9_BC(dev_priv) && intel_bios_hdmi_boost_level(encoder)) + if (IS_GEN9_BC(dev_priv) && intel_bios_encoder_hdmi_boost_level(encoder->devdata)) iboost_bit = DDI_BUF_BALANCE_LEG_ENABLE; /* Entry 9 is for HDMI: */ @@ -925,9 +925,9 @@ static void skl_ddi_set_iboost(struct intel_encoder *encoder, u8 iboost; if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) - iboost = intel_bios_hdmi_boost_level(encoder); + iboost = intel_bios_encoder_hdmi_boost_level(encoder->devdata); else - iboost = intel_bios_dp_boost_level(encoder); + iboost = intel_bios_encoder_dp_boost_level(encoder->devdata); if (iboost == 0) { const struct ddi_buf_trans *ddi_translations; @@ -4025,6 +4025,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) return; encoder = &dig_port->base; + encoder->devdata = devdata; if (INTEL_GEN(dev_priv) >= 12) { enum tc_port tc_port = intel_port_to_tc(dev_priv, port); diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 07b7f5eae587..91642b25ebcc 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -230,6 +230,9 @@ struct intel_encoder { enum intel_display_power_domain power_domain; /* for communication with audio component; protected by av_mutex */ const struct drm_connector *audio_connector; + + /* VBT information for this encoder (may be NULL for older platforms) */ + const struct intel_bios_encoder_data *devdata; }; struct intel_panel_bl_funcs { diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 57712a617839..03a6d9738fee 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -600,8 +600,6 @@ struct ddi_vbt_port_info { u8 alternate_aux_channel; u8 alternate_ddc_pin; - u8 dp_boost_level; - u8 hdmi_boost_level; int dp_max_link_rate; /* 0 for not limited by VBT */ }; -- 2.20.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx