Commit 4182a311 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Parse DP/eDP max lane count from VBT

Limit the DP lane count based on the new VBT DP/eDP max
lane count field.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220715202044.11153-13-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
parent ac7af83a
...@@ -2515,6 +2515,14 @@ static int _intel_bios_dp_max_link_rate(const struct intel_bios_encoder_data *de ...@@ -2515,6 +2515,14 @@ static int _intel_bios_dp_max_link_rate(const struct intel_bios_encoder_data *de
return parse_bdb_216_dp_max_link_rate(devdata->child.dp_max_link_rate); return parse_bdb_216_dp_max_link_rate(devdata->child.dp_max_link_rate);
} }
static int _intel_bios_dp_max_lane_count(const struct intel_bios_encoder_data *devdata)
{
if (!devdata || devdata->i915->display.vbt.version < 244)
return 0;
return devdata->child.dp_max_lane_count + 1;
}
static void sanitize_device_type(struct intel_bios_encoder_data *devdata, static void sanitize_device_type(struct intel_bios_encoder_data *devdata,
enum port port) enum port port)
{ {
...@@ -3696,6 +3704,14 @@ int intel_bios_dp_max_link_rate(struct intel_encoder *encoder) ...@@ -3696,6 +3704,14 @@ int intel_bios_dp_max_link_rate(struct intel_encoder *encoder)
return _intel_bios_dp_max_link_rate(devdata); return _intel_bios_dp_max_link_rate(devdata);
} }
int intel_bios_dp_max_lane_count(struct intel_encoder *encoder)
{
struct drm_i915_private *i915 = to_i915(encoder->base.dev);
const struct intel_bios_encoder_data *devdata = i915->display.vbt.ports[encoder->port];
return _intel_bios_dp_max_lane_count(devdata);
}
int intel_bios_alternate_ddc_pin(struct intel_encoder *encoder) int intel_bios_alternate_ddc_pin(struct intel_encoder *encoder)
{ {
struct drm_i915_private *i915 = to_i915(encoder->base.dev); struct drm_i915_private *i915 = to_i915(encoder->base.dev);
......
...@@ -258,6 +258,7 @@ bool intel_bios_get_dsc_params(struct intel_encoder *encoder, ...@@ -258,6 +258,7 @@ bool intel_bios_get_dsc_params(struct intel_encoder *encoder,
int intel_bios_max_tmds_clock(struct intel_encoder *encoder); int intel_bios_max_tmds_clock(struct intel_encoder *encoder);
int intel_bios_hdmi_level_shift(struct intel_encoder *encoder); int intel_bios_hdmi_level_shift(struct intel_encoder *encoder);
int intel_bios_dp_max_link_rate(struct intel_encoder *encoder); int intel_bios_dp_max_link_rate(struct intel_encoder *encoder);
int intel_bios_dp_max_lane_count(struct intel_encoder *encoder);
int intel_bios_alternate_ddc_pin(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); 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); bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port);
......
...@@ -286,11 +286,22 @@ static int intel_dp_max_common_rate(struct intel_dp *intel_dp) ...@@ -286,11 +286,22 @@ static int intel_dp_max_common_rate(struct intel_dp *intel_dp)
return intel_dp_common_rate(intel_dp, intel_dp->num_common_rates - 1); return intel_dp_common_rate(intel_dp, intel_dp->num_common_rates - 1);
} }
static int intel_dp_max_source_lane_count(struct intel_digital_port *dig_port)
{
int vbt_max_lanes = intel_bios_dp_max_lane_count(&dig_port->base);
int max_lanes = dig_port->max_lanes;
if (vbt_max_lanes)
max_lanes = min(max_lanes, vbt_max_lanes);
return max_lanes;
}
/* Theoretical max between source and sink */ /* Theoretical max between source and sink */
static int intel_dp_max_common_lane_count(struct intel_dp *intel_dp) static int intel_dp_max_common_lane_count(struct intel_dp *intel_dp)
{ {
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
int source_max = dig_port->max_lanes; int source_max = intel_dp_max_source_lane_count(dig_port);
int sink_max = intel_dp->max_sink_lane_count; int sink_max = intel_dp->max_sink_lane_count;
int fia_max = intel_tc_port_fia_max_lane_count(dig_port); int fia_max = intel_tc_port_fia_max_lane_count(dig_port);
int lttpr_max = drm_dp_lttpr_max_lane_count(intel_dp->lttpr_common_caps); int lttpr_max = drm_dp_lttpr_max_lane_count(intel_dp->lttpr_common_caps);
......
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