drm/i915/bios: start using intel_bios_encoder_data for Type-C USB and TBT
authorJani Nikula <jani.nikula@intel.com>
Wed, 17 Mar 2021 16:36:52 +0000 (18:36 +0200)
committerJani Nikula <jani.nikula@intel.com>
Thu, 18 Mar 2021 12:44:14 +0000 (14:44 +0200)
Stop caching the information in ddi_port_info. We're phasing out
ddi_port_info usage completely, and prefer using the VBT child device
information directly using the provided helpers.

v2:
- Remove supports_typec_usb & supports_tbt from ddi_vbt_port_info (Lucas)

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/b04bd183e7554aeb4bc3962af90d63171aa32fc2.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/i915_drv.h

index f5be953dda224e8008f0e1ae8c915e24694e75ce..a328d2d6be6a28f79c63bb316620644edd7a787d 100644 (file)
@@ -1858,7 +1858,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;
+       bool is_dvi, is_hdmi, is_dp, is_edp, is_crt, supports_typec_usb, supports_tbt;
        enum port port;
 
        port = dvo_port_to_port(i915, child->dvo_port);
@@ -1882,17 +1882,14 @@ static void parse_ddi_port(struct drm_i915_private *i915,
        is_hdmi = intel_bios_encoder_supports_hdmi(devdata);
        is_edp = intel_bios_encoder_supports_edp(devdata);
 
-       if (i915->vbt.version >= 195)
-               info->supports_typec_usb = child->dp_usb_type_c;
-
-       if (i915->vbt.version >= 209)
-               info->supports_tbt = child->tbt;
+       supports_typec_usb = intel_bios_encoder_supports_typec_usb(devdata);
+       supports_tbt = intel_bios_encoder_supports_tbt(devdata);
 
        drm_dbg_kms(&i915->drm,
                    "Port %c VBT info: CRT:%d DVI:%d HDMI:%d DP:%d eDP:%d LSPCON:%d USB-Type-C:%d TBT:%d DSC:%d\n",
                    port_name(port), is_crt, is_dvi, is_hdmi, is_dp, is_edp,
                    HAS_LSPCON(i915) && child->lspcon,
-                   info->supports_typec_usb, info->supports_tbt,
+                   supports_typec_usb, supports_tbt,
                    devdata->dsc != NULL);
 
        if (is_dvi) {
@@ -2935,15 +2932,14 @@ int intel_bios_alternate_ddc_pin(struct intel_encoder *encoder)
        return i915->vbt.ddi_port_info[encoder->port].alternate_ddc_pin;
 }
 
-bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915,
-                                       enum port port)
+bool intel_bios_encoder_supports_typec_usb(const struct intel_bios_encoder_data *devdata)
 {
-       return i915->vbt.ddi_port_info[port].supports_typec_usb;
+       return devdata->i915->vbt.version >= 195 && devdata->child.dp_usb_type_c;
 }
 
-bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port)
+bool intel_bios_encoder_supports_tbt(const struct intel_bios_encoder_data *devdata)
 {
-       return i915->vbt.ddi_port_info[port].supports_tbt;
+       return devdata->i915->vbt.version >= 209 && devdata->child.tbt;
 }
 
 const struct intel_bios_encoder_data *
index 18b5c2976bd4e19b9202dbcda985bbbcdea44196..f82cef29ab5a0a26f4231aea9e6f10bb87b54793 100644 (file)
@@ -263,5 +263,7 @@ intel_bios_encoder_data_lookup(struct drm_i915_private *i915, enum port port);
 bool intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata);
 bool intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata);
 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);
 
 #endif /* _INTEL_BIOS_H_ */
index d74cfdcabca5adba67a5504a76488f00f7d87a71..b42231a2e2b9c561cb849965edfa4f8b8251c75c 100644 (file)
@@ -4625,8 +4625,8 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 
        if (intel_phy_is_tc(dev_priv, phy)) {
                bool is_legacy =
-                       !intel_bios_port_supports_typec_usb(dev_priv, port) &&
-                       !intel_bios_port_supports_tbt(dev_priv, port);
+                       !intel_bios_encoder_supports_typec_usb(devdata) &&
+                       !intel_bios_encoder_supports_tbt(devdata);
 
                intel_tc_port_init(dig_port, is_legacy);
 
index f1175ad2cc01811bf16244474527b4626a34c6ad..3dd1fabddf6665313d7cf85b1054d7654f44c7a9 100644 (file)
@@ -590,9 +590,6 @@ struct ddi_vbt_port_info {
        u8 hdmi_level_shift;
        u8 hdmi_level_shift_set:1;
 
-       u8 supports_typec_usb:1;
-       u8 supports_tbt:1;
-
        u8 alternate_aux_channel;
        u8 alternate_ddc_pin;