1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright © 2019 Intel Corporation 4 */ 5 6 #ifndef __INTEL_DP_LINK_TRAINING_H__ 7 #define __INTEL_DP_LINK_TRAINING_H__ 8 9 #include <drm/display/drm_dp_helper.h> 10 11 struct intel_atomic_state; 12 struct intel_connector; 13 struct intel_crtc_state; 14 struct intel_dp; 15 16 int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_SIZE]); 17 int intel_dp_init_lttpr_and_dprx_caps(struct intel_dp *intel_dp); 18 bool intel_dp_lttpr_transparent_mode_enabled(struct intel_dp *intel_dp); 19 20 void intel_dp_link_training_set_mode(struct intel_dp *intel_dp, 21 int link_rate, bool is_vrr, 22 bool pr_with_as_sdp_enable); 23 void intel_dp_link_training_set_bw(struct intel_dp *intel_dp, 24 int link_bw, int rate_select, int lane_count, 25 bool enhanced_framing, bool post_lt_adj_req); 26 27 bool intel_dp_get_adjust_train(struct intel_dp *intel_dp, 28 const struct intel_crtc_state *crtc_state, 29 enum drm_dp_phy dp_phy, 30 const u8 link_status[DP_LINK_STATUS_SIZE]); 31 void intel_dp_program_link_training_pattern(struct intel_dp *intel_dp, 32 const struct intel_crtc_state *crtc_state, 33 enum drm_dp_phy dp_phy, 34 u8 dp_train_pat); 35 void intel_dp_set_signal_levels(struct intel_dp *intel_dp, 36 const struct intel_crtc_state *crtc_state, 37 enum drm_dp_phy dp_phy); 38 void intel_dp_start_link_train(struct intel_atomic_state *state, 39 struct intel_dp *intel_dp, 40 const struct intel_crtc_state *crtc_state); 41 void intel_dp_stop_link_train(struct intel_dp *intel_dp, 42 const struct intel_crtc_state *crtc_state); 43 44 void 45 intel_dp_dump_link_status(struct intel_dp *intel_dp, enum drm_dp_phy dp_phy, 46 const u8 link_status[DP_LINK_STATUS_SIZE]); 47 48 /* Get the TPSx symbol type of the value programmed to DP_TRAINING_PATTERN_SET */ 49 static inline u8 intel_dp_training_pattern_symbol(u8 pattern) 50 { 51 return pattern & ~DP_LINK_SCRAMBLING_DISABLE; 52 } 53 54 void intel_dp_128b132b_sdp_crc16(struct intel_dp *intel_dp, 55 const struct intel_crtc_state *crtc_state); 56 57 void intel_dp_link_training_debugfs_add(struct intel_connector *connector); 58 59 #endif /* __INTEL_DP_LINK_TRAINING_H__ */ 60