Commit c0a950d1 authored by Jani Nikula's avatar Jani Nikula

drm/i915/bios: add intel_bios_encoder_data to encoder, use for iboost

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@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/4bc49244ce68e136e5b21db4c4e6554bec9ac0fb.1615998927.git.jani.nikula@intel.com
parent f08fbe6a
......@@ -1859,6 +1859,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);
......@@ -1949,17 +1950,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) {
......@@ -2904,18 +2906,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)
......
......@@ -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_ */
......@@ -113,7 +113,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++) {
......@@ -146,7 +146,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: */
......@@ -905,9 +905,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;
......@@ -4478,6 +4478,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);
......
......@@ -234,6 +234,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 {
......
......@@ -593,8 +593,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 */
};
......
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