From: Jimmy Kizito <jimmy.kiz...@amd.com>

[Why & How]
Add functionality useful for DP link training to public interface.

Signed-off-by: Jimmy Kizito <jimmy.kiz...@amd.com>
Reviewed-by: Jun Lei <jun....@amd.com>
Acked-by: Stylon Wang <stylon.w...@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 10 +++++-----
 drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h  |  7 +++++++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index b6ed57ba7a48..de75e8581078 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -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*/
diff --git a/drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h 
b/drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h
index 38e6fbf1e26d..428842511c03 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h
@@ -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__ */
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to