drm/i915/bios: add intel_bios_port_supports_*()

Don't access i915->vbt.ddi_port_info[] directly.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/21549ff74e8e5746917b0e2be4afbfb141e26657.1579270868.git.jani.nikula@intel.com
This commit is contained in:
Jani Nikula 2020-01-17 16:29:27 +02:00
parent 17004bfb53
commit c5faae5a45
3 changed files with 37 additions and 6 deletions

View File

@ -2606,3 +2606,29 @@ 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_dvi(struct drm_i915_private *i915, enum port port)
{
return i915->vbt.ddi_port_info[port].supports_dvi;
}
bool intel_bios_port_supports_hdmi(struct drm_i915_private *i915, enum port port)
{
return i915->vbt.ddi_port_info[port].supports_hdmi;
}
bool intel_bios_port_supports_dp(struct drm_i915_private *i915, enum port port)
{
return i915->vbt.ddi_port_info[port].supports_dp;
}
bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915,
enum port port)
{
return i915->vbt.ddi_port_info[port].supports_typec_usb;
}
bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port)
{
return i915->vbt.ddi_port_info[port].supports_tbt;
}

View File

@ -253,5 +253,10 @@ 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_dvi(struct drm_i915_private *i915, enum port port);
bool intel_bios_port_supports_hdmi(struct drm_i915_private *i915, enum port port);
bool intel_bios_port_supports_dp(struct drm_i915_private *i915, enum port port);
bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915, enum port port);
bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port);
#endif /* _INTEL_BIOS_H_ */

View File

@ -4780,15 +4780,14 @@ intel_ddi_max_lanes(struct intel_digital_port *intel_dport)
void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
{
struct ddi_vbt_port_info *port_info =
&dev_priv->vbt.ddi_port_info[port];
struct intel_digital_port *intel_dig_port;
struct intel_encoder *encoder;
bool init_hdmi, init_dp, init_lspcon = false;
enum phy phy = intel_port_to_phy(dev_priv, port);
init_hdmi = port_info->supports_dvi || port_info->supports_hdmi;
init_dp = port_info->supports_dp;
init_hdmi = intel_bios_port_supports_dvi(dev_priv, port) ||
intel_bios_port_supports_hdmi(dev_priv, port);
init_dp = intel_bios_port_supports_dp(dev_priv, port);
if (intel_bios_is_lspcon_present(dev_priv, port)) {
/*
@ -4849,8 +4848,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
intel_dig_port->aux_ch = intel_bios_port_aux_ch(dev_priv, port);
if (intel_phy_is_tc(dev_priv, phy)) {
bool is_legacy = !port_info->supports_typec_usb &&
!port_info->supports_tbt;
bool is_legacy =
!intel_bios_port_supports_typec_usb(dev_priv, port) &&
!intel_bios_port_supports_tbt(dev_priv, port);
intel_tc_port_init(intel_dig_port, is_legacy);