]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/bios: add intel_bios_encoder_data to encoder, use for iboost
authorJani Nikula <jani.nikula@intel.com>
Wed, 17 Mar 2021 16:36:53 +0000 (18:36 +0200)
committerJani Nikula <jani.nikula@intel.com>
Thu, 18 Mar 2021 12:44:16 +0000 (14:44 +0200)
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: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/4bc49244ce68e136e5b21db4c4e6554bec9ac0fb.1615998927.git.jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_bios.c
drivers/gpu/drm/i915/display/intel_bios.h
drivers/gpu/drm/i915/display/intel_ddi.c
drivers/gpu/drm/i915/display/intel_display_types.h
drivers/gpu/drm/i915/i915_drv.h

index a328d2d6be6a28f79c63bb316620644edd7a787d..63bc8cdc1d98b8f819b991a9460046d14ee19817 100644 (file)
@@ -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)
index f82cef29ab5a0a26f4231aea9e6f10bb87b54793..4709c4d298059d2babb42c6909369a05d0aec365 100644 (file)
@@ -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_ */
index b42231a2e2b9c561cb849965edfa4f8b8251c75c..75655f47f26c3b4389f1cfe64be81b6f85bdc620 100644 (file)
@@ -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);
index eaebba5889d2bb77dad8e7b0b73e1785bef12ccd..012863b5617448a4a8028ba83c4a17e69dabf364 100644 (file)
@@ -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 {
index 3dd1fabddf6665313d7cf85b1054d7654f44c7a9..a01f01fc0ad2dd8f9f0a5eeb3c85e55a444442f5 100644 (file)
@@ -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 */
 };