drm/amd/display: Expand DP module training API.
authorJimmy Kizito <Jimmy.Kizito@amd.com>
Sat, 10 Apr 2021 02:23:53 +0000 (22:23 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 10 May 2021 22:10:08 +0000 (18:10 -0400)
[Why & How]
Add functionality useful for DP link training to public interface.

Signed-off-by: Jimmy Kizito <Jimmy.Kizito@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h

index dd95d00..46a1d81 100644 (file)
@@ -1175,7 +1175,7 @@ static inline enum link_training_result perform_link_training_int(
        return status;
 }
 
-static enum link_training_result check_link_loss_status(
+enum link_training_result dp_check_link_loss_status(
        struct dc_link *link,
        const struct link_training_settings *link_training_setting)
 {
@@ -1309,7 +1309,7 @@ static void initialize_training_settings(
                lt_settings->enhanced_framing = 1;
 }
 
-static uint8_t convert_to_count(uint8_t lttpr_repeater_count)
+uint8_t dp_convert_to_count(uint8_t lttpr_repeater_count)
 {
        switch (lttpr_repeater_count) {
        case 0x80: // 1 lttpr repeater
@@ -1378,7 +1378,7 @@ static void configure_lttpr_mode_non_transparent(struct dc_link *link)
                        link->dpcd_caps.lttpr_caps.mode = repeater_mode;
                }
 
-               repeater_cnt = convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
+               repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
 
                for (repeater_id = repeater_cnt; repeater_id > 0; repeater_id--) {
                        aux_interval_address = DP_TRAINING_AUX_RD_INTERVAL_PHY_REPEATER1 +
@@ -1605,7 +1605,7 @@ enum link_training_result dc_link_dp_perform_link_training(
                /* 2. perform link training (set link training done
                 *  to false is done as well)
                 */
-               repeater_cnt = convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
+               repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
 
                for (repeater_id = repeater_cnt; (repeater_id > 0 && status == LINK_TRAINING_SUCCESS);
                                repeater_id--) {
@@ -1648,7 +1648,7 @@ enum link_training_result dc_link_dp_perform_link_training(
         */
        if (link->connector_signal != SIGNAL_TYPE_EDP && status == LINK_TRAINING_SUCCESS) {
                msleep(5);
-               status = check_link_loss_status(link, &lt_settings);
+               status = dp_check_link_loss_status(link, &lt_settings);
        }
 
        /* 6. print status message*/
index 38e6fbf..4288425 100644 (file)
@@ -97,5 +97,12 @@ void dp_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable);
 bool dp_update_dsc_config(struct pipe_ctx *pipe_ctx);
 bool dp_set_dsc_on_rx(struct pipe_ctx *pipe_ctx, bool enable);
 
+/* Convert PHY repeater count read from DPCD uint8_t. */
+uint8_t dp_convert_to_count(uint8_t lttpr_repeater_count);
+
+/* Check DPCD training status registers to detect link loss. */
+enum link_training_result dp_check_link_loss_status(
+               struct dc_link *link,
+               const struct link_training_settings *link_training_setting);
 
 #endif /* __DC_LINK_DP_H__ */