|
63 | 63 | #include "intel_dp_hdcp.h" |
64 | 64 | #include "intel_dp_link_training.h" |
65 | 65 | #include "intel_dp_mst.h" |
| 66 | +#include "intel_dp_tunnel.h" |
66 | 67 | #include "intel_dpio_phy.h" |
67 | 68 | #include "intel_dpll.h" |
68 | 69 | #include "intel_fifo_underrun.h" |
@@ -152,6 +153,22 @@ int intel_dp_link_symbol_clock(int rate) |
152 | 153 | return DIV_ROUND_CLOSEST(rate * 10, intel_dp_link_symbol_size(rate)); |
153 | 154 | } |
154 | 155 |
|
| 156 | +static int max_dprx_rate(struct intel_dp *intel_dp) |
| 157 | +{ |
| 158 | + if (intel_dp_tunnel_bw_alloc_is_enabled(intel_dp)) |
| 159 | + return drm_dp_tunnel_max_dprx_rate(intel_dp->tunnel); |
| 160 | + |
| 161 | + return drm_dp_bw_code_to_link_rate(intel_dp->dpcd[DP_MAX_LINK_RATE]); |
| 162 | +} |
| 163 | + |
| 164 | +static int max_dprx_lane_count(struct intel_dp *intel_dp) |
| 165 | +{ |
| 166 | + if (intel_dp_tunnel_bw_alloc_is_enabled(intel_dp)) |
| 167 | + return drm_dp_tunnel_max_dprx_lane_count(intel_dp->tunnel); |
| 168 | + |
| 169 | + return drm_dp_max_lane_count(intel_dp->dpcd); |
| 170 | +} |
| 171 | + |
155 | 172 | static void intel_dp_set_default_sink_rates(struct intel_dp *intel_dp) |
156 | 173 | { |
157 | 174 | intel_dp->sink_rates[0] = 162000; |
@@ -180,7 +197,7 @@ static void intel_dp_set_dpcd_sink_rates(struct intel_dp *intel_dp) |
180 | 197 | /* |
181 | 198 | * Sink rates for 8b/10b. |
182 | 199 | */ |
183 | | - max_rate = drm_dp_bw_code_to_link_rate(intel_dp->dpcd[DP_MAX_LINK_RATE]); |
| 200 | + max_rate = max_dprx_rate(intel_dp); |
184 | 201 | max_lttpr_rate = drm_dp_lttpr_max_link_rate(intel_dp->lttpr_common_caps); |
185 | 202 | if (max_lttpr_rate) |
186 | 203 | max_rate = min(max_rate, max_lttpr_rate); |
@@ -259,7 +276,7 @@ static void intel_dp_set_max_sink_lane_count(struct intel_dp *intel_dp) |
259 | 276 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); |
260 | 277 | struct intel_encoder *encoder = &intel_dig_port->base; |
261 | 278 |
|
262 | | - intel_dp->max_sink_lane_count = drm_dp_max_lane_count(intel_dp->dpcd); |
| 279 | + intel_dp->max_sink_lane_count = max_dprx_lane_count(intel_dp); |
263 | 280 |
|
264 | 281 | switch (intel_dp->max_sink_lane_count) { |
265 | 282 | case 1: |
@@ -389,14 +406,21 @@ int intel_dp_effective_data_rate(int pixel_clock, int bpp_x16, |
389 | 406 | * @max_dprx_rate: Maximum data rate of the DPRX |
390 | 407 | * @max_dprx_lanes: Maximum lane count of the DPRX |
391 | 408 | * |
392 | | - * Calculate the maximum data rate for the provided link parameters. |
| 409 | + * Calculate the maximum data rate for the provided link parameters taking into |
| 410 | + * account any BW limitations by a DP tunnel attached to @intel_dp. |
393 | 411 | * |
394 | 412 | * Returns the maximum data rate in kBps units. |
395 | 413 | */ |
396 | 414 | int intel_dp_max_link_data_rate(struct intel_dp *intel_dp, |
397 | 415 | int max_dprx_rate, int max_dprx_lanes) |
398 | 416 | { |
399 | | - return drm_dp_max_dprx_data_rate(max_dprx_rate, max_dprx_lanes); |
| 417 | + int max_rate = drm_dp_max_dprx_data_rate(max_dprx_rate, max_dprx_lanes); |
| 418 | + |
| 419 | + if (intel_dp_tunnel_bw_alloc_is_enabled(intel_dp)) |
| 420 | + max_rate = min(max_rate, |
| 421 | + drm_dp_tunnel_available_bw(intel_dp->tunnel)); |
| 422 | + |
| 423 | + return max_rate; |
400 | 424 | } |
401 | 425 |
|
402 | 426 | bool intel_dp_can_bigjoiner(struct intel_dp *intel_dp) |
|
0 commit comments