Lines Matching refs:intel_dp
115 bool intel_dp_is_edp(struct intel_dp *intel_dp) in intel_dp_is_edp() argument
117 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); in intel_dp_is_edp()
122 static void intel_dp_unset_edid(struct intel_dp *intel_dp);
130 static void intel_dp_set_default_sink_rates(struct intel_dp *intel_dp) in intel_dp_set_default_sink_rates() argument
132 intel_dp->sink_rates[0] = 162000; in intel_dp_set_default_sink_rates()
133 intel_dp->num_sink_rates = 1; in intel_dp_set_default_sink_rates()
137 static void intel_dp_set_dpcd_sink_rates(struct intel_dp *intel_dp) in intel_dp_set_dpcd_sink_rates() argument
145 if (drm_dp_has_quirk(&intel_dp->desc, DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS)) { in intel_dp_set_dpcd_sink_rates()
149 memcpy(intel_dp->sink_rates, quirk_rates, sizeof(quirk_rates)); in intel_dp_set_dpcd_sink_rates()
150 intel_dp->num_sink_rates = ARRAY_SIZE(quirk_rates); in intel_dp_set_dpcd_sink_rates()
158 max_rate = drm_dp_bw_code_to_link_rate(intel_dp->dpcd[DP_MAX_LINK_RATE]); in intel_dp_set_dpcd_sink_rates()
159 max_lttpr_rate = drm_dp_lttpr_max_link_rate(intel_dp->lttpr_common_caps); in intel_dp_set_dpcd_sink_rates()
166 intel_dp->sink_rates[i] = dp_rates[i]; in intel_dp_set_dpcd_sink_rates()
173 if (intel_dp->dpcd[DP_MAIN_LINK_CHANNEL_CODING] & DP_CAP_ANSI_128B132B) { in intel_dp_set_dpcd_sink_rates()
176 BUILD_BUG_ON(ARRAY_SIZE(intel_dp->sink_rates) < ARRAY_SIZE(dp_rates) + 3); in intel_dp_set_dpcd_sink_rates()
178 drm_dp_dpcd_readb(&intel_dp->aux, in intel_dp_set_dpcd_sink_rates()
181 if (drm_dp_lttpr_count(intel_dp->lttpr_common_caps)) { in intel_dp_set_dpcd_sink_rates()
183 if (intel_dp->lttpr_common_caps[0] >= 0x20 && in intel_dp_set_dpcd_sink_rates()
184 intel_dp->lttpr_common_caps[DP_MAIN_LINK_CHANNEL_CODING_PHY_REPEATER - in intel_dp_set_dpcd_sink_rates()
188 uhbr_rates &= intel_dp->lttpr_common_caps[DP_PHY_REPEATER_128B132B_RATES - in intel_dp_set_dpcd_sink_rates()
197 intel_dp->sink_rates[i++] = 1000000; in intel_dp_set_dpcd_sink_rates()
199 intel_dp->sink_rates[i++] = 1350000; in intel_dp_set_dpcd_sink_rates()
201 intel_dp->sink_rates[i++] = 2000000; in intel_dp_set_dpcd_sink_rates()
204 intel_dp->num_sink_rates = i; in intel_dp_set_dpcd_sink_rates()
207 static void intel_dp_set_sink_rates(struct intel_dp *intel_dp) in intel_dp_set_sink_rates() argument
209 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_set_sink_rates()
210 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); in intel_dp_set_sink_rates()
213 intel_dp_set_dpcd_sink_rates(intel_dp); in intel_dp_set_sink_rates()
215 if (intel_dp->num_sink_rates) in intel_dp_set_sink_rates()
218 drm_err(&dp_to_i915(intel_dp)->drm, in intel_dp_set_sink_rates()
223 intel_dp_set_default_sink_rates(intel_dp); in intel_dp_set_sink_rates()
226 static void intel_dp_set_default_max_sink_lane_count(struct intel_dp *intel_dp) in intel_dp_set_default_max_sink_lane_count() argument
228 intel_dp->max_sink_lane_count = 1; in intel_dp_set_default_max_sink_lane_count()
231 static void intel_dp_set_max_sink_lane_count(struct intel_dp *intel_dp) in intel_dp_set_max_sink_lane_count() argument
233 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_set_max_sink_lane_count()
234 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); in intel_dp_set_max_sink_lane_count()
237 intel_dp->max_sink_lane_count = drm_dp_max_lane_count(intel_dp->dpcd); in intel_dp_set_max_sink_lane_count()
239 switch (intel_dp->max_sink_lane_count) { in intel_dp_set_max_sink_lane_count()
246 drm_err(&dp_to_i915(intel_dp)->drm, in intel_dp_set_max_sink_lane_count()
250 intel_dp->max_sink_lane_count); in intel_dp_set_max_sink_lane_count()
252 intel_dp_set_default_max_sink_lane_count(intel_dp); in intel_dp_set_max_sink_lane_count()
270 static int intel_dp_common_len_rate_limit(const struct intel_dp *intel_dp, in intel_dp_common_len_rate_limit() argument
273 return intel_dp_rate_limit_len(intel_dp->common_rates, in intel_dp_common_len_rate_limit()
274 intel_dp->num_common_rates, max_rate); in intel_dp_common_len_rate_limit()
277 static int intel_dp_common_rate(struct intel_dp *intel_dp, int index) in intel_dp_common_rate() argument
279 if (drm_WARN_ON(&dp_to_i915(intel_dp)->drm, in intel_dp_common_rate()
280 index < 0 || index >= intel_dp->num_common_rates)) in intel_dp_common_rate()
283 return intel_dp->common_rates[index]; in intel_dp_common_rate()
287 static int intel_dp_max_common_rate(struct intel_dp *intel_dp) in intel_dp_max_common_rate() argument
289 return intel_dp_common_rate(intel_dp, intel_dp->num_common_rates - 1); in intel_dp_max_common_rate()
304 static int intel_dp_max_common_lane_count(struct intel_dp *intel_dp) in intel_dp_max_common_lane_count() argument
306 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); in intel_dp_max_common_lane_count()
308 int sink_max = intel_dp->max_sink_lane_count; in intel_dp_max_common_lane_count()
310 int lttpr_max = drm_dp_lttpr_max_lane_count(intel_dp->lttpr_common_caps); in intel_dp_max_common_lane_count()
318 int intel_dp_max_lane_count(struct intel_dp *intel_dp) in intel_dp_max_lane_count() argument
320 switch (intel_dp->max_link_lane_count) { in intel_dp_max_lane_count()
324 return intel_dp->max_link_lane_count; in intel_dp_max_lane_count()
326 MISSING_CASE(intel_dp->max_link_lane_count); in intel_dp_max_lane_count()
390 bool intel_dp_can_bigjoiner(struct intel_dp *intel_dp) in intel_dp_can_bigjoiner() argument
392 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); in intel_dp_can_bigjoiner()
401 static int dg2_max_source_rate(struct intel_dp *intel_dp) in dg2_max_source_rate() argument
403 return intel_dp_is_edp(intel_dp) ? 810000 : 1350000; in dg2_max_source_rate()
406 static int icl_max_source_rate(struct intel_dp *intel_dp) in icl_max_source_rate() argument
408 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); in icl_max_source_rate()
412 if (intel_phy_is_combo(dev_priv, phy) && !intel_dp_is_edp(intel_dp)) in icl_max_source_rate()
418 static int ehl_max_source_rate(struct intel_dp *intel_dp) in ehl_max_source_rate() argument
420 if (intel_dp_is_edp(intel_dp)) in ehl_max_source_rate()
426 static int mtl_max_source_rate(struct intel_dp *intel_dp) in mtl_max_source_rate() argument
428 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); in mtl_max_source_rate()
438 static int vbt_max_link_rate(struct intel_dp *intel_dp) in vbt_max_link_rate() argument
440 struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base; in vbt_max_link_rate()
445 if (intel_dp_is_edp(intel_dp)) { in vbt_max_link_rate()
446 struct intel_connector *connector = intel_dp->attached_connector; in vbt_max_link_rate()
459 intel_dp_set_source_rates(struct intel_dp *intel_dp) in intel_dp_set_source_rates() argument
482 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); in intel_dp_set_source_rates()
489 intel_dp->source_rates || intel_dp->num_source_rates); in intel_dp_set_source_rates()
494 max_rate = mtl_max_source_rate(intel_dp); in intel_dp_set_source_rates()
499 max_rate = dg2_max_source_rate(intel_dp); in intel_dp_set_source_rates()
504 max_rate = ehl_max_source_rate(intel_dp); in intel_dp_set_source_rates()
506 max_rate = icl_max_source_rate(intel_dp); in intel_dp_set_source_rates()
522 vbt_max_rate = vbt_max_link_rate(intel_dp); in intel_dp_set_source_rates()
531 intel_dp->source_rates = source_rates; in intel_dp_set_source_rates()
532 intel_dp->num_source_rates = size; in intel_dp_set_source_rates()
570 static void intel_dp_set_common_rates(struct intel_dp *intel_dp) in intel_dp_set_common_rates() argument
572 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_set_common_rates()
575 !intel_dp->num_source_rates || !intel_dp->num_sink_rates); in intel_dp_set_common_rates()
577 intel_dp->num_common_rates = intersect_rates(intel_dp->source_rates, in intel_dp_set_common_rates()
578 intel_dp->num_source_rates, in intel_dp_set_common_rates()
579 intel_dp->sink_rates, in intel_dp_set_common_rates()
580 intel_dp->num_sink_rates, in intel_dp_set_common_rates()
581 intel_dp->common_rates); in intel_dp_set_common_rates()
584 if (drm_WARN_ON(&i915->drm, intel_dp->num_common_rates == 0)) { in intel_dp_set_common_rates()
585 intel_dp->common_rates[0] = 162000; in intel_dp_set_common_rates()
586 intel_dp->num_common_rates = 1; in intel_dp_set_common_rates()
590 static bool intel_dp_link_params_valid(struct intel_dp *intel_dp, int link_rate, in intel_dp_link_params_valid() argument
599 link_rate > intel_dp->max_link_rate) in intel_dp_link_params_valid()
603 lane_count > intel_dp_max_lane_count(intel_dp)) in intel_dp_link_params_valid()
609 static bool intel_dp_can_link_train_fallback_for_edp(struct intel_dp *intel_dp, in intel_dp_can_link_train_fallback_for_edp() argument
615 intel_panel_preferred_fixed_mode(intel_dp->attached_connector); in intel_dp_can_link_train_fallback_for_edp()
626 int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, in intel_dp_get_link_train_fallback_values() argument
629 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_get_link_train_fallback_values()
636 if (intel_dp->is_mst) { in intel_dp_get_link_train_fallback_values()
641 if (intel_dp_is_edp(intel_dp) && !intel_dp->use_max_params) { in intel_dp_get_link_train_fallback_values()
644 intel_dp->use_max_params = true; in intel_dp_get_link_train_fallback_values()
648 index = intel_dp_rate_index(intel_dp->common_rates, in intel_dp_get_link_train_fallback_values()
649 intel_dp->num_common_rates, in intel_dp_get_link_train_fallback_values()
652 if (intel_dp_is_edp(intel_dp) && in intel_dp_get_link_train_fallback_values()
653 !intel_dp_can_link_train_fallback_for_edp(intel_dp, in intel_dp_get_link_train_fallback_values()
654 intel_dp_common_rate(intel_dp, index - 1), in intel_dp_get_link_train_fallback_values()
660 intel_dp->max_link_rate = intel_dp_common_rate(intel_dp, index - 1); in intel_dp_get_link_train_fallback_values()
661 intel_dp->max_link_lane_count = lane_count; in intel_dp_get_link_train_fallback_values()
663 if (intel_dp_is_edp(intel_dp) && in intel_dp_get_link_train_fallback_values()
664 !intel_dp_can_link_train_fallback_for_edp(intel_dp, in intel_dp_get_link_train_fallback_values()
665 intel_dp_max_common_rate(intel_dp), in intel_dp_get_link_train_fallback_values()
671 intel_dp->max_link_rate = intel_dp_max_common_rate(intel_dp); in intel_dp_get_link_train_fallback_values()
672 intel_dp->max_link_lane_count = lane_count >> 1; in intel_dp_get_link_train_fallback_values()
807 u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp, in intel_dp_dsc_get_slice_count() argument
811 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_dsc_get_slice_count()
829 max_slice_width = drm_dp_dsc_sink_max_slice_width(intel_dp->dsc_dpcd); in intel_dp_dsc_get_slice_count()
846 drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd, false)) in intel_dp_dsc_get_slice_count()
862 static bool source_can_output(struct intel_dp *intel_dp, in source_can_output() argument
865 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in source_can_output()
890 dfp_can_convert_from_rgb(struct intel_dp *intel_dp, in dfp_can_convert_from_rgb() argument
893 if (!drm_dp_is_branch(intel_dp->dpcd)) in dfp_can_convert_from_rgb()
897 return intel_dp->dfp.rgb_to_ycbcr; in dfp_can_convert_from_rgb()
900 return intel_dp->dfp.rgb_to_ycbcr && in dfp_can_convert_from_rgb()
901 intel_dp->dfp.ycbcr_444_to_420; in dfp_can_convert_from_rgb()
907 dfp_can_convert_from_ycbcr444(struct intel_dp *intel_dp, in dfp_can_convert_from_ycbcr444() argument
910 if (!drm_dp_is_branch(intel_dp->dpcd)) in dfp_can_convert_from_ycbcr444()
914 return intel_dp->dfp.ycbcr_444_to_420; in dfp_can_convert_from_ycbcr444()
923 struct intel_dp *intel_dp = intel_attached_dp(connector); in intel_dp_output_format() local
924 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_output_format()
927 if (intel_dp->force_dsc_output_format) in intel_dp_output_format()
928 return intel_dp->force_dsc_output_format; in intel_dp_output_format()
931 dfp_can_convert_from_rgb(intel_dp, sink_format)) in intel_dp_output_format()
935 dfp_can_convert_from_ycbcr444(intel_dp, sink_format)) in intel_dp_output_format()
941 drm_WARN_ON(&i915->drm, !source_can_output(intel_dp, output_format)); in intel_dp_output_format()
1011 static int intel_dp_max_tmds_clock(struct intel_dp *intel_dp) in intel_dp_max_tmds_clock() argument
1013 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_max_tmds_clock()
1015 int max_tmds_clock = intel_dp->dfp.max_tmds_clock; in intel_dp_max_tmds_clock()
1025 intel_dp_tmds_clock_valid(struct intel_dp *intel_dp, in intel_dp_tmds_clock_valid() argument
1037 min_tmds_clock = intel_dp->dfp.min_tmds_clock; in intel_dp_tmds_clock_valid()
1038 max_tmds_clock = intel_dp_max_tmds_clock(intel_dp); in intel_dp_tmds_clock_valid()
1054 struct intel_dp *intel_dp = intel_attached_dp(connector); in intel_dp_mode_valid_downstream() local
1060 if (intel_dp->dfp.pcon_max_frl_bw) { in intel_dp_mode_valid_downstream()
1067 max_frl_bw = intel_dp->dfp.pcon_max_frl_bw; in intel_dp_mode_valid_downstream()
1078 if (intel_dp->dfp.max_dotclock && in intel_dp_mode_valid_downstream()
1079 target_clock > intel_dp->dfp.max_dotclock) in intel_dp_mode_valid_downstream()
1085 status = intel_dp_tmds_clock_valid(intel_dp, target_clock, in intel_dp_mode_valid_downstream()
1094 status = intel_dp_tmds_clock_valid(intel_dp, target_clock, in intel_dp_mode_valid_downstream()
1103 bool intel_dp_need_bigjoiner(struct intel_dp *intel_dp, in intel_dp_need_bigjoiner() argument
1106 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_need_bigjoiner()
1108 if (!intel_dp_can_bigjoiner(intel_dp)) in intel_dp_need_bigjoiner()
1119 struct intel_dp *intel_dp = intel_attached_dp(connector); in intel_dp_mode_valid() local
1138 if (intel_dp_is_edp(intel_dp) && fixed_mode) { in intel_dp_mode_valid()
1149 if (intel_dp_need_bigjoiner(intel_dp, mode->hdisplay, target_clock)) { in intel_dp_mode_valid()
1159 max_link_clock = intel_dp_max_link_rate(intel_dp); in intel_dp_mode_valid()
1160 max_lanes = intel_dp_max_lane_count(intel_dp); in intel_dp_mode_valid()
1167 drm_dp_sink_supports_dsc(intel_dp->dsc_dpcd)) { in intel_dp_mode_valid()
1172 int pipe_bpp = intel_dp_dsc_compute_bpp(intel_dp, U8_MAX); in intel_dp_mode_valid()
1178 if (intel_dp_is_edp(intel_dp)) { in intel_dp_mode_valid()
1180 drm_edp_dsc_sink_output_bpp(intel_dp->dsc_dpcd) >> 4; in intel_dp_mode_valid()
1182 drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd, in intel_dp_mode_valid()
1184 } else if (drm_dp_sink_supports_fec(intel_dp->fec_capable)) { in intel_dp_mode_valid()
1194 intel_dp_dsc_get_slice_count(intel_dp, in intel_dp_mode_valid()
1246 static void intel_dp_print_rates(struct intel_dp *intel_dp) in intel_dp_print_rates() argument
1248 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_print_rates()
1255 intel_dp->source_rates, intel_dp->num_source_rates); in intel_dp_print_rates()
1259 intel_dp->sink_rates, intel_dp->num_sink_rates); in intel_dp_print_rates()
1263 intel_dp->common_rates, intel_dp->num_common_rates); in intel_dp_print_rates()
1268 intel_dp_max_link_rate(struct intel_dp *intel_dp) in intel_dp_max_link_rate() argument
1272 len = intel_dp_common_len_rate_limit(intel_dp, intel_dp->max_link_rate); in intel_dp_max_link_rate()
1274 return intel_dp_common_rate(intel_dp, len - 1); in intel_dp_max_link_rate()
1277 int intel_dp_rate_select(struct intel_dp *intel_dp, int rate) in intel_dp_rate_select() argument
1279 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_rate_select()
1280 int i = intel_dp_rate_index(intel_dp->sink_rates, in intel_dp_rate_select()
1281 intel_dp->num_sink_rates, rate); in intel_dp_rate_select()
1289 void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock, in intel_dp_compute_rate() argument
1293 if (intel_dp->use_rate_select) { in intel_dp_compute_rate()
1296 intel_dp_rate_select(intel_dp, port_clock); in intel_dp_compute_rate()
1303 bool intel_dp_has_hdmi_sink(struct intel_dp *intel_dp) in intel_dp_has_hdmi_sink() argument
1305 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_has_hdmi_sink()
1310 static bool intel_dp_source_supports_fec(struct intel_dp *intel_dp, in intel_dp_source_supports_fec() argument
1313 struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); in intel_dp_source_supports_fec()
1325 static bool intel_dp_supports_fec(struct intel_dp *intel_dp, in intel_dp_supports_fec() argument
1328 return intel_dp_source_supports_fec(intel_dp, pipe_config) && in intel_dp_supports_fec()
1329 drm_dp_sink_supports_fec(intel_dp->fec_capable); in intel_dp_supports_fec()
1332 static bool intel_dp_supports_dsc(struct intel_dp *intel_dp, in intel_dp_supports_dsc() argument
1339 drm_dp_sink_supports_dsc(intel_dp->dsc_dpcd); in intel_dp_supports_dsc()
1342 static int intel_dp_hdmi_compute_bpc(struct intel_dp *intel_dp, in intel_dp_hdmi_compute_bpc() argument
1365 intel_dp_has_hdmi_sink(intel_dp)) && in intel_dp_hdmi_compute_bpc()
1366 intel_dp_tmds_clock_valid(intel_dp, clock, bpc, crtc_state->sink_format, in intel_dp_hdmi_compute_bpc()
1374 static int intel_dp_max_bpp(struct intel_dp *intel_dp, in intel_dp_max_bpp() argument
1378 struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); in intel_dp_max_bpp()
1379 struct intel_connector *intel_connector = intel_dp->attached_connector; in intel_dp_max_bpp()
1384 if (intel_dp->dfp.max_bpc) in intel_dp_max_bpp()
1385 bpc = min_t(int, bpc, intel_dp->dfp.max_bpc); in intel_dp_max_bpp()
1387 if (intel_dp->dfp.min_tmds_clock) { in intel_dp_max_bpp()
1390 max_hdmi_bpc = intel_dp_hdmi_compute_bpc(intel_dp, crtc_state, bpc, in intel_dp_max_bpp()
1399 if (intel_dp_is_edp(intel_dp)) { in intel_dp_max_bpp()
1416 intel_dp_adjust_compliance_config(struct intel_dp *intel_dp, in intel_dp_adjust_compliance_config() argument
1420 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_adjust_compliance_config()
1423 if (intel_dp->compliance.test_data.bpc != 0) { in intel_dp_adjust_compliance_config()
1424 int bpp = 3 * intel_dp->compliance.test_data.bpc; in intel_dp_adjust_compliance_config()
1433 if (intel_dp->compliance.test_type == DP_TEST_LINK_TRAINING) { in intel_dp_adjust_compliance_config()
1439 if (intel_dp_link_params_valid(intel_dp, intel_dp->compliance.test_link_rate, in intel_dp_adjust_compliance_config()
1440 intel_dp->compliance.test_lane_count)) { in intel_dp_adjust_compliance_config()
1441 index = intel_dp_rate_index(intel_dp->common_rates, in intel_dp_adjust_compliance_config()
1442 intel_dp->num_common_rates, in intel_dp_adjust_compliance_config()
1443 intel_dp->compliance.test_link_rate); in intel_dp_adjust_compliance_config()
1446 intel_dp->compliance.test_link_rate; in intel_dp_adjust_compliance_config()
1448 intel_dp->compliance.test_lane_count; in intel_dp_adjust_compliance_config()
1480 intel_dp_compute_link_config_wide(struct intel_dp *intel_dp, in intel_dp_compute_link_config_wide() argument
1493 for (i = 0; i < intel_dp->num_common_rates; i++) { in intel_dp_compute_link_config_wide()
1494 link_rate = intel_dp_common_rate(intel_dp, i); in intel_dp_compute_link_config_wide()
1519 int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 max_req_bpc) in intel_dp_dsc_compute_bpp() argument
1521 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_dsc_compute_bpp()
1532 num_bpc = drm_dp_dsc_sink_supported_input_bpcs(intel_dp->dsc_dpcd, in intel_dp_dsc_compute_bpp()
1542 static int intel_dp_source_dsc_version_minor(struct intel_dp *intel_dp) in intel_dp_source_dsc_version_minor() argument
1544 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_source_dsc_version_minor()
1549 static int intel_dp_sink_dsc_version_minor(struct intel_dp *intel_dp) in intel_dp_sink_dsc_version_minor() argument
1551 return (intel_dp->dsc_dpcd[DP_DSC_REV - DP_DSC_SUPPORT] & DP_DSC_MINOR_MASK) >> in intel_dp_sink_dsc_version_minor()
1581 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); in intel_dp_dsc_compute_params() local
1602 (intel_dp->dsc_dpcd[DP_DSC_REV - DP_DSC_SUPPORT] & in intel_dp_dsc_compute_params()
1605 min(intel_dp_source_dsc_version_minor(intel_dp), in intel_dp_dsc_compute_params()
1606 intel_dp_sink_dsc_version_minor(intel_dp)); in intel_dp_dsc_compute_params()
1609 intel_dp->dsc_dpcd[DP_DSC_DEC_COLOR_FORMAT_CAP - DP_DSC_SUPPORT] & in intel_dp_dsc_compute_params()
1612 line_buf_depth = drm_dp_dsc_sink_line_buf_depth(intel_dp->dsc_dpcd); in intel_dp_dsc_compute_params()
1627 intel_dp->dsc_dpcd[DP_DSC_BLK_PREDICTION_SUPPORT - DP_DSC_SUPPORT] & in intel_dp_dsc_compute_params()
1633 static bool intel_dp_dsc_supports_format(struct intel_dp *intel_dp, in intel_dp_dsc_supports_format() argument
1646 if (min(intel_dp_source_dsc_version_minor(intel_dp), in intel_dp_dsc_supports_format()
1647 intel_dp_sink_dsc_version_minor(intel_dp)) < 2) in intel_dp_dsc_supports_format()
1655 return drm_dp_dsc_sink_supports_format(intel_dp->dsc_dpcd, sink_dsc_format); in intel_dp_dsc_supports_format()
1658 int intel_dp_dsc_compute_config(struct intel_dp *intel_dp, in intel_dp_dsc_compute_config() argument
1665 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); in intel_dp_dsc_compute_config()
1672 pipe_config->fec_enable = !intel_dp_is_edp(intel_dp) && in intel_dp_dsc_compute_config()
1673 intel_dp_supports_fec(intel_dp, pipe_config); in intel_dp_dsc_compute_config()
1675 if (!intel_dp_supports_dsc(intel_dp, pipe_config)) in intel_dp_dsc_compute_config()
1678 if (!intel_dp_dsc_supports_format(intel_dp, pipe_config->output_format)) in intel_dp_dsc_compute_config()
1682 pipe_bpp = intel_dp_dsc_compute_bpp(intel_dp, conn_state->max_requested_bpc); in intel_dp_dsc_compute_config()
1686 if (intel_dp->force_dsc_bpc) { in intel_dp_dsc_compute_config()
1687 pipe_bpp = intel_dp->force_dsc_bpc * 3; in intel_dp_dsc_compute_config()
1707 if (intel_dp_is_edp(intel_dp)) { in intel_dp_dsc_compute_config()
1709 min_t(u16, drm_edp_dsc_sink_output_bpp(intel_dp->dsc_dpcd) >> 4, in intel_dp_dsc_compute_config()
1712 drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd, in intel_dp_dsc_compute_config()
1749 intel_dp_dsc_get_slice_count(intel_dp, in intel_dp_dsc_compute_config()
1813 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); in intel_dp_compute_link_config() local
1818 limits.min_rate = intel_dp_common_rate(intel_dp, 0); in intel_dp_compute_link_config()
1819 limits.max_rate = intel_dp_max_link_rate(intel_dp); in intel_dp_compute_link_config()
1822 limits.max_lane_count = intel_dp_max_lane_count(intel_dp); in intel_dp_compute_link_config()
1825 limits.max_bpp = intel_dp_max_bpp(intel_dp, pipe_config, respect_downstream_limits); in intel_dp_compute_link_config()
1827 if (intel_dp->use_max_params) { in intel_dp_compute_link_config()
1840 intel_dp_adjust_compliance_config(intel_dp, pipe_config, &limits); in intel_dp_compute_link_config()
1847 if (intel_dp_need_bigjoiner(intel_dp, adjusted_mode->crtc_hdisplay, in intel_dp_compute_link_config()
1862 ret = intel_dp_compute_link_config_wide(intel_dp, pipe_config, conn_state, &limits); in intel_dp_compute_link_config()
1864 if (ret || joiner_needs_dsc || intel_dp->force_dsc_en) { in intel_dp_compute_link_config()
1867 str_yes_no(intel_dp->force_dsc_en)); in intel_dp_compute_link_config()
1868 ret = intel_dp_dsc_compute_config(intel_dp, pipe_config, in intel_dp_compute_link_config()
2026 static void intel_dp_compute_vsc_sdp(struct intel_dp *intel_dp, in intel_dp_compute_vsc_sdp() argument
2045 void intel_dp_compute_psr_vsc_sdp(struct intel_dp *intel_dp, in intel_dp_compute_psr_vsc_sdp() argument
2053 if (intel_dp->psr.colorimetry_support && in intel_dp_compute_psr_vsc_sdp()
2080 intel_dp_compute_hdr_metadata_infoframe_sdp(struct intel_dp *intel_dp, in intel_dp_compute_hdr_metadata_infoframe_sdp() argument
2085 struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); in intel_dp_compute_hdr_metadata_infoframe_sdp()
2181 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); in intel_dp_has_audio() local
2182 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_has_audio()
2202 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); in intel_dp_compute_output_format() local
2203 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_compute_output_format()
2263 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); in intel_dp_compute_config() local
2265 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_compute_config()
2276 if (intel_dp_is_edp(intel_dp) && fixed_mode) { in intel_dp_compute_config()
2305 if ((intel_dp_is_edp(intel_dp) && fixed_mode) || in intel_dp_compute_config()
2316 drm_dp_enhanced_frame_cap(intel_dp->dpcd); in intel_dp_compute_config()
2324 if (intel_dp->mso_link_count) { in intel_dp_compute_config()
2325 int n = intel_dp->mso_link_count; in intel_dp_compute_config()
2326 int overlap = intel_dp->mso_pixel_overlap; in intel_dp_compute_config()
2361 intel_psr_compute_config(intel_dp, pipe_config, conn_state); in intel_dp_compute_config()
2363 intel_dp_compute_vsc_sdp(intel_dp, pipe_config, conn_state); in intel_dp_compute_config()
2364 intel_dp_compute_hdr_metadata_infoframe_sdp(intel_dp, pipe_config, conn_state); in intel_dp_compute_config()
2369 void intel_dp_set_link_params(struct intel_dp *intel_dp, in intel_dp_set_link_params() argument
2372 memset(intel_dp->train_set, 0, sizeof(intel_dp->train_set)); in intel_dp_set_link_params()
2373 intel_dp->link_trained = false; in intel_dp_set_link_params()
2374 intel_dp->link_rate = link_rate; in intel_dp_set_link_params()
2375 intel_dp->lane_count = lane_count; in intel_dp_set_link_params()
2378 static void intel_dp_reset_max_link_params(struct intel_dp *intel_dp) in intel_dp_reset_max_link_params() argument
2380 intel_dp->max_link_lane_count = intel_dp_max_common_lane_count(intel_dp); in intel_dp_reset_max_link_params()
2381 intel_dp->max_link_rate = intel_dp_max_common_rate(intel_dp); in intel_dp_reset_max_link_params()
2388 struct intel_dp *intel_dp = enc_to_intel_dp(to_intel_encoder(conn_state->best_encoder)); in intel_edp_backlight_on() local
2389 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_edp_backlight_on()
2391 if (!intel_dp_is_edp(intel_dp)) in intel_edp_backlight_on()
2397 intel_pps_backlight_on(intel_dp); in intel_edp_backlight_on()
2403 struct intel_dp *intel_dp = enc_to_intel_dp(to_intel_encoder(old_conn_state->best_encoder)); in intel_edp_backlight_off() local
2404 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_edp_backlight_off()
2406 if (!intel_dp_is_edp(intel_dp)) in intel_edp_backlight_off()
2411 intel_pps_backlight_off(intel_dp); in intel_edp_backlight_off()
2415 static bool downstream_hpd_needs_d0(struct intel_dp *intel_dp) in downstream_hpd_needs_d0() argument
2425 return intel_dp->dpcd[DP_DPCD_REV] == 0x11 && in downstream_hpd_needs_d0()
2426 drm_dp_is_branch(intel_dp->dpcd) && in downstream_hpd_needs_d0()
2427 intel_dp->downstream_ports[0] & DP_DS_PORT_HPD; in downstream_hpd_needs_d0()
2430 void intel_dp_sink_set_decompression_state(struct intel_dp *intel_dp, in intel_dp_sink_set_decompression_state() argument
2434 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_sink_set_decompression_state()
2440 ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_DSC_ENABLE, in intel_dp_sink_set_decompression_state()
2449 intel_edp_init_source_oui(struct intel_dp *intel_dp, bool careful) in intel_edp_init_source_oui() argument
2451 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_edp_init_source_oui()
2460 if (drm_dp_dpcd_read(&intel_dp->aux, DP_SOURCE_OUI, buf, sizeof(buf)) < 0) in intel_edp_init_source_oui()
2467 if (drm_dp_dpcd_write(&intel_dp->aux, DP_SOURCE_OUI, oui, sizeof(oui)) < 0) in intel_edp_init_source_oui()
2470 intel_dp->last_oui_write = jiffies; in intel_edp_init_source_oui()
2473 void intel_dp_wait_source_oui(struct intel_dp *intel_dp) in intel_dp_wait_source_oui() argument
2475 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_wait_source_oui()
2476 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_wait_source_oui()
2482 wait_remaining_ms_from_jiffies(intel_dp->last_oui_write, in intel_dp_wait_source_oui()
2487 void intel_dp_set_power(struct intel_dp *intel_dp, u8 mode) in intel_dp_set_power() argument
2489 struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base; in intel_dp_set_power()
2494 if (intel_dp->dpcd[DP_DPCD_REV] < 0x11) in intel_dp_set_power()
2498 if (downstream_hpd_needs_d0(intel_dp)) in intel_dp_set_power()
2501 ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_SET_POWER, mode); in intel_dp_set_power()
2503 struct intel_lspcon *lspcon = dp_to_lspcon(intel_dp); in intel_dp_set_power()
2505 lspcon_resume(dp_to_dig_port(intel_dp)); in intel_dp_set_power()
2508 if (intel_dp_is_edp(intel_dp)) in intel_dp_set_power()
2509 intel_edp_init_source_oui(intel_dp, false); in intel_dp_set_power()
2516 ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_SET_POWER, mode); in intel_dp_set_power()
2533 intel_dp_get_dpcd(struct intel_dp *intel_dp);
2546 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); in intel_dp_sync_state() local
2555 if (intel_dp->dpcd[DP_DPCD_REV] == 0) in intel_dp_sync_state()
2556 intel_dp_get_dpcd(intel_dp); in intel_dp_sync_state()
2558 intel_dp_reset_max_link_params(intel_dp); in intel_dp_sync_state()
2565 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); in intel_dp_initial_fastset_check() local
2572 if (intel_dp_rate_index(intel_dp->source_rates, intel_dp->num_source_rates, in intel_dp_initial_fastset_check()
2594 if (CAN_PSR(intel_dp)) { in intel_dp_initial_fastset_check()
2604 static void intel_dp_get_pcon_dsc_cap(struct intel_dp *intel_dp) in intel_dp_get_pcon_dsc_cap() argument
2606 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_get_pcon_dsc_cap()
2610 memset(intel_dp->pcon_dsc_dpcd, 0, sizeof(intel_dp->pcon_dsc_dpcd)); in intel_dp_get_pcon_dsc_cap()
2612 if (drm_dp_dpcd_read(&intel_dp->aux, DP_PCON_DSC_ENCODER, in intel_dp_get_pcon_dsc_cap()
2613 intel_dp->pcon_dsc_dpcd, in intel_dp_get_pcon_dsc_cap()
2614 sizeof(intel_dp->pcon_dsc_dpcd)) < 0) in intel_dp_get_pcon_dsc_cap()
2619 (int)sizeof(intel_dp->pcon_dsc_dpcd), intel_dp->pcon_dsc_dpcd); in intel_dp_get_pcon_dsc_cap()
2654 static int intel_dp_hdmi_sink_max_frl(struct intel_dp *intel_dp) in intel_dp_hdmi_sink_max_frl() argument
2656 struct intel_connector *intel_connector = intel_dp->attached_connector; in intel_dp_hdmi_sink_max_frl()
2677 intel_dp_pcon_is_frl_trained(struct intel_dp *intel_dp, in intel_dp_pcon_is_frl_trained() argument
2680 if (drm_dp_pcon_hdmi_link_active(&intel_dp->aux) && in intel_dp_pcon_is_frl_trained()
2681 drm_dp_pcon_hdmi_link_mode(&intel_dp->aux, frl_trained_mask) == DP_PCON_HDMI_MODE_FRL && in intel_dp_pcon_is_frl_trained()
2688 static int intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp) in intel_dp_pcon_start_frl_training() argument
2693 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_pcon_start_frl_training()
2698 max_pcon_frl_bw = intel_dp->dfp.pcon_max_frl_bw; in intel_dp_pcon_start_frl_training()
2701 max_edid_frl_bw = intel_dp_hdmi_sink_max_frl(intel_dp); in intel_dp_pcon_start_frl_training()
2712 if (intel_dp_pcon_is_frl_trained(intel_dp, max_frl_bw_mask, &frl_trained_mask)) in intel_dp_pcon_start_frl_training()
2715 ret = drm_dp_pcon_frl_prepare(&intel_dp->aux, false); in intel_dp_pcon_start_frl_training()
2719 wait_for(is_active = drm_dp_pcon_is_frl_ready(&intel_dp->aux) == true, TIMEOUT_FRL_READY_MS); in intel_dp_pcon_start_frl_training()
2724 ret = drm_dp_pcon_frl_configure_1(&intel_dp->aux, max_frl_bw, in intel_dp_pcon_start_frl_training()
2728 ret = drm_dp_pcon_frl_configure_2(&intel_dp->aux, max_frl_bw_mask, in intel_dp_pcon_start_frl_training()
2732 ret = drm_dp_pcon_frl_enable(&intel_dp->aux); in intel_dp_pcon_start_frl_training()
2740 intel_dp_pcon_is_frl_trained(intel_dp, max_frl_bw_mask, &frl_trained_mask), in intel_dp_pcon_start_frl_training()
2748 intel_dp->frl.trained_rate_gbps = intel_dp_pcon_get_frl_mask(frl_trained_mask); in intel_dp_pcon_start_frl_training()
2749 intel_dp->frl.is_trained = true; in intel_dp_pcon_start_frl_training()
2750 drm_dbg(&i915->drm, "FRL trained with : %d Gbps\n", intel_dp->frl.trained_rate_gbps); in intel_dp_pcon_start_frl_training()
2755 static bool intel_dp_is_hdmi_2_1_sink(struct intel_dp *intel_dp) in intel_dp_is_hdmi_2_1_sink() argument
2757 if (drm_dp_is_branch(intel_dp->dpcd) && in intel_dp_is_hdmi_2_1_sink()
2758 intel_dp_has_hdmi_sink(intel_dp) && in intel_dp_is_hdmi_2_1_sink()
2759 intel_dp_hdmi_sink_max_frl(intel_dp) > 0) in intel_dp_is_hdmi_2_1_sink()
2766 int intel_dp_pcon_set_tmds_mode(struct intel_dp *intel_dp) in intel_dp_pcon_set_tmds_mode() argument
2774 ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_PCON_HDMI_LINK_CONFIG_1, buf); in intel_dp_pcon_set_tmds_mode()
2780 ret = drm_dp_dpcd_writeb(&intel_dp->aux, DP_PCON_HDMI_LINK_CONFIG_1, buf); in intel_dp_pcon_set_tmds_mode()
2787 void intel_dp_check_frl_training(struct intel_dp *intel_dp) in intel_dp_check_frl_training() argument
2789 struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); in intel_dp_check_frl_training()
2796 if (!(intel_dp->downstream_ports[2] & DP_PCON_SOURCE_CTL_MODE) || in intel_dp_check_frl_training()
2797 !intel_dp_is_hdmi_2_1_sink(intel_dp) || in intel_dp_check_frl_training()
2798 intel_dp->frl.is_trained) in intel_dp_check_frl_training()
2801 if (intel_dp_pcon_start_frl_training(intel_dp) < 0) { in intel_dp_check_frl_training()
2805 ret = intel_dp_pcon_set_tmds_mode(intel_dp); in intel_dp_check_frl_training()
2806 mode = drm_dp_pcon_hdmi_link_mode(&intel_dp->aux, NULL); in intel_dp_check_frl_training()
2824 intel_dp_pcon_dsc_enc_slices(struct intel_dp *intel_dp, in intel_dp_pcon_dsc_enc_slices() argument
2827 struct intel_connector *intel_connector = intel_dp->attached_connector; in intel_dp_pcon_dsc_enc_slices()
2831 int pcon_max_slices = drm_dp_pcon_dsc_max_slices(intel_dp->pcon_dsc_dpcd); in intel_dp_pcon_dsc_enc_slices()
2832 int pcon_max_slice_width = drm_dp_pcon_dsc_max_slice_width(intel_dp->pcon_dsc_dpcd); in intel_dp_pcon_dsc_enc_slices()
2840 intel_dp_pcon_dsc_enc_bpp(struct intel_dp *intel_dp, in intel_dp_pcon_dsc_enc_bpp() argument
2844 struct intel_connector *intel_connector = intel_dp->attached_connector; in intel_dp_pcon_dsc_enc_bpp()
2848 int pcon_fractional_bpp = drm_dp_pcon_dsc_bpp_incr(intel_dp->pcon_dsc_dpcd); in intel_dp_pcon_dsc_enc_bpp()
2858 intel_dp_pcon_dsc_configure(struct intel_dp *intel_dp, in intel_dp_pcon_dsc_configure() argument
2867 struct intel_connector *intel_connector = intel_dp->attached_connector; in intel_dp_pcon_dsc_configure()
2868 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_pcon_dsc_configure()
2872 if (!intel_dp_is_hdmi_2_1_sink(intel_dp)) in intel_dp_pcon_dsc_configure()
2880 if (!drm_dp_pcon_enc_is_dsc_1_2(intel_dp->pcon_dsc_dpcd) || in intel_dp_pcon_dsc_configure()
2888 num_slices = intel_dp_pcon_dsc_enc_slices(intel_dp, crtc_state); in intel_dp_pcon_dsc_configure()
2895 bits_per_pixel = intel_dp_pcon_dsc_enc_bpp(intel_dp, crtc_state, in intel_dp_pcon_dsc_configure()
2907 ret = drm_dp_pcon_pps_override_param(&intel_dp->aux, pps_param); in intel_dp_pcon_dsc_configure()
2912 void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp, in intel_dp_configure_protocol_converter() argument
2915 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_configure_protocol_converter()
2920 if (intel_dp->dpcd[DP_DPCD_REV] < 0x13) in intel_dp_configure_protocol_converter()
2923 if (!drm_dp_is_branch(intel_dp->dpcd)) in intel_dp_configure_protocol_converter()
2926 tmp = intel_dp_has_hdmi_sink(intel_dp) ? DP_HDMI_DVI_OUTPUT_CONFIG : 0; in intel_dp_configure_protocol_converter()
2928 if (drm_dp_dpcd_writeb(&intel_dp->aux, in intel_dp_configure_protocol_converter()
2931 str_enable_disable(intel_dp_has_hdmi_sink(intel_dp))); in intel_dp_configure_protocol_converter()
2963 if (drm_dp_dpcd_writeb(&intel_dp->aux, in intel_dp_configure_protocol_converter()
2967 str_enable_disable(intel_dp->dfp.ycbcr_444_to_420)); in intel_dp_configure_protocol_converter()
2971 if (drm_dp_pcon_convert_rgb_to_ycbcr(&intel_dp->aux, tmp) < 0) in intel_dp_configure_protocol_converter()
2977 bool intel_dp_get_colorimetry_status(struct intel_dp *intel_dp) in intel_dp_get_colorimetry_status() argument
2981 if (drm_dp_dpcd_readb(&intel_dp->aux, DP_DPRX_FEATURE_ENUMERATION_LIST, in intel_dp_get_colorimetry_status()
2987 static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp) in intel_dp_get_dsc_sink_cap() argument
2989 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_get_dsc_sink_cap()
2995 memset(intel_dp->dsc_dpcd, 0, sizeof(intel_dp->dsc_dpcd)); in intel_dp_get_dsc_sink_cap()
2998 intel_dp->fec_capable = 0; in intel_dp_get_dsc_sink_cap()
3001 if (intel_dp->dpcd[DP_DPCD_REV] >= 0x14 || in intel_dp_get_dsc_sink_cap()
3002 intel_dp->edp_dpcd[0] >= DP_EDP_14) { in intel_dp_get_dsc_sink_cap()
3003 if (drm_dp_dpcd_read(&intel_dp->aux, DP_DSC_SUPPORT, in intel_dp_get_dsc_sink_cap()
3004 intel_dp->dsc_dpcd, in intel_dp_get_dsc_sink_cap()
3005 sizeof(intel_dp->dsc_dpcd)) < 0) in intel_dp_get_dsc_sink_cap()
3011 (int)sizeof(intel_dp->dsc_dpcd), in intel_dp_get_dsc_sink_cap()
3012 intel_dp->dsc_dpcd); in intel_dp_get_dsc_sink_cap()
3015 if (!intel_dp_is_edp(intel_dp) && in intel_dp_get_dsc_sink_cap()
3016 drm_dp_dpcd_readb(&intel_dp->aux, DP_FEC_CAPABILITY, in intel_dp_get_dsc_sink_cap()
3017 &intel_dp->fec_capable) < 0) in intel_dp_get_dsc_sink_cap()
3022 intel_dp->fec_capable); in intel_dp_get_dsc_sink_cap()
3029 struct intel_dp *intel_dp = intel_attached_dp(connector); in intel_edp_mso_mode_fixup() local
3031 int n = intel_dp->mso_link_count; in intel_edp_mso_mode_fixup()
3032 int overlap = intel_dp->mso_pixel_overlap; in intel_edp_mso_mode_fixup()
3054 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); in intel_edp_fixup_vbt_bpp() local
3055 struct intel_connector *connector = intel_dp->attached_connector; in intel_edp_fixup_vbt_bpp()
3078 static void intel_edp_mso_init(struct intel_dp *intel_dp) in intel_edp_mso_init() argument
3080 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_edp_mso_init()
3081 struct intel_connector *connector = intel_dp->attached_connector; in intel_edp_mso_init()
3085 if (intel_dp->edp_dpcd[0] < DP_EDP_14) in intel_edp_mso_init()
3088 if (drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_MSO_LINK_CAPABILITIES, &mso) != 1) { in intel_edp_mso_init()
3095 if (mso % 2 || mso > drm_dp_max_lane_count(intel_dp->dpcd)) { in intel_edp_mso_init()
3102 mso, drm_dp_max_lane_count(intel_dp->dpcd) / mso, in intel_edp_mso_init()
3110 intel_dp->mso_link_count = mso; in intel_edp_mso_init()
3111 intel_dp->mso_pixel_overlap = mso ? info->mso_pixel_overlap : 0; in intel_edp_mso_init()
3115 intel_edp_init_dpcd(struct intel_dp *intel_dp) in intel_edp_init_dpcd() argument
3118 to_i915(dp_to_dig_port(intel_dp)->base.base.dev); in intel_edp_init_dpcd()
3121 drm_WARN_ON(&dev_priv->drm, intel_dp->dpcd[DP_DPCD_REV] != 0); in intel_edp_init_dpcd()
3123 if (drm_dp_read_dpcd_caps(&intel_dp->aux, intel_dp->dpcd) != 0) in intel_edp_init_dpcd()
3126 drm_dp_read_desc(&intel_dp->aux, &intel_dp->desc, in intel_edp_init_dpcd()
3127 drm_dp_is_branch(intel_dp->dpcd)); in intel_edp_init_dpcd()
3138 if (drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV, in intel_edp_init_dpcd()
3139 intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) == in intel_edp_init_dpcd()
3140 sizeof(intel_dp->edp_dpcd)) { in intel_edp_init_dpcd()
3142 (int)sizeof(intel_dp->edp_dpcd), in intel_edp_init_dpcd()
3143 intel_dp->edp_dpcd); in intel_edp_init_dpcd()
3145 intel_dp->use_max_params = intel_dp->edp_dpcd[0] < DP_EDP_14; in intel_edp_init_dpcd()
3152 intel_psr_init_dpcd(intel_dp); in intel_edp_init_dpcd()
3155 intel_dp->num_sink_rates = 0; in intel_edp_init_dpcd()
3158 if (intel_dp->edp_dpcd[0] >= DP_EDP_14) { in intel_edp_init_dpcd()
3162 drm_dp_dpcd_read(&intel_dp->aux, DP_SUPPORTED_LINK_RATES, in intel_edp_init_dpcd()
3177 intel_dp->sink_rates[i] = (val * 200) / 10; in intel_edp_init_dpcd()
3179 intel_dp->num_sink_rates = i; in intel_edp_init_dpcd()
3186 if (intel_dp->num_sink_rates) in intel_edp_init_dpcd()
3187 intel_dp->use_rate_select = true; in intel_edp_init_dpcd()
3189 intel_dp_set_sink_rates(intel_dp); in intel_edp_init_dpcd()
3190 intel_dp_set_max_sink_lane_count(intel_dp); in intel_edp_init_dpcd()
3194 intel_dp_get_dsc_sink_cap(intel_dp); in intel_edp_init_dpcd()
3200 intel_edp_init_source_oui(intel_dp, true); in intel_edp_init_dpcd()
3206 intel_dp_has_sink_count(struct intel_dp *intel_dp) in intel_dp_has_sink_count() argument
3208 if (!intel_dp->attached_connector) in intel_dp_has_sink_count()
3211 return drm_dp_read_sink_count_cap(&intel_dp->attached_connector->base, in intel_dp_has_sink_count()
3212 intel_dp->dpcd, in intel_dp_has_sink_count()
3213 &intel_dp->desc); in intel_dp_has_sink_count()
3217 intel_dp_get_dpcd(struct intel_dp *intel_dp) in intel_dp_get_dpcd() argument
3221 if (intel_dp_init_lttpr_and_dprx_caps(intel_dp) < 0) in intel_dp_get_dpcd()
3228 if (!intel_dp_is_edp(intel_dp)) { in intel_dp_get_dpcd()
3229 drm_dp_read_desc(&intel_dp->aux, &intel_dp->desc, in intel_dp_get_dpcd()
3230 drm_dp_is_branch(intel_dp->dpcd)); in intel_dp_get_dpcd()
3232 intel_dp_set_sink_rates(intel_dp); in intel_dp_get_dpcd()
3233 intel_dp_set_max_sink_lane_count(intel_dp); in intel_dp_get_dpcd()
3234 intel_dp_set_common_rates(intel_dp); in intel_dp_get_dpcd()
3237 if (intel_dp_has_sink_count(intel_dp)) { in intel_dp_get_dpcd()
3238 ret = drm_dp_read_sink_count(&intel_dp->aux); in intel_dp_get_dpcd()
3247 intel_dp->sink_count = ret; in intel_dp_get_dpcd()
3256 if (!intel_dp->sink_count) in intel_dp_get_dpcd()
3260 return drm_dp_read_downstream_info(&intel_dp->aux, intel_dp->dpcd, in intel_dp_get_dpcd()
3261 intel_dp->downstream_ports) == 0; in intel_dp_get_dpcd()
3265 intel_dp_can_mst(struct intel_dp *intel_dp) in intel_dp_can_mst() argument
3267 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_can_mst()
3270 intel_dp_mst_source_support(intel_dp) && in intel_dp_can_mst()
3271 drm_dp_read_mst_cap(&intel_dp->aux, intel_dp->dpcd); in intel_dp_can_mst()
3275 intel_dp_configure_mst(struct intel_dp *intel_dp) in intel_dp_configure_mst() argument
3277 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_configure_mst()
3279 &dp_to_dig_port(intel_dp)->base; in intel_dp_configure_mst()
3280 bool sink_can_mst = drm_dp_read_mst_cap(&intel_dp->aux, intel_dp->dpcd); in intel_dp_configure_mst()
3285 str_yes_no(intel_dp_mst_source_support(intel_dp)), in intel_dp_configure_mst()
3289 if (!intel_dp_mst_source_support(intel_dp)) in intel_dp_configure_mst()
3292 intel_dp->is_mst = sink_can_mst && in intel_dp_configure_mst()
3295 drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, in intel_dp_configure_mst()
3296 intel_dp->is_mst); in intel_dp_configure_mst()
3300 intel_dp_get_sink_irq_esi(struct intel_dp *intel_dp, u8 *esi) in intel_dp_get_sink_irq_esi() argument
3302 return drm_dp_dpcd_read(&intel_dp->aux, DP_SINK_COUNT_ESI, esi, 4) == 4; in intel_dp_get_sink_irq_esi()
3305 static bool intel_dp_ack_sink_irq_esi(struct intel_dp *intel_dp, u8 esi[4]) in intel_dp_ack_sink_irq_esi() argument
3310 if (drm_dp_dpcd_write(&intel_dp->aux, DP_SINK_COUNT_ESI + 1, in intel_dp_ack_sink_irq_esi()
3751 static u8 intel_dp_autotest_link_training(struct intel_dp *intel_dp) in intel_dp_autotest_link_training() argument
3753 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_autotest_link_training()
3761 status = drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_LANE_COUNT, in intel_dp_autotest_link_training()
3770 status = drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_LINK_RATE, in intel_dp_autotest_link_training()
3779 if (!intel_dp_link_params_valid(intel_dp, test_link_rate, in intel_dp_autotest_link_training()
3783 intel_dp->compliance.test_lane_count = test_lane_count; in intel_dp_autotest_link_training()
3784 intel_dp->compliance.test_link_rate = test_link_rate; in intel_dp_autotest_link_training()
3789 static u8 intel_dp_autotest_video_pattern(struct intel_dp *intel_dp) in intel_dp_autotest_video_pattern() argument
3791 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_autotest_video_pattern()
3798 status = drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_PATTERN, in intel_dp_autotest_video_pattern()
3807 status = drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_H_WIDTH_HI, in intel_dp_autotest_video_pattern()
3814 status = drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_V_HEIGHT_HI, in intel_dp_autotest_video_pattern()
3821 status = drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_MISC0, in intel_dp_autotest_video_pattern()
3833 intel_dp->compliance.test_data.bpc = 6; in intel_dp_autotest_video_pattern()
3836 intel_dp->compliance.test_data.bpc = 8; in intel_dp_autotest_video_pattern()
3842 intel_dp->compliance.test_data.video_pattern = test_pattern; in intel_dp_autotest_video_pattern()
3843 intel_dp->compliance.test_data.hdisplay = be16_to_cpu(h_width); in intel_dp_autotest_video_pattern()
3844 intel_dp->compliance.test_data.vdisplay = be16_to_cpu(v_height); in intel_dp_autotest_video_pattern()
3846 intel_dp->compliance.test_active = true; in intel_dp_autotest_video_pattern()
3851 static u8 intel_dp_autotest_edid(struct intel_dp *intel_dp) in intel_dp_autotest_edid() argument
3853 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_autotest_edid()
3855 struct intel_connector *intel_connector = intel_dp->attached_connector; in intel_dp_autotest_edid()
3860 intel_dp->aux.i2c_defer_count > 6) { in intel_dp_autotest_edid()
3868 if (intel_dp->aux.i2c_nack_count > 0 || in intel_dp_autotest_edid()
3869 intel_dp->aux.i2c_defer_count > 0) in intel_dp_autotest_edid()
3872 intel_dp->aux.i2c_nack_count, in intel_dp_autotest_edid()
3873 intel_dp->aux.i2c_defer_count); in intel_dp_autotest_edid()
3874 intel_dp->compliance.test_data.edid = INTEL_DP_RESOLUTION_FAILSAFE; in intel_dp_autotest_edid()
3882 if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_EDID_CHECKSUM, in intel_dp_autotest_edid()
3888 intel_dp->compliance.test_data.edid = INTEL_DP_RESOLUTION_PREFERRED; in intel_dp_autotest_edid()
3892 intel_dp->compliance.test_active = true; in intel_dp_autotest_edid()
3897 static void intel_dp_phy_pattern_update(struct intel_dp *intel_dp, in intel_dp_phy_pattern_update() argument
3901 to_i915(dp_to_dig_port(intel_dp)->base.base.dev); in intel_dp_phy_pattern_update()
3903 &intel_dp->compliance.test_data.phytest; in intel_dp_phy_pattern_update()
3964 static void intel_dp_process_phy_request(struct intel_dp *intel_dp, in intel_dp_process_phy_request() argument
3967 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_process_phy_request()
3969 &intel_dp->compliance.test_data.phytest; in intel_dp_process_phy_request()
3972 if (drm_dp_dpcd_read_phy_link_status(&intel_dp->aux, DP_PHY_DPRX, in intel_dp_process_phy_request()
3979 intel_dp_get_adjust_train(intel_dp, crtc_state, DP_PHY_DPRX, in intel_dp_process_phy_request()
3982 intel_dp_set_signal_levels(intel_dp, crtc_state, DP_PHY_DPRX); in intel_dp_process_phy_request()
3984 intel_dp_phy_pattern_update(intel_dp, crtc_state); in intel_dp_process_phy_request()
3986 drm_dp_dpcd_write(&intel_dp->aux, DP_TRAINING_LANE0_SET, in intel_dp_process_phy_request()
3987 intel_dp->train_set, crtc_state->lane_count); in intel_dp_process_phy_request()
3989 drm_dp_set_phy_test_pattern(&intel_dp->aux, data, in intel_dp_process_phy_request()
3990 intel_dp->dpcd[DP_DPCD_REV]); in intel_dp_process_phy_request()
3993 static u8 intel_dp_autotest_phy_pattern(struct intel_dp *intel_dp) in intel_dp_autotest_phy_pattern() argument
3995 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_autotest_phy_pattern()
3997 &intel_dp->compliance.test_data.phytest; in intel_dp_autotest_phy_pattern()
3999 if (drm_dp_get_phy_test_pattern(&intel_dp->aux, data)) { in intel_dp_autotest_phy_pattern()
4005 intel_dp->compliance.test_active = true; in intel_dp_autotest_phy_pattern()
4010 static void intel_dp_handle_test_request(struct intel_dp *intel_dp) in intel_dp_handle_test_request() argument
4012 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_handle_test_request()
4017 status = drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_REQUEST, &request); in intel_dp_handle_test_request()
4027 response = intel_dp_autotest_link_training(intel_dp); in intel_dp_handle_test_request()
4031 response = intel_dp_autotest_video_pattern(intel_dp); in intel_dp_handle_test_request()
4035 response = intel_dp_autotest_edid(intel_dp); in intel_dp_handle_test_request()
4039 response = intel_dp_autotest_phy_pattern(intel_dp); in intel_dp_handle_test_request()
4048 intel_dp->compliance.test_type = request; in intel_dp_handle_test_request()
4051 status = drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_RESPONSE, response); in intel_dp_handle_test_request()
4057 static bool intel_dp_link_ok(struct intel_dp *intel_dp, in intel_dp_link_ok() argument
4060 struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base; in intel_dp_link_ok()
4062 bool uhbr = intel_dp->link_rate >= 1000000; in intel_dp_link_ok()
4067 intel_dp->lane_count); in intel_dp_link_ok()
4069 ok = drm_dp_channel_eq_ok(link_status, intel_dp->lane_count); in intel_dp_link_ok()
4074 intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status); in intel_dp_link_ok()
4084 intel_dp_mst_hpd_irq(struct intel_dp *intel_dp, u8 *esi, u8 *ack) in intel_dp_mst_hpd_irq() argument
4088 drm_dp_mst_hpd_irq_handle_event(&intel_dp->mst_mgr, esi, ack, &handled); in intel_dp_mst_hpd_irq()
4091 intel_hdcp_handle_cp_irq(intel_dp->attached_connector); in intel_dp_mst_hpd_irq()
4096 static bool intel_dp_mst_link_status(struct intel_dp *intel_dp) in intel_dp_mst_link_status() argument
4098 struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base; in intel_dp_mst_link_status()
4103 if (drm_dp_dpcd_read(&intel_dp->aux, DP_LANE0_1_STATUS_ESI, link_status, in intel_dp_mst_link_status()
4111 return intel_dp_link_ok(intel_dp, link_status); in intel_dp_mst_link_status()
4128 intel_dp_check_mst_status(struct intel_dp *intel_dp) in intel_dp_check_mst_status() argument
4130 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_check_mst_status()
4133 drm_WARN_ON_ONCE(&i915->drm, intel_dp->active_mst_links < 0); in intel_dp_check_mst_status()
4139 if (!intel_dp_get_sink_irq_esi(intel_dp, esi)) { in intel_dp_check_mst_status()
4149 if (intel_dp->active_mst_links > 0 && link_ok && in intel_dp_check_mst_status()
4151 if (!intel_dp_mst_link_status(intel_dp)) in intel_dp_check_mst_status()
4156 intel_dp_mst_hpd_irq(intel_dp, esi, ack); in intel_dp_check_mst_status()
4161 if (!intel_dp_ack_sink_irq_esi(intel_dp, ack)) in intel_dp_check_mst_status()
4165 drm_dp_mst_hpd_irq_send_new_request(&intel_dp->mst_mgr); in intel_dp_check_mst_status()
4172 intel_dp_handle_hdmi_link_status_change(struct intel_dp *intel_dp) in intel_dp_handle_hdmi_link_status_change() argument
4177 is_active = drm_dp_pcon_hdmi_link_active(&intel_dp->aux); in intel_dp_handle_hdmi_link_status_change()
4178 if (intel_dp->frl.is_trained && !is_active) { in intel_dp_handle_hdmi_link_status_change()
4179 if (drm_dp_dpcd_readb(&intel_dp->aux, DP_PCON_HDMI_LINK_CONFIG_1, &buf) < 0) in intel_dp_handle_hdmi_link_status_change()
4183 if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_PCON_HDMI_LINK_CONFIG_1, buf) < 0) in intel_dp_handle_hdmi_link_status_change()
4186 drm_dp_pcon_hdmi_frl_link_error_count(&intel_dp->aux, &intel_dp->attached_connector->base); in intel_dp_handle_hdmi_link_status_change()
4188 intel_dp->frl.is_trained = false; in intel_dp_handle_hdmi_link_status_change()
4191 intel_dp_check_frl_training(intel_dp); in intel_dp_handle_hdmi_link_status_change()
4196 intel_dp_needs_link_retrain(struct intel_dp *intel_dp) in intel_dp_needs_link_retrain() argument
4200 if (!intel_dp->link_trained) in intel_dp_needs_link_retrain()
4211 if (intel_psr_enabled(intel_dp)) in intel_dp_needs_link_retrain()
4214 if (drm_dp_dpcd_read_phy_link_status(&intel_dp->aux, DP_PHY_DPRX, in intel_dp_needs_link_retrain()
4226 if (!intel_dp_link_params_valid(intel_dp, intel_dp->link_rate, in intel_dp_needs_link_retrain()
4227 intel_dp->lane_count)) in intel_dp_needs_link_retrain()
4231 return !intel_dp_link_ok(intel_dp, link_status); in intel_dp_needs_link_retrain()
4234 static bool intel_dp_has_connector(struct intel_dp *intel_dp, in intel_dp_has_connector() argument
4237 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_has_connector()
4245 encoder = &dp_to_dig_port(intel_dp)->base; in intel_dp_has_connector()
4251 encoder = &intel_dp->mst_encoders[pipe]->base; in intel_dp_has_connector()
4259 int intel_dp_get_active_pipes(struct intel_dp *intel_dp, in intel_dp_get_active_pipes() argument
4263 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_get_active_pipes()
4277 if (!intel_dp_has_connector(intel_dp, conn_state)) in intel_dp_get_active_pipes()
4306 static bool intel_dp_is_connected(struct intel_dp *intel_dp) in intel_dp_is_connected() argument
4308 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_is_connected()
4311 intel_dp->is_mst; in intel_dp_is_connected()
4318 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); in intel_dp_retrain_link() local
4323 if (!intel_dp_is_connected(intel_dp)) in intel_dp_retrain_link()
4331 if (!intel_dp_needs_link_retrain(intel_dp)) in intel_dp_retrain_link()
4334 ret = intel_dp_get_active_pipes(intel_dp, ctx, &pipe_mask); in intel_dp_retrain_link()
4341 if (!intel_dp_needs_link_retrain(intel_dp)) in intel_dp_retrain_link()
4368 intel_dp_check_frl_training(intel_dp); in intel_dp_retrain_link()
4369 intel_dp_pcon_dsc_configure(intel_dp, crtc_state); in intel_dp_retrain_link()
4370 intel_dp_start_link_train(intel_dp, crtc_state); in intel_dp_retrain_link()
4371 intel_dp_stop_link_train(intel_dp, crtc_state); in intel_dp_retrain_link()
4391 static int intel_dp_prep_phy_test(struct intel_dp *intel_dp, in intel_dp_prep_phy_test() argument
4395 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_prep_phy_test()
4409 if (!intel_dp_has_connector(intel_dp, conn_state)) in intel_dp_prep_phy_test()
4442 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); in intel_dp_do_phy_test() local
4452 ret = intel_dp_prep_phy_test(intel_dp, ctx, &pipe_mask); in intel_dp_do_phy_test()
4472 intel_dp_process_phy_request(intel_dp, crtc_state); in intel_dp_do_phy_test()
4503 static void intel_dp_check_device_service_irq(struct intel_dp *intel_dp) in intel_dp_check_device_service_irq() argument
4505 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_check_device_service_irq()
4508 if (intel_dp->dpcd[DP_DPCD_REV] < 0x11) in intel_dp_check_device_service_irq()
4511 if (drm_dp_dpcd_readb(&intel_dp->aux, in intel_dp_check_device_service_irq()
4515 drm_dp_dpcd_writeb(&intel_dp->aux, DP_DEVICE_SERVICE_IRQ_VECTOR, val); in intel_dp_check_device_service_irq()
4518 intel_dp_handle_test_request(intel_dp); in intel_dp_check_device_service_irq()
4521 intel_hdcp_handle_cp_irq(intel_dp->attached_connector); in intel_dp_check_device_service_irq()
4527 static void intel_dp_check_link_service_irq(struct intel_dp *intel_dp) in intel_dp_check_link_service_irq() argument
4531 if (intel_dp->dpcd[DP_DPCD_REV] < 0x11) in intel_dp_check_link_service_irq()
4534 if (drm_dp_dpcd_readb(&intel_dp->aux, in intel_dp_check_link_service_irq()
4538 if (drm_dp_dpcd_writeb(&intel_dp->aux, in intel_dp_check_link_service_irq()
4543 intel_dp_handle_hdmi_link_status_change(intel_dp); in intel_dp_check_link_service_irq()
4560 intel_dp_short_pulse(struct intel_dp *intel_dp) in intel_dp_short_pulse() argument
4562 struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); in intel_dp_short_pulse()
4563 u8 old_sink_count = intel_dp->sink_count; in intel_dp_short_pulse()
4570 memset(&intel_dp->compliance, 0, sizeof(intel_dp->compliance)); in intel_dp_short_pulse()
4578 ret = intel_dp_get_dpcd(intel_dp); in intel_dp_short_pulse()
4580 if ((old_sink_count != intel_dp->sink_count) || !ret) { in intel_dp_short_pulse()
4585 intel_dp_check_device_service_irq(intel_dp); in intel_dp_short_pulse()
4586 intel_dp_check_link_service_irq(intel_dp); in intel_dp_short_pulse()
4589 drm_dp_cec_irq(&intel_dp->aux); in intel_dp_short_pulse()
4592 if (intel_dp_needs_link_retrain(intel_dp)) in intel_dp_short_pulse()
4595 intel_psr_short_pulse(intel_dp); in intel_dp_short_pulse()
4597 switch (intel_dp->compliance.test_type) { in intel_dp_short_pulse()
4621 intel_dp_detect_dpcd(struct intel_dp *intel_dp) in intel_dp_detect_dpcd() argument
4623 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_detect_dpcd()
4624 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); in intel_dp_detect_dpcd()
4625 u8 *dpcd = intel_dp->dpcd; in intel_dp_detect_dpcd()
4628 if (drm_WARN_ON(&i915->drm, intel_dp_is_edp(intel_dp))) in intel_dp_detect_dpcd()
4633 if (!intel_dp_get_dpcd(intel_dp)) in intel_dp_detect_dpcd()
4641 if (intel_dp_has_sink_count(intel_dp) && in intel_dp_detect_dpcd()
4642 intel_dp->downstream_ports[0] & DP_DS_PORT_HPD) { in intel_dp_detect_dpcd()
4643 return intel_dp->sink_count ? in intel_dp_detect_dpcd()
4647 if (intel_dp_can_mst(intel_dp)) in intel_dp_detect_dpcd()
4651 if (drm_probe_ddc(&intel_dp->aux.ddc)) in intel_dp_detect_dpcd()
4655 if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) { in intel_dp_detect_dpcd()
4656 type = intel_dp->downstream_ports[0] & DP_DS_PORT_TYPE_MASK; in intel_dp_detect_dpcd()
4661 type = intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] & in intel_dp_detect_dpcd()
4674 edp_detect(struct intel_dp *intel_dp) in edp_detect() argument
4704 intel_dp_get_edid(struct intel_dp *intel_dp) in intel_dp_get_edid() argument
4706 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_get_edid()
4718 return drm_edid_read_ddc(&connector->base, &intel_dp->aux.ddc); in intel_dp_get_edid()
4722 intel_dp_update_dfp(struct intel_dp *intel_dp, in intel_dp_update_dfp() argument
4725 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_update_dfp()
4726 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_update_dfp()
4732 intel_dp->dfp.max_bpc = in intel_dp_update_dfp()
4733 drm_dp_downstream_max_bpc(intel_dp->dpcd, in intel_dp_update_dfp()
4734 intel_dp->downstream_ports, edid); in intel_dp_update_dfp()
4736 intel_dp->dfp.max_dotclock = in intel_dp_update_dfp()
4737 drm_dp_downstream_max_dotclock(intel_dp->dpcd, in intel_dp_update_dfp()
4738 intel_dp->downstream_ports); in intel_dp_update_dfp()
4740 intel_dp->dfp.min_tmds_clock = in intel_dp_update_dfp()
4741 drm_dp_downstream_min_tmds_clock(intel_dp->dpcd, in intel_dp_update_dfp()
4742 intel_dp->downstream_ports, in intel_dp_update_dfp()
4744 intel_dp->dfp.max_tmds_clock = in intel_dp_update_dfp()
4745 drm_dp_downstream_max_tmds_clock(intel_dp->dpcd, in intel_dp_update_dfp()
4746 intel_dp->downstream_ports, in intel_dp_update_dfp()
4749 intel_dp->dfp.pcon_max_frl_bw = in intel_dp_update_dfp()
4750 drm_dp_get_pcon_max_frl_bw(intel_dp->dpcd, in intel_dp_update_dfp()
4751 intel_dp->downstream_ports); in intel_dp_update_dfp()
4756 intel_dp->dfp.max_bpc, in intel_dp_update_dfp()
4757 intel_dp->dfp.max_dotclock, in intel_dp_update_dfp()
4758 intel_dp->dfp.min_tmds_clock, in intel_dp_update_dfp()
4759 intel_dp->dfp.max_tmds_clock, in intel_dp_update_dfp()
4760 intel_dp->dfp.pcon_max_frl_bw); in intel_dp_update_dfp()
4762 intel_dp_get_pcon_dsc_cap(intel_dp); in intel_dp_update_dfp()
4766 intel_dp_can_ycbcr420(struct intel_dp *intel_dp) in intel_dp_can_ycbcr420() argument
4768 if (source_can_output(intel_dp, INTEL_OUTPUT_FORMAT_YCBCR420) && in intel_dp_can_ycbcr420()
4769 (!drm_dp_is_branch(intel_dp->dpcd) || intel_dp->dfp.ycbcr420_passthrough)) in intel_dp_can_ycbcr420()
4772 if (source_can_output(intel_dp, INTEL_OUTPUT_FORMAT_RGB) && in intel_dp_can_ycbcr420()
4773 dfp_can_convert_from_rgb(intel_dp, INTEL_OUTPUT_FORMAT_YCBCR420)) in intel_dp_can_ycbcr420()
4776 if (source_can_output(intel_dp, INTEL_OUTPUT_FORMAT_YCBCR444) && in intel_dp_can_ycbcr420()
4777 dfp_can_convert_from_ycbcr444(intel_dp, INTEL_OUTPUT_FORMAT_YCBCR420)) in intel_dp_can_ycbcr420()
4784 intel_dp_update_420(struct intel_dp *intel_dp) in intel_dp_update_420() argument
4786 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_update_420()
4787 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_update_420()
4789 intel_dp->dfp.ycbcr420_passthrough = in intel_dp_update_420()
4790 drm_dp_downstream_420_passthrough(intel_dp->dpcd, in intel_dp_update_420()
4791 intel_dp->downstream_ports); in intel_dp_update_420()
4793 intel_dp->dfp.ycbcr_444_to_420 = in intel_dp_update_420()
4794 dp_to_dig_port(intel_dp)->lspcon.active || in intel_dp_update_420()
4795 drm_dp_downstream_444_to_420_conversion(intel_dp->dpcd, in intel_dp_update_420()
4796 intel_dp->downstream_ports); in intel_dp_update_420()
4797 intel_dp->dfp.rgb_to_ycbcr = in intel_dp_update_420()
4798 drm_dp_downstream_rgb_to_ycbcr_conversion(intel_dp->dpcd, in intel_dp_update_420()
4799 intel_dp->downstream_ports, in intel_dp_update_420()
4802 connector->base.ycbcr_420_allowed = intel_dp_can_ycbcr420(intel_dp); in intel_dp_update_420()
4807 str_yes_no(intel_dp->dfp.rgb_to_ycbcr), in intel_dp_update_420()
4809 str_yes_no(intel_dp->dfp.ycbcr_444_to_420)); in intel_dp_update_420()
4813 intel_dp_set_edid(struct intel_dp *intel_dp) in intel_dp_set_edid() argument
4815 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_dp_set_edid()
4816 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_set_edid()
4821 intel_dp_unset_edid(intel_dp); in intel_dp_set_edid()
4822 drm_edid = intel_dp_get_edid(intel_dp); in intel_dp_set_edid()
4833 intel_dp_update_dfp(intel_dp, drm_edid); in intel_dp_set_edid()
4834 intel_dp_update_420(intel_dp); in intel_dp_set_edid()
4839 drm_dp_cec_set_edid(&intel_dp->aux, edid); in intel_dp_set_edid()
4843 intel_dp_unset_edid(struct intel_dp *intel_dp) in intel_dp_unset_edid() argument
4845 struct intel_connector *connector = intel_dp->attached_connector; in intel_dp_unset_edid()
4847 drm_dp_cec_unset_edid(&intel_dp->aux); in intel_dp_unset_edid()
4851 intel_dp->dfp.max_bpc = 0; in intel_dp_unset_edid()
4852 intel_dp->dfp.max_dotclock = 0; in intel_dp_unset_edid()
4853 intel_dp->dfp.min_tmds_clock = 0; in intel_dp_unset_edid()
4854 intel_dp->dfp.max_tmds_clock = 0; in intel_dp_unset_edid()
4856 intel_dp->dfp.pcon_max_frl_bw = 0; in intel_dp_unset_edid()
4858 intel_dp->dfp.ycbcr_444_to_420 = false; in intel_dp_unset_edid()
4871 struct intel_dp *intel_dp = intel_attached_dp(to_intel_connector(connector)); in intel_dp_detect() local
4872 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); in intel_dp_detect()
4885 if (intel_dp_is_edp(intel_dp)) in intel_dp_detect()
4886 status = edp_detect(intel_dp); in intel_dp_detect()
4888 status = intel_dp_detect_dpcd(intel_dp); in intel_dp_detect()
4893 memset(&intel_dp->compliance, 0, sizeof(intel_dp->compliance)); in intel_dp_detect()
4894 memset(intel_dp->dsc_dpcd, 0, sizeof(intel_dp->dsc_dpcd)); in intel_dp_detect()
4896 if (intel_dp->is_mst) { in intel_dp_detect()
4899 intel_dp->is_mst, in intel_dp_detect()
4900 intel_dp->mst_mgr.mst_state); in intel_dp_detect()
4901 intel_dp->is_mst = false; in intel_dp_detect()
4902 drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, in intel_dp_detect()
4903 intel_dp->is_mst); in intel_dp_detect()
4911 intel_dp_get_dsc_sink_cap(intel_dp); in intel_dp_detect()
4913 intel_dp_configure_mst(intel_dp); in intel_dp_detect()
4919 if (intel_dp->reset_link_params || intel_dp->is_mst) { in intel_dp_detect()
4920 intel_dp_reset_max_link_params(intel_dp); in intel_dp_detect()
4921 intel_dp->reset_link_params = false; in intel_dp_detect()
4924 intel_dp_print_rates(intel_dp); in intel_dp_detect()
4926 if (intel_dp->is_mst) { in intel_dp_detect()
4940 if (!intel_dp_is_edp(intel_dp)) { in intel_dp_detect()
4953 intel_dp->aux.i2c_nack_count = 0; in intel_dp_detect()
4954 intel_dp->aux.i2c_defer_count = 0; in intel_dp_detect()
4956 intel_dp_set_edid(intel_dp); in intel_dp_detect()
4957 if (intel_dp_is_edp(intel_dp) || in intel_dp_detect()
4961 intel_dp_check_device_service_irq(intel_dp); in intel_dp_detect()
4964 if (status != connector_status_connected && !intel_dp->is_mst) in intel_dp_detect()
4965 intel_dp_unset_edid(intel_dp); in intel_dp_detect()
4973 if (!intel_dp_is_edp(intel_dp)) in intel_dp_detect()
4976 intel_dp->dpcd, in intel_dp_detect()
4977 intel_dp->downstream_ports); in intel_dp_detect()
4984 struct intel_dp *intel_dp = intel_attached_dp(to_intel_connector(connector)); in intel_dp_force() local
4985 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); in intel_dp_force()
4994 intel_dp_unset_edid(intel_dp); in intel_dp_force()
5001 intel_dp_set_edid(intel_dp); in intel_dp_force()
5022 struct intel_dp *intel_dp = intel_attached_dp(intel_connector); in intel_dp_get_modes() local
5026 intel_dp->dpcd, in intel_dp_get_modes()
5027 intel_dp->downstream_ports); in intel_dp_get_modes()
5041 struct intel_dp *intel_dp = intel_attached_dp(to_intel_connector(connector)); in intel_dp_connector_register() local
5042 struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); in intel_dp_connector_register()
5051 intel_dp->aux.name, connector->kdev->kobj.name); in intel_dp_connector_register()
5053 intel_dp->aux.dev = connector->kdev; in intel_dp_connector_register()
5054 ret = drm_dp_aux_register(&intel_dp->aux); in intel_dp_connector_register()
5056 drm_dp_cec_register_connector(&intel_dp->aux, connector); in intel_dp_connector_register()
5077 struct intel_dp *intel_dp = intel_attached_dp(to_intel_connector(connector)); in intel_dp_connector_unregister() local
5079 drm_dp_cec_unregister_connector(&intel_dp->aux); in intel_dp_connector_unregister()
5080 drm_dp_aux_unregister(&intel_dp->aux); in intel_dp_connector_unregister()
5087 struct intel_dp *intel_dp = &dig_port->dp; in intel_dp_encoder_flush_work() local
5091 intel_pps_vdd_off_sync(intel_dp); in intel_dp_encoder_flush_work()
5097 intel_pps_wait_power_cycle(intel_dp); in intel_dp_encoder_flush_work()
5099 intel_dp_aux_fini(intel_dp); in intel_dp_encoder_flush_work()
5104 struct intel_dp *intel_dp = enc_to_intel_dp(intel_encoder); in intel_dp_encoder_suspend() local
5106 intel_pps_vdd_off_sync(intel_dp); in intel_dp_encoder_suspend()
5111 struct intel_dp *intel_dp = enc_to_intel_dp(intel_encoder); in intel_dp_encoder_shutdown() local
5113 intel_pps_wait_power_cycle(intel_dp); in intel_dp_encoder_shutdown()
5231 struct intel_dp *intel_dp = enc_to_intel_dp(intel_conn->encoder); in intel_dp_connector_atomic_check() local
5238 if (intel_dp_mst_source_support(intel_dp)) { in intel_dp_connector_atomic_check()
5239 ret = drm_dp_mst_root_conn_atomic_check(conn_state, &intel_dp->mst_mgr); in intel_dp_connector_atomic_check()
5298 struct intel_dp *intel_dp = &dig_port->dp; in intel_dp_hpd_pulse() local
5301 (long_hpd || !intel_pps_have_panel_power_or_vdd(intel_dp))) { in intel_dp_hpd_pulse()
5322 intel_dp->reset_link_params = true; in intel_dp_hpd_pulse()
5326 if (intel_dp->is_mst) { in intel_dp_hpd_pulse()
5327 if (!intel_dp_check_mst_status(intel_dp)) in intel_dp_hpd_pulse()
5329 } else if (!intel_dp_short_pulse(intel_dp)) { in intel_dp_hpd_pulse()
5384 intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector) in intel_dp_add_properties() argument
5387 enum port port = dp_to_dig_port(intel_dp)->base.port; in intel_dp_add_properties()
5389 if (!intel_dp_is_edp(intel_dp)) in intel_dp_add_properties()
5402 if (intel_bios_encoder_is_lspcon(dp_to_dig_port(intel_dp)->base.devdata)) { in intel_dp_add_properties()
5409 if (has_gamut_metadata_dip(&dp_to_dig_port(intel_dp)->base)) in intel_dp_add_properties()
5417 intel_edp_add_properties(struct intel_dp *intel_dp) in intel_edp_add_properties() argument
5419 struct intel_connector *connector = intel_dp->attached_connector; in intel_edp_add_properties()
5432 static void intel_edp_backlight_setup(struct intel_dp *intel_dp, in intel_edp_backlight_setup() argument
5435 struct drm_i915_private *i915 = dp_to_i915(intel_dp); in intel_edp_backlight_setup()
5444 pipe = vlv_active_pipe(intel_dp); in intel_edp_backlight_setup()
5447 pipe = intel_dp->pps.pps_pipe; in intel_edp_backlight_setup()
5456 static bool intel_edp_init_connector(struct intel_dp *intel_dp, in intel_edp_init_connector() argument
5459 struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); in intel_edp_init_connector()
5462 struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base; in intel_edp_init_connector()
5466 if (!intel_dp_is_edp(intel_dp)) in intel_edp_init_connector()
5487 if (!intel_pps_init(intel_dp)) { in intel_edp_init_connector()
5509 has_dpcd = intel_edp_init_dpcd(intel_dp); in intel_edp_init_connector()
5548 if (DISPLAY_VER(dev_priv) == 9 && drm_dp_is_branch(intel_dp->dpcd) && in intel_edp_init_connector()
5549 (intel_dp->dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_TYPE_MASK) == in intel_edp_init_connector()
5559 drm_edid = drm_edid_read_ddc(connector, &intel_dp->aux.ddc); in intel_edp_init_connector()
5585 intel_edp_mso_init(intel_dp); in intel_edp_init_connector()
5606 intel_edp_backlight_setup(intel_dp, intel_connector); in intel_edp_init_connector()
5608 intel_edp_add_properties(intel_dp); in intel_edp_init_connector()
5610 intel_pps_init_late(intel_dp); in intel_edp_init_connector()
5615 intel_pps_vdd_off_sync(intel_dp); in intel_edp_init_connector()
5648 struct intel_dp *intel_dp = &dig_port->dp; in intel_dp_init_connector() local
5666 intel_dp->reset_link_params = true; in intel_dp_init_connector()
5667 intel_dp->pps.pps_pipe = INVALID_PIPE; in intel_dp_init_connector()
5668 intel_dp->pps.active_pipe = INVALID_PIPE; in intel_dp_init_connector()
5671 intel_dp->DP = intel_de_read(dev_priv, intel_dp->output_reg); in intel_dp_init_connector()
5672 intel_dp->attached_connector = intel_connector; in intel_dp_init_connector()
5692 intel_dp_set_default_sink_rates(intel_dp); in intel_dp_init_connector()
5693 intel_dp_set_default_max_sink_lane_count(intel_dp); in intel_dp_init_connector()
5696 intel_dp->pps.active_pipe = vlv_active_pipe(intel_dp); in intel_dp_init_connector()
5711 intel_dp_aux_init(intel_dp); in intel_dp_init_connector()
5720 if (!intel_edp_init_connector(intel_dp, intel_connector)) { in intel_dp_init_connector()
5721 intel_dp_aux_fini(intel_dp); in intel_dp_init_connector()
5725 intel_dp_set_source_rates(intel_dp); in intel_dp_init_connector()
5726 intel_dp_set_common_rates(intel_dp); in intel_dp_init_connector()
5727 intel_dp_reset_max_link_params(intel_dp); in intel_dp_init_connector()
5733 intel_dp_add_properties(intel_dp, connector); in intel_dp_init_connector()
5735 if (is_hdcp_supported(dev_priv, port) && !intel_dp_is_edp(intel_dp)) { in intel_dp_init_connector()
5752 intel_dp->frl.is_trained = false; in intel_dp_init_connector()
5753 intel_dp->frl.trained_rate_gbps = 0; in intel_dp_init_connector()
5755 intel_psr_init(intel_dp); in intel_dp_init_connector()
5774 struct intel_dp *intel_dp; in intel_dp_mst_suspend() local
5779 intel_dp = enc_to_intel_dp(encoder); in intel_dp_mst_suspend()
5781 if (!intel_dp_mst_source_support(intel_dp)) in intel_dp_mst_suspend()
5784 if (intel_dp->is_mst) in intel_dp_mst_suspend()
5785 drm_dp_mst_topology_mgr_suspend(&intel_dp->mst_mgr); in intel_dp_mst_suspend()
5797 struct intel_dp *intel_dp; in intel_dp_mst_resume() local
5803 intel_dp = enc_to_intel_dp(encoder); in intel_dp_mst_resume()
5805 if (!intel_dp_mst_source_support(intel_dp)) in intel_dp_mst_resume()
5808 ret = drm_dp_mst_topology_mgr_resume(&intel_dp->mst_mgr, in intel_dp_mst_resume()
5811 intel_dp->is_mst = false; in intel_dp_mst_resume()
5812 drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, in intel_dp_mst_resume()