Commit d5a43956 authored by Wenjing Liu's avatar Wenjing Liu Committed by Alex Deucher

drm/amd/display: move dp capability related logic to link_dp_capability

Tested-by: default avatarDaniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: default avatarWesley Chalmers <Wesley.Chalmers@amd.com>
Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarWenjing Liu <wenjing.liu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 94dfeaa4
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "core_types.h" #include "core_types.h"
#include "dm_helpers.h" #include "dm_helpers.h"
#include "dc_link_dp.h" #include "dc_link_dp.h"
#include "link.h"
#include "atomfirmware.h" #include "atomfirmware.h"
#include "smu13_driver_if.h" #include "smu13_driver_if.h"
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "link_enc_cfg.h" #include "link_enc_cfg.h"
#include "resource.h" #include "resource.h"
#include "dc_link_dp.h" #include "dc_link_dp.h"
#include "link.h"
#define DC_LOGGER dc->ctx->logger #define DC_LOGGER dc->ctx->logger
...@@ -48,7 +49,7 @@ static bool is_dig_link_enc_stream(struct dc_stream_state *stream) ...@@ -48,7 +49,7 @@ static bool is_dig_link_enc_stream(struct dc_stream_state *stream)
/* DIGs do not support DP2.0 streams with 128b/132b encoding. */ /* DIGs do not support DP2.0 streams with 128b/132b encoding. */
struct dc_link_settings link_settings = {0}; struct dc_link_settings link_settings = {0};
decide_link_settings(stream, &link_settings); link_decide_link_settings(stream, &link_settings);
if ((link_settings.link_rate >= LINK_RATE_LOW) && if ((link_settings.link_rate >= LINK_RATE_LOW) &&
link_settings.link_rate <= LINK_RATE_HIGH3) { link_settings.link_rate <= LINK_RATE_HIGH3) {
is_dig_stream = true; is_dig_stream = true;
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "dpcd_defs.h" #include "dpcd_defs.h"
#include "link_enc_cfg.h" #include "link_enc_cfg.h"
#include "dc_link_dp.h" #include "dc_link_dp.h"
#include "link.h"
#include "virtual/virtual_link_hwss.h" #include "virtual/virtual_link_hwss.h"
#include "link/link_hwss_dio.h" #include "link/link_hwss_dio.h"
#include "link/link_hwss_dpia.h" #include "link/link_hwss_dpia.h"
...@@ -2213,7 +2214,7 @@ enum dc_status dc_remove_stream_from_ctx( ...@@ -2213,7 +2214,7 @@ enum dc_status dc_remove_stream_from_ctx(
del_pipe->stream_res.stream_enc, del_pipe->stream_res.stream_enc,
false); false);
if (is_dp_128b_132b_signal(del_pipe)) { if (link_is_dp_128b_132b_signal(del_pipe)) {
update_hpo_dp_stream_engine_usage( update_hpo_dp_stream_engine_usage(
&new_ctx->res_ctx, dc->res_pool, &new_ctx->res_ctx, dc->res_pool,
del_pipe->stream_res.hpo_dp_stream_enc, del_pipe->stream_res.hpo_dp_stream_enc,
...@@ -2513,9 +2514,9 @@ enum dc_status resource_map_pool_resources( ...@@ -2513,9 +2514,9 @@ enum dc_status resource_map_pool_resources(
* and link settings * and link settings
*/ */
if (dc_is_dp_signal(stream->signal)) { if (dc_is_dp_signal(stream->signal)) {
if (!decide_link_settings(stream, &pipe_ctx->link_config.dp_link_settings)) if (!link_decide_link_settings(stream, &pipe_ctx->link_config.dp_link_settings))
return DC_FAIL_DP_LINK_BANDWIDTH; return DC_FAIL_DP_LINK_BANDWIDTH;
if (dp_get_link_encoding_format(&pipe_ctx->link_config.dp_link_settings) == DP_128b_132b_ENCODING) { if (link_dp_get_encoding_format(&pipe_ctx->link_config.dp_link_settings) == DP_128b_132b_ENCODING) {
pipe_ctx->stream_res.hpo_dp_stream_enc = pipe_ctx->stream_res.hpo_dp_stream_enc =
find_first_free_match_hpo_dp_stream_enc_for_link( find_first_free_match_hpo_dp_stream_enc_for_link(
&context->res_ctx, pool, stream); &context->res_ctx, pool, stream);
...@@ -3763,7 +3764,7 @@ bool get_temp_dp_link_res(struct dc_link *link, ...@@ -3763,7 +3764,7 @@ bool get_temp_dp_link_res(struct dc_link *link,
memset(link_res, 0, sizeof(*link_res)); memset(link_res, 0, sizeof(*link_res));
if (dp_get_link_encoding_format(link_settings) == DP_128b_132b_ENCODING) { if (link_dp_get_encoding_format(link_settings) == DP_128b_132b_ENCODING) {
link_res->hpo_dp_link_enc = get_temp_hpo_dp_link_enc(res_ctx, link_res->hpo_dp_link_enc = get_temp_hpo_dp_link_enc(res_ctx,
dc->res_pool, link); dc->res_pool, link);
if (!link_res->hpo_dp_link_enc) if (!link_res->hpo_dp_link_enc)
...@@ -3995,7 +3996,7 @@ enum dc_status update_dp_encoder_resources_for_test_harness(const struct dc *dc, ...@@ -3995,7 +3996,7 @@ enum dc_status update_dp_encoder_resources_for_test_harness(const struct dc *dc,
struct dc_state *context, struct dc_state *context,
struct pipe_ctx *pipe_ctx) struct pipe_ctx *pipe_ctx)
{ {
if (dp_get_link_encoding_format(&pipe_ctx->link_config.dp_link_settings) == DP_128b_132b_ENCODING) { if (link_dp_get_encoding_format(&pipe_ctx->link_config.dp_link_settings) == DP_128b_132b_ENCODING) {
if (pipe_ctx->stream_res.hpo_dp_stream_enc == NULL) { if (pipe_ctx->stream_res.hpo_dp_stream_enc == NULL) {
pipe_ctx->stream_res.hpo_dp_stream_enc = pipe_ctx->stream_res.hpo_dp_stream_enc =
find_first_free_match_hpo_dp_stream_enc_for_link( find_first_free_match_hpo_dp_stream_enc_for_link(
......
...@@ -584,5 +584,7 @@ int dc_link_aux_transfer_raw(struct ddc_service *ddc, ...@@ -584,5 +584,7 @@ int dc_link_aux_transfer_raw(struct ddc_service *ddc,
enum lttpr_mode dc_link_decide_lttpr_mode(struct dc_link *link, enum lttpr_mode dc_link_decide_lttpr_mode(struct dc_link *link,
struct dc_link_settings *link_setting); struct dc_link_settings *link_setting);
void dc_link_dp_receiver_power_ctrl(struct dc_link *link, bool on); void dc_link_dp_receiver_power_ctrl(struct dc_link *link, bool on);
bool dc_link_decide_edp_link_settings(struct dc_link *link,
struct dc_link_settings *link_setting,
uint32_t req_bw);
#endif /* DC_LINK_H_ */ #endif /* DC_LINK_H_ */
...@@ -1154,7 +1154,7 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx) ...@@ -1154,7 +1154,7 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
pipe_ctx->stream_res.stream_enc); pipe_ctx->stream_res.stream_enc);
} }
if (is_dp_128b_132b_signal(pipe_ctx)) { if (link_is_dp_128b_132b_signal(pipe_ctx)) {
pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->stop_dp_info_packets( pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->stop_dp_info_packets(
pipe_ctx->stream_res.hpo_dp_stream_enc); pipe_ctx->stream_res.hpo_dp_stream_enc);
} else if (dc_is_dp_signal(pipe_ctx->stream->signal)) } else if (dc_is_dp_signal(pipe_ctx->stream->signal))
...@@ -1165,7 +1165,7 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx) ...@@ -1165,7 +1165,7 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
link_hwss->reset_stream_encoder(pipe_ctx); link_hwss->reset_stream_encoder(pipe_ctx);
if (is_dp_128b_132b_signal(pipe_ctx)) { if (link_is_dp_128b_132b_signal(pipe_ctx)) {
dto_params.otg_inst = tg->inst; dto_params.otg_inst = tg->inst;
dto_params.timing = &pipe_ctx->stream->timing; dto_params.timing = &pipe_ctx->stream->timing;
dp_hpo_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst; dp_hpo_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst;
...@@ -1174,7 +1174,7 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx) ...@@ -1174,7 +1174,7 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
dccg->funcs->set_dpstreamclk(dccg, REFCLK, tg->inst, dp_hpo_inst); dccg->funcs->set_dpstreamclk(dccg, REFCLK, tg->inst, dp_hpo_inst);
} }
if (is_dp_128b_132b_signal(pipe_ctx)) { if (link_is_dp_128b_132b_signal(pipe_ctx)) {
/* TODO: This looks like a bug to me as we are disabling HPO IO when /* TODO: This looks like a bug to me as we are disabling HPO IO when
* we are just disabling a single HPO stream. Shouldn't we disable HPO * we are just disabling a single HPO stream. Shouldn't we disable HPO
* HW control only when HPOs for all streams are disabled? * HW control only when HPOs for all streams are disabled?
...@@ -1216,7 +1216,7 @@ void dce110_blank_stream(struct pipe_ctx *pipe_ctx) ...@@ -1216,7 +1216,7 @@ void dce110_blank_stream(struct pipe_ctx *pipe_ctx)
link->dc->hwss.set_abm_immediate_disable(pipe_ctx); link->dc->hwss.set_abm_immediate_disable(pipe_ctx);
} }
if (is_dp_128b_132b_signal(pipe_ctx)) { if (link_is_dp_128b_132b_signal(pipe_ctx)) {
/* TODO - DP2.0 HW: Set ODM mode in dp hpo encoder here */ /* TODO - DP2.0 HW: Set ODM mode in dp hpo encoder here */
pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_blank( pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_blank(
pipe_ctx->stream_res.hpo_dp_stream_enc); pipe_ctx->stream_res.hpo_dp_stream_enc);
...@@ -1421,7 +1421,7 @@ static enum dc_status dce110_enable_stream_timing( ...@@ -1421,7 +1421,7 @@ static enum dc_status dce110_enable_stream_timing(
if (false == pipe_ctx->clock_source->funcs->program_pix_clk( if (false == pipe_ctx->clock_source->funcs->program_pix_clk(
pipe_ctx->clock_source, pipe_ctx->clock_source,
&pipe_ctx->stream_res.pix_clk_params, &pipe_ctx->stream_res.pix_clk_params,
dp_get_link_encoding_format(&pipe_ctx->link_config.dp_link_settings), link_dp_get_encoding_format(&pipe_ctx->link_config.dp_link_settings),
&pipe_ctx->pll_settings)) { &pipe_ctx->pll_settings)) {
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
return DC_ERROR_UNEXPECTED; return DC_ERROR_UNEXPECTED;
...@@ -1525,7 +1525,7 @@ static enum dc_status apply_single_controller_ctx_to_hw( ...@@ -1525,7 +1525,7 @@ static enum dc_status apply_single_controller_ctx_to_hw(
* To do so, move calling function enable_stream_timing to only be done AFTER calling * To do so, move calling function enable_stream_timing to only be done AFTER calling
* function core_link_enable_stream * function core_link_enable_stream
*/ */
if (!(hws->wa.dp_hpo_and_otg_sequence && is_dp_128b_132b_signal(pipe_ctx))) if (!(hws->wa.dp_hpo_and_otg_sequence && link_is_dp_128b_132b_signal(pipe_ctx)))
/* */ /* */
/* Do not touch stream timing on seamless boot optimization. */ /* Do not touch stream timing on seamless boot optimization. */
if (!pipe_ctx->stream->apply_seamless_boot_optimization) if (!pipe_ctx->stream->apply_seamless_boot_optimization)
...@@ -1567,7 +1567,7 @@ static enum dc_status apply_single_controller_ctx_to_hw( ...@@ -1567,7 +1567,7 @@ static enum dc_status apply_single_controller_ctx_to_hw(
* To do so, move calling function enable_stream_timing to only be done AFTER calling * To do so, move calling function enable_stream_timing to only be done AFTER calling
* function core_link_enable_stream * function core_link_enable_stream
*/ */
if (hws->wa.dp_hpo_and_otg_sequence && is_dp_128b_132b_signal(pipe_ctx)) { if (hws->wa.dp_hpo_and_otg_sequence && link_is_dp_128b_132b_signal(pipe_ctx)) {
if (!pipe_ctx->stream->apply_seamless_boot_optimization) if (!pipe_ctx->stream->apply_seamless_boot_optimization)
hws->funcs.enable_stream_timing(pipe_ctx, context, dc); hws->funcs.enable_stream_timing(pipe_ctx, context, dc);
} }
...@@ -3047,13 +3047,13 @@ void dce110_enable_dp_link_output( ...@@ -3047,13 +3047,13 @@ void dce110_enable_dp_link_output(
pipes[i].clock_source->funcs->program_pix_clk( pipes[i].clock_source->funcs->program_pix_clk(
pipes[i].clock_source, pipes[i].clock_source,
&pipes[i].stream_res.pix_clk_params, &pipes[i].stream_res.pix_clk_params,
dp_get_link_encoding_format(link_settings), link_dp_get_encoding_format(link_settings),
&pipes[i].pll_settings); &pipes[i].pll_settings);
} }
} }
} }
if (dp_get_link_encoding_format(link_settings) == DP_8b_10b_ENCODING) { if (link_dp_get_encoding_format(link_settings) == DP_8b_10b_ENCODING) {
if (dc->clk_mgr->funcs->notify_link_rate_change) if (dc->clk_mgr->funcs->notify_link_rate_change)
dc->clk_mgr->funcs->notify_link_rate_change(dc->clk_mgr, link); dc->clk_mgr->funcs->notify_link_rate_change(dc->clk_mgr, link);
} }
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#include "dc_trace.h" #include "dc_trace.h"
#include "dce/dmub_outbox.h" #include "dce/dmub_outbox.h"
#include "inc/dc_link_dp.h" #include "inc/dc_link_dp.h"
#include "link.h"
#define DC_LOGGER_INIT(logger) #define DC_LOGGER_INIT(logger)
...@@ -920,7 +921,7 @@ enum dc_status dcn10_enable_stream_timing( ...@@ -920,7 +921,7 @@ enum dc_status dcn10_enable_stream_timing(
if (false == pipe_ctx->clock_source->funcs->program_pix_clk( if (false == pipe_ctx->clock_source->funcs->program_pix_clk(
pipe_ctx->clock_source, pipe_ctx->clock_source,
&pipe_ctx->stream_res.pix_clk_params, &pipe_ctx->stream_res.pix_clk_params,
dp_get_link_encoding_format(&pipe_ctx->link_config.dp_link_settings), link_dp_get_encoding_format(&pipe_ctx->link_config.dp_link_settings),
&pipe_ctx->pll_settings)) { &pipe_ctx->pll_settings)) {
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
return DC_ERROR_UNEXPECTED; return DC_ERROR_UNEXPECTED;
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include "dpcd_defs.h" #include "dpcd_defs.h"
#include "inc/link_enc_cfg.h" #include "inc/link_enc_cfg.h"
#include "link_hwss.h" #include "link_hwss.h"
#include "link.h"
#define DC_LOGGER_INIT(logger) #define DC_LOGGER_INIT(logger)
...@@ -711,7 +712,7 @@ enum dc_status dcn20_enable_stream_timing( ...@@ -711,7 +712,7 @@ enum dc_status dcn20_enable_stream_timing(
if (false == pipe_ctx->clock_source->funcs->program_pix_clk( if (false == pipe_ctx->clock_source->funcs->program_pix_clk(
pipe_ctx->clock_source, pipe_ctx->clock_source,
&pipe_ctx->stream_res.pix_clk_params, &pipe_ctx->stream_res.pix_clk_params,
dp_get_link_encoding_format(&pipe_ctx->link_config.dp_link_settings), link_dp_get_encoding_format(&pipe_ctx->link_config.dp_link_settings),
&pipe_ctx->pll_settings)) { &pipe_ctx->pll_settings)) {
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
return DC_ERROR_UNEXPECTED; return DC_ERROR_UNEXPECTED;
...@@ -2382,7 +2383,7 @@ void dcn20_unblank_stream(struct pipe_ctx *pipe_ctx, ...@@ -2382,7 +2383,7 @@ void dcn20_unblank_stream(struct pipe_ctx *pipe_ctx,
params.link_settings.link_rate = link_settings->link_rate; params.link_settings.link_rate = link_settings->link_rate;
if (is_dp_128b_132b_signal(pipe_ctx)) { if (link_is_dp_128b_132b_signal(pipe_ctx)) {
/* TODO - DP2.0 HW: Set ODM mode in dp hpo encoder here */ /* TODO - DP2.0 HW: Set ODM mode in dp hpo encoder here */
pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_unblank( pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_unblank(
pipe_ctx->stream_res.hpo_dp_stream_enc, pipe_ctx->stream_res.hpo_dp_stream_enc,
...@@ -2690,12 +2691,12 @@ void dcn20_enable_stream(struct pipe_ctx *pipe_ctx) ...@@ -2690,12 +2691,12 @@ void dcn20_enable_stream(struct pipe_ctx *pipe_ctx)
unsigned int k1_div = PIXEL_RATE_DIV_NA; unsigned int k1_div = PIXEL_RATE_DIV_NA;
unsigned int k2_div = PIXEL_RATE_DIV_NA; unsigned int k2_div = PIXEL_RATE_DIV_NA;
if (is_dp_128b_132b_signal(pipe_ctx)) { if (link_is_dp_128b_132b_signal(pipe_ctx)) {
if (dc->hwseq->funcs.setup_hpo_hw_control) if (dc->hwseq->funcs.setup_hpo_hw_control)
dc->hwseq->funcs.setup_hpo_hw_control(dc->hwseq, true); dc->hwseq->funcs.setup_hpo_hw_control(dc->hwseq, true);
} }
if (is_dp_128b_132b_signal(pipe_ctx)) { if (link_is_dp_128b_132b_signal(pipe_ctx)) {
dp_hpo_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst; dp_hpo_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst;
dccg->funcs->set_dpstreamclk(dccg, DTBCLK0, tg->inst, dp_hpo_inst); dccg->funcs->set_dpstreamclk(dccg, DTBCLK0, tg->inst, dp_hpo_inst);
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "dpcd_defs.h" #include "dpcd_defs.h"
#include "dce/dmub_outbox.h" #include "dce/dmub_outbox.h"
#include "dc_link_dp.h" #include "dc_link_dp.h"
#include "link.h"
#include "dcn10/dcn10_hw_sequencer.h" #include "dcn10/dcn10_hw_sequencer.h"
#include "inc/link_enc_cfg.h" #include "inc/link_enc_cfg.h"
#include "dcn30/dcn30_vpg.h" #include "dcn30/dcn30_vpg.h"
...@@ -414,7 +415,12 @@ void dcn31_update_info_frame(struct pipe_ctx *pipe_ctx) ...@@ -414,7 +415,12 @@ void dcn31_update_info_frame(struct pipe_ctx *pipe_ctx)
pipe_ctx->stream_res.stream_enc->funcs->update_hdmi_info_packets( pipe_ctx->stream_res.stream_enc->funcs->update_hdmi_info_packets(
pipe_ctx->stream_res.stream_enc, pipe_ctx->stream_res.stream_enc,
&pipe_ctx->stream_res.encoder_info_frame); &pipe_ctx->stream_res.encoder_info_frame);
else { else if (link_is_dp_128b_132b_signal(pipe_ctx)) {
pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->update_dp_info_packets(
pipe_ctx->stream_res.hpo_dp_stream_enc,
&pipe_ctx->stream_res.encoder_info_frame);
return;
} else {
pipe_ctx->stream_res.stream_enc->funcs->update_dp_info_packets( pipe_ctx->stream_res.stream_enc->funcs->update_dp_info_packets(
pipe_ctx->stream_res.stream_enc, pipe_ctx->stream_res.stream_enc,
&pipe_ctx->stream_res.encoder_info_frame); &pipe_ctx->stream_res.encoder_info_frame);
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "dpcd_defs.h" #include "dpcd_defs.h"
#include "dce/dmub_outbox.h" #include "dce/dmub_outbox.h"
#include "dc_link_dp.h" #include "dc_link_dp.h"
#include "link.h"
#include "inc/dc_link_dp.h" #include "inc/dc_link_dp.h"
#include "dcn10/dcn10_hw_sequencer.h" #include "dcn10/dcn10_hw_sequencer.h"
#include "inc/link_enc_cfg.h" #include "inc/link_enc_cfg.h"
...@@ -347,7 +348,7 @@ unsigned int dcn314_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsig ...@@ -347,7 +348,7 @@ unsigned int dcn314_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsig
two_pix_per_container = optc2_is_two_pixels_per_containter(&stream->timing); two_pix_per_container = optc2_is_two_pixels_per_containter(&stream->timing);
odm_combine_factor = get_odm_config(pipe_ctx, NULL); odm_combine_factor = get_odm_config(pipe_ctx, NULL);
if (is_dp_128b_132b_signal(pipe_ctx)) { if (link_is_dp_128b_132b_signal(pipe_ctx)) {
*k1_div = PIXEL_RATE_DIV_BY_1; *k1_div = PIXEL_RATE_DIV_BY_1;
*k2_div = PIXEL_RATE_DIV_BY_1; *k2_div = PIXEL_RATE_DIV_BY_1;
} else if (dc_is_hdmi_tmds_signal(pipe_ctx->stream->signal) || dc_is_dvi_signal(pipe_ctx->stream->signal)) { } else if (dc_is_hdmi_tmds_signal(pipe_ctx->stream->signal) || dc_is_dvi_signal(pipe_ctx->stream->signal)) {
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "dmub_subvp_state.h" #include "dmub_subvp_state.h"
#include "dce/dmub_hw_lock_mgr.h" #include "dce/dmub_hw_lock_mgr.h"
#include "dcn32_resource.h" #include "dcn32_resource.h"
#include "link.h"
#include "dc_link_dp.h" #include "dc_link_dp.h"
#include "dmub/inc/dmub_subvp_state.h" #include "dmub/inc/dmub_subvp_state.h"
...@@ -1056,7 +1057,7 @@ unsigned int dcn32_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsign ...@@ -1056,7 +1057,7 @@ unsigned int dcn32_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsign
two_pix_per_container = optc2_is_two_pixels_per_containter(&stream->timing); two_pix_per_container = optc2_is_two_pixels_per_containter(&stream->timing);
odm_combine_factor = get_odm_config(pipe_ctx, NULL); odm_combine_factor = get_odm_config(pipe_ctx, NULL);
if (is_dp_128b_132b_signal(pipe_ctx)) { if (link_is_dp_128b_132b_signal(pipe_ctx)) {
*k1_div = PIXEL_RATE_DIV_BY_1; *k1_div = PIXEL_RATE_DIV_BY_1;
*k2_div = PIXEL_RATE_DIV_BY_1; *k2_div = PIXEL_RATE_DIV_BY_1;
} else if (dc_is_hdmi_tmds_signal(pipe_ctx->stream->signal) || dc_is_dvi_signal(pipe_ctx->stream->signal)) { } else if (dc_is_hdmi_tmds_signal(pipe_ctx->stream->signal) || dc_is_dvi_signal(pipe_ctx->stream->signal)) {
...@@ -1120,7 +1121,7 @@ void dcn32_unblank_stream(struct pipe_ctx *pipe_ctx, ...@@ -1120,7 +1121,7 @@ void dcn32_unblank_stream(struct pipe_ctx *pipe_ctx,
params.link_settings.link_rate = link_settings->link_rate; params.link_settings.link_rate = link_settings->link_rate;
if (is_dp_128b_132b_signal(pipe_ctx)) { if (link_is_dp_128b_132b_signal(pipe_ctx)) {
/* TODO - DP2.0 HW: Set ODM mode in dp hpo encoder here */ /* TODO - DP2.0 HW: Set ODM mode in dp hpo encoder here */
pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_unblank( pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_unblank(
pipe_ctx->stream_res.hpo_dp_stream_enc, pipe_ctx->stream_res.hpo_dp_stream_enc,
...@@ -1147,7 +1148,7 @@ bool dcn32_is_dp_dig_pixel_rate_div_policy(struct pipe_ctx *pipe_ctx) ...@@ -1147,7 +1148,7 @@ bool dcn32_is_dp_dig_pixel_rate_div_policy(struct pipe_ctx *pipe_ctx)
if (!is_h_timing_divisible_by_2(pipe_ctx->stream)) if (!is_h_timing_divisible_by_2(pipe_ctx->stream))
return false; return false;
if (dc_is_dp_signal(pipe_ctx->stream->signal) && !is_dp_128b_132b_signal(pipe_ctx) && if (dc_is_dp_signal(pipe_ctx->stream->signal) && !link_is_dp_128b_132b_signal(pipe_ctx) &&
dc->debug.enable_dp_dig_pixel_rate_div_policy) dc->debug.enable_dp_dig_pixel_rate_div_policy)
return true; return true;
return false; return false;
...@@ -1181,7 +1182,7 @@ static void apply_symclk_on_tx_off_wa(struct dc_link *link) ...@@ -1181,7 +1182,7 @@ static void apply_symclk_on_tx_off_wa(struct dc_link *link)
pipe_ctx->clock_source->funcs->program_pix_clk( pipe_ctx->clock_source->funcs->program_pix_clk(
pipe_ctx->clock_source, pipe_ctx->clock_source,
&pipe_ctx->stream_res.pix_clk_params, &pipe_ctx->stream_res.pix_clk_params,
dp_get_link_encoding_format(&pipe_ctx->link_config.dp_link_settings), link_dp_get_encoding_format(&pipe_ctx->link_config.dp_link_settings),
&pipe_ctx->pll_settings); &pipe_ctx->pll_settings);
link->phy_state.symclk_state = SYMCLK_ON_TX_OFF; link->phy_state.symclk_state = SYMCLK_ON_TX_OFF;
break; break;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "dcn21/dcn21_resource.h" #include "dcn21/dcn21_resource.h"
#include "clk_mgr/dcn21/rn_clk_mgr.h" #include "clk_mgr/dcn21/rn_clk_mgr.h"
#include "link.h"
#include "dcn20_fpu.h" #include "dcn20_fpu.h"
#define DC_LOGGER_INIT(logger) #define DC_LOGGER_INIT(logger)
...@@ -938,7 +939,7 @@ static bool is_dtbclk_required(struct dc *dc, struct dc_state *context) ...@@ -938,7 +939,7 @@ static bool is_dtbclk_required(struct dc *dc, struct dc_state *context)
for (i = 0; i < dc->res_pool->pipe_count; i++) { for (i = 0; i < dc->res_pool->pipe_count; i++) {
if (!context->res_ctx.pipe_ctx[i].stream) if (!context->res_ctx.pipe_ctx[i].stream)
continue; continue;
if (is_dp_128b_132b_signal(&context->res_ctx.pipe_ctx[i])) if (link_is_dp_128b_132b_signal(&context->res_ctx.pipe_ctx[i]))
return true; return true;
} }
return false; return false;
...@@ -1302,7 +1303,7 @@ int dcn20_populate_dml_pipes_from_context( ...@@ -1302,7 +1303,7 @@ int dcn20_populate_dml_pipes_from_context(
case SIGNAL_TYPE_DISPLAY_PORT_MST: case SIGNAL_TYPE_DISPLAY_PORT_MST:
case SIGNAL_TYPE_DISPLAY_PORT: case SIGNAL_TYPE_DISPLAY_PORT:
pipes[pipe_cnt].dout.output_type = dm_dp; pipes[pipe_cnt].dout.output_type = dm_dp;
if (is_dp_128b_132b_signal(&res_ctx->pipe_ctx[i])) if (link_is_dp_128b_132b_signal(&res_ctx->pipe_ctx[i]))
pipes[pipe_cnt].dout.output_type = dm_dp2p0; pipes[pipe_cnt].dout.output_type = dm_dp2p0;
break; break;
case SIGNAL_TYPE_EDP: case SIGNAL_TYPE_EDP:
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
// We need this includes for WATERMARKS_* defines // We need this includes for WATERMARKS_* defines
#include "clk_mgr/dcn32/dcn32_smu13_driver_if.h" #include "clk_mgr/dcn32/dcn32_smu13_driver_if.h"
#include "dcn30/dcn30_resource.h" #include "dcn30/dcn30_resource.h"
#include "link.h"
#define DC_LOGGER_INIT(logger) #define DC_LOGGER_INIT(logger)
...@@ -1263,7 +1264,7 @@ static bool is_dtbclk_required(struct dc *dc, struct dc_state *context) ...@@ -1263,7 +1264,7 @@ static bool is_dtbclk_required(struct dc *dc, struct dc_state *context)
for (i = 0; i < dc->res_pool->pipe_count; i++) { for (i = 0; i < dc->res_pool->pipe_count; i++) {
if (!context->res_ctx.pipe_ctx[i].stream) if (!context->res_ctx.pipe_ctx[i].stream)
continue; continue;
if (is_dp_128b_132b_signal(&context->res_ctx.pipe_ctx[i])) if (link_is_dp_128b_132b_signal(&context->res_ctx.pipe_ctx[i]))
return true; return true;
} }
return false; return false;
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
#define LINK_TRAINING_ATTEMPTS 4 #define LINK_TRAINING_ATTEMPTS 4
#define LINK_TRAINING_RETRY_DELAY 50 /* ms */ #define LINK_TRAINING_RETRY_DELAY 50 /* ms */
#define LINK_AUX_DEFAULT_LTTPR_TIMEOUT_PERIOD 3200 /*us*/
#define LINK_AUX_DEFAULT_TIMEOUT_PERIOD 552 /*us*/
#define MAX_MTP_SLOT_COUNT 64 #define MAX_MTP_SLOT_COUNT 64
#define TRAINING_AUX_RD_INTERVAL 100 //us #define TRAINING_AUX_RD_INTERVAL 100 //us
#define LINK_AUX_WAKE_TIMEOUT_MS 1500 // Timeout when trying to wake unresponsive DPRX. #define LINK_AUX_WAKE_TIMEOUT_MS 1500 // Timeout when trying to wake unresponsive DPRX.
...@@ -49,7 +47,6 @@ enum { ...@@ -49,7 +47,6 @@ enum {
PEAK_FACTOR_X1000 = 1006, PEAK_FACTOR_X1000 = 1006,
}; };
struct dc_link_settings dp_get_max_link_cap(struct dc_link *link);
bool dp_verify_link_cap_with_retries( bool dp_verify_link_cap_with_retries(
struct dc_link *link, struct dc_link *link,
...@@ -60,26 +57,11 @@ bool dp_validate_mode_timing( ...@@ -60,26 +57,11 @@ bool dp_validate_mode_timing(
struct dc_link *link, struct dc_link *link,
const struct dc_crtc_timing *timing); const struct dc_crtc_timing *timing);
bool decide_edp_link_settings(struct dc_link *link,
struct dc_link_settings *link_setting,
uint32_t req_bw);
bool decide_link_settings(
struct dc_stream_state *stream,
struct dc_link_settings *link_setting);
bool hpd_rx_irq_check_link_loss_status(struct dc_link *link, bool hpd_rx_irq_check_link_loss_status(struct dc_link *link,
union hpd_irq_data *hpd_irq_dpcd_data); union hpd_irq_data *hpd_irq_dpcd_data);
enum dc_status read_hpd_rx_irq_data(
bool is_mst_supported(struct dc_link *link); struct dc_link *link,
union hpd_irq_data *irq_data);
bool detect_dp_sink_caps(struct dc_link *link);
void detect_edp_sink_caps(struct dc_link *link);
bool is_dp_active_dongle(const struct dc_link *link);
bool is_dp_branch_device(const struct dc_link *link);
bool is_edp_ilr_optimization_required(struct dc_link *link, struct dc_crtc_timing *crtc_timing); bool is_edp_ilr_optimization_required(struct dc_link *link, struct dc_crtc_timing *crtc_timing);
...@@ -88,10 +70,6 @@ void dp_enable_mst_on_sink(struct dc_link *link, bool enable); ...@@ -88,10 +70,6 @@ void dp_enable_mst_on_sink(struct dc_link *link, bool enable);
enum dp_panel_mode dp_get_panel_mode(struct dc_link *link); enum dp_panel_mode dp_get_panel_mode(struct dc_link *link);
void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode); void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode);
bool dp_overwrite_extended_receiver_cap(struct dc_link *link);
void dpcd_set_source_specific_data(struct dc_link *link);
void dpcd_write_cable_id_to_dprx(struct dc_link *link); void dpcd_write_cable_id_to_dprx(struct dc_link *link);
enum dc_status dp_set_fec_ready(struct dc_link *link, const struct link_resource *link_res, bool ready); enum dc_status dp_set_fec_ready(struct dc_link *link, const struct link_resource *link_res, bool ready);
...@@ -108,12 +86,6 @@ void dp_decide_training_settings( ...@@ -108,12 +86,6 @@ void dp_decide_training_settings(
const struct dc_link_settings *link_setting, const struct dc_link_settings *link_setting,
struct link_training_settings *lt_settings); struct link_training_settings *lt_settings);
/* Convert PHY repeater count read from DPCD uint8_t. */
uint8_t dp_convert_to_count(uint8_t lttpr_repeater_count);
enum dp_link_encoding dp_get_link_encoding_format(const struct dc_link_settings *link_settings);
enum dc_status dp_retrieve_lttpr_cap(struct dc_link *link);
bool dp_is_lttpr_present(struct dc_link *link);
bool dpcd_write_128b_132b_sst_payload_allocation_table( bool dpcd_write_128b_132b_sst_payload_allocation_table(
const struct dc_stream_state *stream, const struct dc_stream_state *stream,
struct dc_link *link, struct dc_link *link,
...@@ -132,7 +104,6 @@ void disable_dp_hpo_output(struct dc_link *link, ...@@ -132,7 +104,6 @@ void disable_dp_hpo_output(struct dc_link *link,
const struct link_resource *link_res, const struct link_resource *link_res,
enum signal_type signal); enum signal_type signal);
void setup_dp_hpo_stream(struct pipe_ctx *pipe_ctx, bool enable); void setup_dp_hpo_stream(struct pipe_ctx *pipe_ctx, bool enable);
bool is_dp_128b_132b_signal(struct pipe_ctx *pipe_ctx);
void edp_panel_backlight_power_on(struct dc_link *link, bool wait_for_hpd); void edp_panel_backlight_power_on(struct dc_link *link, bool wait_for_hpd);
void dp_source_sequence_trace(struct dc_link *link, uint8_t dp_test_mode); void dp_source_sequence_trace(struct dc_link *link, uint8_t dp_test_mode);
void edp_add_delay_for_T9(struct dc_link *link); void edp_add_delay_for_T9(struct dc_link *link);
...@@ -143,10 +114,4 @@ void dp_retrain_link_dp_test(struct dc_link *link, ...@@ -143,10 +114,4 @@ void dp_retrain_link_dp_test(struct dc_link *link,
struct dc_link_settings *link_setting, struct dc_link_settings *link_setting,
bool skip_video_pattern); bool skip_video_pattern);
bool decide_fallback_link_setting(
struct dc_link *link,
struct dc_link_settings *max,
struct dc_link_settings *cur,
enum link_training_result training_result);
#endif /* __DC_LINK_DP_H__ */ #endif /* __DC_LINK_DP_H__ */
...@@ -80,5 +80,13 @@ bool link_aux_transfer_with_retries_no_mutex(struct ddc_service *ddc, ...@@ -80,5 +80,13 @@ bool link_aux_transfer_with_retries_no_mutex(struct ddc_service *ddc,
uint32_t link_get_aux_defer_delay(struct ddc_service *ddc); uint32_t link_get_aux_defer_delay(struct ddc_service *ddc);
bool link_is_dp_128b_132b_signal(struct pipe_ctx *pipe_ctx);
enum dp_link_encoding link_dp_get_encoding_format(
const struct dc_link_settings *link_settings);
bool link_decide_link_settings(
struct dc_stream_state *stream,
struct dc_link_settings *link_setting);
#endif /* __DC_LINK_HPD_H__ */ #endif /* __DC_LINK_HPD_H__ */
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
LINK = link_hwss_dio.o link_hwss_dpia.o link_hwss_hpo_dp.o link_dp_trace.o \ LINK = link_hwss_dio.o link_hwss_dpia.o link_hwss_hpo_dp.o link_dp_trace.o \
link_hpd.o link_ddc.o link_dpcd.o link_dp_dpia.o link_dp_training.o \ link_hpd.o link_ddc.o link_dpcd.o link_dp_dpia.o link_dp_training.o \
link_dp_training_8b_10b.o link_dp_training_128b_132b.o link_dp_training_dpia.o \ link_dp_training_8b_10b.o link_dp_training_128b_132b.o link_dp_training_dpia.o \
link_dp_training_auxless.o link_dp_training_fixed_vs_pe_retimer.o link_dp_phy.o link_dp_training_auxless.o link_dp_training_fixed_vs_pe_retimer.o link_dp_phy.o \
link_dp_capability.o
AMD_DAL_LINK = $(addprefix $(AMDDALPATH)/dc/link/,$(LINK)) AMD_DAL_LINK = $(addprefix $(AMDDALPATH)/dc/link/,$(LINK))
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#define I2C_OVER_AUX_DEFER_WA_DELAY 70 #define I2C_OVER_AUX_DEFER_WA_DELAY 70
#define DPVGA_DONGLE_AUX_DEFER_WA_DELAY 40 #define DPVGA_DONGLE_AUX_DEFER_WA_DELAY 40
#define I2C_OVER_AUX_DEFER_WA_DELAY_1MS 1 #define I2C_OVER_AUX_DEFER_WA_DELAY_1MS 1
#define LINK_AUX_DEFAULT_LTTPR_TIMEOUT_PERIOD 3200 /*us*/
#define EDID_SEGMENT_SIZE 256 #define EDID_SEGMENT_SIZE 256
......
This diff is collapsed.
/*
* Copyright 2022 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef __DC_LINK_DP_CAPABILITY_H__
#define __DC_LINK_DP_CAPABILITY_H__
#include "link.h"
bool detect_dp_sink_caps(struct dc_link *link);
void detect_edp_sink_caps(struct dc_link *link);
struct dc_link_settings dp_get_max_link_cap(struct dc_link *link);
enum dc_status dp_retrieve_lttpr_cap(struct dc_link *link);
/* Convert PHY repeater count read from DPCD uint8_t. */
uint8_t dp_parse_lttpr_repeater_count(uint8_t lttpr_repeater_count);
bool dp_is_lttpr_present(struct dc_link *link);
bool is_dp_active_dongle(const struct dc_link *link);
bool is_dp_branch_device(const struct dc_link *link);
bool decide_edp_link_settings_with_dsc(struct dc_link *link,
struct dc_link_settings *link_setting,
uint32_t req_bw,
enum dc_link_rate max_link_rate);
void dpcd_set_source_specific_data(struct dc_link *link);
/*query dpcd for version and mst cap addresses*/
bool read_is_mst_supported(struct dc_link *link);
bool decide_fallback_link_setting(
struct dc_link *link,
struct dc_link_settings *max,
struct dc_link_settings *cur,
enum link_training_result training_result);
#endif /* __DC_LINK_DP_CAPABILITY_H__ */
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "link_dp_phy.h" #include "link_dp_phy.h"
#include "link_dpcd.h" #include "link_dpcd.h"
#include "link_dp_training.h" #include "link_dp_training.h"
#include "link_dp_capability.h"
#include "clk_mgr.h" #include "clk_mgr.h"
#include "resource.h" #include "resource.h"
#include "dc_link_dp.h" #include "dc_link_dp.h"
...@@ -117,7 +118,7 @@ void dp_disable_link_phy_mst(struct dc_link *link, ...@@ -117,7 +118,7 @@ void dp_disable_link_phy_mst(struct dc_link *link,
static inline bool is_immediate_downstream(struct dc_link *link, uint32_t offset) static inline bool is_immediate_downstream(struct dc_link *link, uint32_t offset)
{ {
return (dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt) == return (dp_parse_lttpr_repeater_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt) ==
offset); offset);
} }
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "link_dpcd.h" #include "link_dpcd.h"
#include "link_dp_trace.h" #include "link_dp_trace.h"
#include "link_dp_phy.h" #include "link_dp_phy.h"
#include "link_dp_capability.h"
#include "dc_link_dp.h" #include "dc_link_dp.h"
#include "atomfirmware.h" #include "atomfirmware.h"
#include "link_enc_cfg.h" #include "link_enc_cfg.h"
...@@ -342,7 +343,7 @@ void dp_hw_to_dpcd_lane_settings( ...@@ -342,7 +343,7 @@ void dp_hw_to_dpcd_lane_settings(
uint8_t lane = 0; uint8_t lane = 0;
for (lane = 0; lane < LANE_COUNT_DP_MAX; lane++) { for (lane = 0; lane < LANE_COUNT_DP_MAX; lane++) {
if (dp_get_link_encoding_format(&lt_settings->link_settings) == if (link_dp_get_encoding_format(&lt_settings->link_settings) ==
DP_8b_10b_ENCODING) { DP_8b_10b_ENCODING) {
dpcd_lane_settings[lane].bits.VOLTAGE_SWING_SET = dpcd_lane_settings[lane].bits.VOLTAGE_SWING_SET =
(uint8_t)(hw_lane_settings[lane].VOLTAGE_SWING); (uint8_t)(hw_lane_settings[lane].VOLTAGE_SWING);
...@@ -354,7 +355,7 @@ void dp_hw_to_dpcd_lane_settings( ...@@ -354,7 +355,7 @@ void dp_hw_to_dpcd_lane_settings(
dpcd_lane_settings[lane].bits.MAX_PRE_EMPHASIS_REACHED = dpcd_lane_settings[lane].bits.MAX_PRE_EMPHASIS_REACHED =
(hw_lane_settings[lane].PRE_EMPHASIS == (hw_lane_settings[lane].PRE_EMPHASIS ==
PRE_EMPHASIS_MAX_LEVEL ? 1 : 0); PRE_EMPHASIS_MAX_LEVEL ? 1 : 0);
} else if (dp_get_link_encoding_format(&lt_settings->link_settings) == } else if (link_dp_get_encoding_format(&lt_settings->link_settings) ==
DP_128b_132b_ENCODING) { DP_128b_132b_ENCODING) {
dpcd_lane_settings[lane].tx_ffe.PRESET_VALUE = dpcd_lane_settings[lane].tx_ffe.PRESET_VALUE =
hw_lane_settings[lane].FFE_PRESET.settings.level; hw_lane_settings[lane].FFE_PRESET.settings.level;
...@@ -365,7 +366,7 @@ void dp_hw_to_dpcd_lane_settings( ...@@ -365,7 +366,7 @@ void dp_hw_to_dpcd_lane_settings(
uint8_t get_dpcd_link_rate(const struct dc_link_settings *link_settings) uint8_t get_dpcd_link_rate(const struct dc_link_settings *link_settings)
{ {
uint8_t link_rate = 0; uint8_t link_rate = 0;
enum dp_link_encoding encoding = dp_get_link_encoding_format(link_settings); enum dp_link_encoding encoding = link_dp_get_encoding_format(link_settings);
if (encoding == DP_128b_132b_ENCODING) if (encoding == DP_128b_132b_ENCODING)
switch (link_settings->link_rate) { switch (link_settings->link_rate) {
...@@ -736,7 +737,7 @@ void override_training_settings( ...@@ -736,7 +737,7 @@ void override_training_settings(
enum dc_dp_training_pattern decide_cr_training_pattern( enum dc_dp_training_pattern decide_cr_training_pattern(
const struct dc_link_settings *link_settings) const struct dc_link_settings *link_settings)
{ {
switch (dp_get_link_encoding_format(link_settings)) { switch (link_dp_get_encoding_format(link_settings)) {
case DP_8b_10b_ENCODING: case DP_8b_10b_ENCODING:
default: default:
return DP_TRAINING_PATTERN_SEQUENCE_1; return DP_TRAINING_PATTERN_SEQUENCE_1;
...@@ -757,7 +758,7 @@ enum dc_dp_training_pattern decide_eq_training_pattern(struct dc_link *link, ...@@ -757,7 +758,7 @@ enum dc_dp_training_pattern decide_eq_training_pattern(struct dc_link *link,
ASSERT(link_enc); ASSERT(link_enc);
enc_caps = &link_enc->features; enc_caps = &link_enc->features;
switch (dp_get_link_encoding_format(link_settings)) { switch (link_dp_get_encoding_format(link_settings)) {
case DP_8b_10b_ENCODING: case DP_8b_10b_ENCODING:
if (enc_caps->flags.bits.IS_TPS4_CAPABLE && if (enc_caps->flags.bits.IS_TPS4_CAPABLE &&
rx_caps->max_down_spread.bits.TPS4_SUPPORTED) rx_caps->max_down_spread.bits.TPS4_SUPPORTED)
...@@ -781,7 +782,7 @@ enum dc_dp_training_pattern decide_eq_training_pattern(struct dc_link *link, ...@@ -781,7 +782,7 @@ enum dc_dp_training_pattern decide_eq_training_pattern(struct dc_link *link,
enum lttpr_mode dc_link_decide_lttpr_mode(struct dc_link *link, enum lttpr_mode dc_link_decide_lttpr_mode(struct dc_link *link,
struct dc_link_settings *link_setting) struct dc_link_settings *link_setting)
{ {
enum dp_link_encoding encoding = dp_get_link_encoding_format(link_setting); enum dp_link_encoding encoding = link_dp_get_encoding_format(link_setting);
if (encoding == DP_8b_10b_ENCODING) if (encoding == DP_8b_10b_ENCODING)
return dp_decide_8b_10b_lttpr_mode(link); return dp_decide_8b_10b_lttpr_mode(link);
...@@ -801,7 +802,7 @@ void dp_decide_lane_settings( ...@@ -801,7 +802,7 @@ void dp_decide_lane_settings(
uint32_t lane; uint32_t lane;
for (lane = 0; lane < LANE_COUNT_DP_MAX; lane++) { for (lane = 0; lane < LANE_COUNT_DP_MAX; lane++) {
if (dp_get_link_encoding_format(&lt_settings->link_settings) == if (link_dp_get_encoding_format(&lt_settings->link_settings) ==
DP_8b_10b_ENCODING) { DP_8b_10b_ENCODING) {
hw_lane_settings[lane].VOLTAGE_SWING = hw_lane_settings[lane].VOLTAGE_SWING =
(enum dc_voltage_swing)(ln_adjust[lane].bits. (enum dc_voltage_swing)(ln_adjust[lane].bits.
...@@ -809,7 +810,7 @@ void dp_decide_lane_settings( ...@@ -809,7 +810,7 @@ void dp_decide_lane_settings(
hw_lane_settings[lane].PRE_EMPHASIS = hw_lane_settings[lane].PRE_EMPHASIS =
(enum dc_pre_emphasis)(ln_adjust[lane].bits. (enum dc_pre_emphasis)(ln_adjust[lane].bits.
PRE_EMPHASIS_LANE); PRE_EMPHASIS_LANE);
} else if (dp_get_link_encoding_format(&lt_settings->link_settings) == } else if (link_dp_get_encoding_format(&lt_settings->link_settings) ==
DP_128b_132b_ENCODING) { DP_128b_132b_ENCODING) {
hw_lane_settings[lane].FFE_PRESET.raw = hw_lane_settings[lane].FFE_PRESET.raw =
ln_adjust[lane].tx_ffe.PRESET_VALUE; ln_adjust[lane].tx_ffe.PRESET_VALUE;
...@@ -834,9 +835,9 @@ void dp_decide_training_settings( ...@@ -834,9 +835,9 @@ void dp_decide_training_settings(
const struct dc_link_settings *link_settings, const struct dc_link_settings *link_settings,
struct link_training_settings *lt_settings) struct link_training_settings *lt_settings)
{ {
if (dp_get_link_encoding_format(link_settings) == DP_8b_10b_ENCODING) if (link_dp_get_encoding_format(link_settings) == DP_8b_10b_ENCODING)
decide_8b_10b_training_settings(link, link_settings, lt_settings); decide_8b_10b_training_settings(link, link_settings, lt_settings);
else if (dp_get_link_encoding_format(link_settings) == DP_128b_132b_ENCODING) else if (link_dp_get_encoding_format(link_settings) == DP_128b_132b_ENCODING)
decide_128b_132b_training_settings(link, link_settings, lt_settings); decide_128b_132b_training_settings(link, link_settings, lt_settings);
} }
...@@ -864,7 +865,7 @@ static enum dc_status configure_lttpr_mode_non_transparent( ...@@ -864,7 +865,7 @@ static enum dc_status configure_lttpr_mode_non_transparent(
enum dc_status result = DC_ERROR_UNEXPECTED; enum dc_status result = DC_ERROR_UNEXPECTED;
uint8_t repeater_mode = DP_PHY_REPEATER_MODE_TRANSPARENT; uint8_t repeater_mode = DP_PHY_REPEATER_MODE_TRANSPARENT;
enum dp_link_encoding encoding = dp_get_link_encoding_format(&lt_settings->link_settings); enum dp_link_encoding encoding = link_dp_get_encoding_format(&lt_settings->link_settings);
if (encoding == DP_8b_10b_ENCODING) { if (encoding == DP_8b_10b_ENCODING) {
DC_LOG_HW_LINK_TRAINING("%s\n Set LTTPR to Transparent Mode\n", __func__); DC_LOG_HW_LINK_TRAINING("%s\n Set LTTPR to Transparent Mode\n", __func__);
...@@ -894,7 +895,7 @@ static enum dc_status configure_lttpr_mode_non_transparent( ...@@ -894,7 +895,7 @@ static enum dc_status configure_lttpr_mode_non_transparent(
} }
if (encoding == DP_8b_10b_ENCODING) { if (encoding == DP_8b_10b_ENCODING) {
repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt); repeater_cnt = dp_parse_lttpr_repeater_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
/* Driver does not need to train the first hop. Skip DPCD read and clear /* Driver does not need to train the first hop. Skip DPCD read and clear
* AUX_RD_INTERVAL for DPTX-to-DPIA hop. * AUX_RD_INTERVAL for DPTX-to-DPIA hop.
...@@ -977,7 +978,7 @@ enum dc_status dpcd_configure_channel_coding(struct dc_link *link, ...@@ -977,7 +978,7 @@ enum dc_status dpcd_configure_channel_coding(struct dc_link *link,
struct link_training_settings *lt_settings) struct link_training_settings *lt_settings)
{ {
enum dp_link_encoding encoding = enum dp_link_encoding encoding =
dp_get_link_encoding_format( link_dp_get_encoding_format(
&lt_settings->link_settings); &lt_settings->link_settings);
enum dc_status status; enum dc_status status;
...@@ -1190,7 +1191,7 @@ void dpcd_set_lt_pattern_and_lane_settings( ...@@ -1190,7 +1191,7 @@ void dpcd_set_lt_pattern_and_lane_settings(
size_in_bytes); size_in_bytes);
if (is_repeater(lt_settings, offset)) { if (is_repeater(lt_settings, offset)) {
if (dp_get_link_encoding_format(&lt_settings->link_settings) == if (link_dp_get_encoding_format(&lt_settings->link_settings) ==
DP_128b_132b_ENCODING) DP_128b_132b_ENCODING)
DC_LOG_HW_LINK_TRAINING("%s:\n LTTPR Repeater ID: %d\n" DC_LOG_HW_LINK_TRAINING("%s:\n LTTPR Repeater ID: %d\n"
" 0x%X TX_FFE_PRESET_VALUE = %x\n", " 0x%X TX_FFE_PRESET_VALUE = %x\n",
...@@ -1198,7 +1199,7 @@ void dpcd_set_lt_pattern_and_lane_settings( ...@@ -1198,7 +1199,7 @@ void dpcd_set_lt_pattern_and_lane_settings(
offset, offset,
dpcd_base_lt_offset, dpcd_base_lt_offset,
lt_settings->dpcd_lane_settings[0].tx_ffe.PRESET_VALUE); lt_settings->dpcd_lane_settings[0].tx_ffe.PRESET_VALUE);
else if (dp_get_link_encoding_format(&lt_settings->link_settings) == else if (link_dp_get_encoding_format(&lt_settings->link_settings) ==
DP_8b_10b_ENCODING) DP_8b_10b_ENCODING)
DC_LOG_HW_LINK_TRAINING("%s:\n LTTPR Repeater ID: %d\n" DC_LOG_HW_LINK_TRAINING("%s:\n LTTPR Repeater ID: %d\n"
" 0x%X VS set = %x PE set = %x max VS Reached = %x max PE Reached = %x\n", " 0x%X VS set = %x PE set = %x max VS Reached = %x max PE Reached = %x\n",
...@@ -1210,13 +1211,13 @@ void dpcd_set_lt_pattern_and_lane_settings( ...@@ -1210,13 +1211,13 @@ void dpcd_set_lt_pattern_and_lane_settings(
lt_settings->dpcd_lane_settings[0].bits.MAX_SWING_REACHED, lt_settings->dpcd_lane_settings[0].bits.MAX_SWING_REACHED,
lt_settings->dpcd_lane_settings[0].bits.MAX_PRE_EMPHASIS_REACHED); lt_settings->dpcd_lane_settings[0].bits.MAX_PRE_EMPHASIS_REACHED);
} else { } else {
if (dp_get_link_encoding_format(&lt_settings->link_settings) == if (link_dp_get_encoding_format(&lt_settings->link_settings) ==
DP_128b_132b_ENCODING) DP_128b_132b_ENCODING)
DC_LOG_HW_LINK_TRAINING("%s:\n 0x%X TX_FFE_PRESET_VALUE = %x\n", DC_LOG_HW_LINK_TRAINING("%s:\n 0x%X TX_FFE_PRESET_VALUE = %x\n",
__func__, __func__,
dpcd_base_lt_offset, dpcd_base_lt_offset,
lt_settings->dpcd_lane_settings[0].tx_ffe.PRESET_VALUE); lt_settings->dpcd_lane_settings[0].tx_ffe.PRESET_VALUE);
else if (dp_get_link_encoding_format(&lt_settings->link_settings) == else if (link_dp_get_encoding_format(&lt_settings->link_settings) ==
DP_8b_10b_ENCODING) DP_8b_10b_ENCODING)
DC_LOG_HW_LINK_TRAINING("%s:\n 0x%X VS set = %x PE set = %x max VS Reached = %x max PE Reached = %x\n", DC_LOG_HW_LINK_TRAINING("%s:\n 0x%X VS set = %x PE set = %x max VS Reached = %x max PE Reached = %x\n",
__func__, __func__,
...@@ -1242,7 +1243,7 @@ void dpcd_set_lt_pattern_and_lane_settings( ...@@ -1242,7 +1243,7 @@ void dpcd_set_lt_pattern_and_lane_settings(
(uint8_t *)(lt_settings->dpcd_lane_settings), (uint8_t *)(lt_settings->dpcd_lane_settings),
size_in_bytes); size_in_bytes);
} else if (dp_get_link_encoding_format(&lt_settings->link_settings) == } else if (link_dp_get_encoding_format(&lt_settings->link_settings) ==
DP_128b_132b_ENCODING) { DP_128b_132b_ENCODING) {
core_link_write_dpcd( core_link_write_dpcd(
link, link,
...@@ -1467,7 +1468,7 @@ enum link_training_result dp_perform_link_training( ...@@ -1467,7 +1468,7 @@ enum link_training_result dp_perform_link_training(
enum link_training_result status = LINK_TRAINING_SUCCESS; enum link_training_result status = LINK_TRAINING_SUCCESS;
struct link_training_settings lt_settings = {0}; struct link_training_settings lt_settings = {0};
enum dp_link_encoding encoding = enum dp_link_encoding encoding =
dp_get_link_encoding_format(link_settings); link_dp_get_encoding_format(link_settings);
/* decide training settings */ /* decide training settings */
dp_decide_training_settings( dp_decide_training_settings(
...@@ -1544,7 +1545,7 @@ bool perform_link_training_with_retries( ...@@ -1544,7 +1545,7 @@ bool perform_link_training_with_retries(
dp_trace_commit_lt_init(link); dp_trace_commit_lt_init(link);
if (dp_get_link_encoding_format(&cur_link_settings) == DP_8b_10b_ENCODING) if (link_dp_get_encoding_format(&cur_link_settings) == DP_8b_10b_ENCODING)
/* We need to do this before the link training to ensure the idle /* We need to do this before the link training to ensure the idle
* pattern in SST mode will be sent right after the link training * pattern in SST mode will be sent right after the link training
*/ */
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "link_dp_training_8b_10b.h" #include "link_dp_training_8b_10b.h"
#include "link_dpcd.h" #include "link_dpcd.h"
#include "link_dp_phy.h" #include "link_dp_phy.h"
#include "link_dp_capability.h"
#include "dc_link_dp.h" #include "dc_link_dp.h"
#define DC_LOGGER \ #define DC_LOGGER \
...@@ -238,7 +239,7 @@ void decide_128b_132b_training_settings(struct dc_link *link, ...@@ -238,7 +239,7 @@ void decide_128b_132b_training_settings(struct dc_link *link,
lt_settings->eq_loop_count_limit = 20; lt_settings->eq_loop_count_limit = 20;
lt_settings->pattern_for_cds = DP_128b_132b_TPS2_CDS; lt_settings->pattern_for_cds = DP_128b_132b_TPS2_CDS;
lt_settings->cds_pattern_time = 2500; lt_settings->cds_pattern_time = 2500;
lt_settings->cds_wait_time_limit = (dp_convert_to_count( lt_settings->cds_wait_time_limit = (dp_parse_lttpr_repeater_count(
link->dpcd_caps.lttpr_caps.phy_repeater_cnt) + 1) * 20000; link->dpcd_caps.lttpr_caps.phy_repeater_cnt) + 1) * 20000;
lt_settings->disallow_per_lane_settings = true; lt_settings->disallow_per_lane_settings = true;
lt_settings->lttpr_mode = dp_decide_128b_132b_lttpr_mode(link); lt_settings->lttpr_mode = dp_decide_128b_132b_lttpr_mode(link);
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "link_dp_training_8b_10b.h" #include "link_dp_training_8b_10b.h"
#include "link_dpcd.h" #include "link_dpcd.h"
#include "link_dp_phy.h" #include "link_dp_phy.h"
#include "link_dp_capability.h"
#include "dc_link_dp.h" #include "dc_link_dp.h"
#define DC_LOGGER \ #define DC_LOGGER \
...@@ -42,7 +43,7 @@ static int32_t get_cr_training_aux_rd_interval(struct dc_link *link, ...@@ -42,7 +43,7 @@ static int32_t get_cr_training_aux_rd_interval(struct dc_link *link,
uint32_t wait_in_micro_secs = 100; uint32_t wait_in_micro_secs = 100;
memset(&training_rd_interval, 0, sizeof(training_rd_interval)); memset(&training_rd_interval, 0, sizeof(training_rd_interval));
if (dp_get_link_encoding_format(link_settings) == DP_8b_10b_ENCODING && if (link_dp_get_encoding_format(link_settings) == DP_8b_10b_ENCODING &&
link->dpcd_caps.dpcd_rev.raw >= DPCD_REV_12) { link->dpcd_caps.dpcd_rev.raw >= DPCD_REV_12) {
core_link_read_dpcd( core_link_read_dpcd(
link, link,
...@@ -62,13 +63,13 @@ static uint32_t get_eq_training_aux_rd_interval( ...@@ -62,13 +63,13 @@ static uint32_t get_eq_training_aux_rd_interval(
union training_aux_rd_interval training_rd_interval; union training_aux_rd_interval training_rd_interval;
memset(&training_rd_interval, 0, sizeof(training_rd_interval)); memset(&training_rd_interval, 0, sizeof(training_rd_interval));
if (dp_get_link_encoding_format(link_settings) == DP_128b_132b_ENCODING) { if (link_dp_get_encoding_format(link_settings) == DP_128b_132b_ENCODING) {
core_link_read_dpcd( core_link_read_dpcd(
link, link,
DP_128B132B_TRAINING_AUX_RD_INTERVAL, DP_128B132B_TRAINING_AUX_RD_INTERVAL,
(uint8_t *)&training_rd_interval, (uint8_t *)&training_rd_interval,
sizeof(training_rd_interval)); sizeof(training_rd_interval));
} else if (dp_get_link_encoding_format(link_settings) == DP_8b_10b_ENCODING && } else if (link_dp_get_encoding_format(link_settings) == DP_8b_10b_ENCODING &&
link->dpcd_caps.dpcd_rev.raw >= DPCD_REV_12) { link->dpcd_caps.dpcd_rev.raw >= DPCD_REV_12) {
core_link_read_dpcd( core_link_read_dpcd(
link, link,
...@@ -229,7 +230,7 @@ enum link_training_result perform_8b_10b_clock_recovery_sequence( ...@@ -229,7 +230,7 @@ enum link_training_result perform_8b_10b_clock_recovery_sequence(
return LINK_TRAINING_SUCCESS; return LINK_TRAINING_SUCCESS;
/* 6. max VS reached*/ /* 6. max VS reached*/
if ((dp_get_link_encoding_format(&lt_settings->link_settings) == if ((link_dp_get_encoding_format(&lt_settings->link_settings) ==
DP_8b_10b_ENCODING) && DP_8b_10b_ENCODING) &&
dp_is_max_vs_reached(lt_settings)) dp_is_max_vs_reached(lt_settings))
break; break;
...@@ -237,11 +238,11 @@ enum link_training_result perform_8b_10b_clock_recovery_sequence( ...@@ -237,11 +238,11 @@ enum link_training_result perform_8b_10b_clock_recovery_sequence(
/* 7. same lane settings*/ /* 7. same lane settings*/
/* Note: settings are the same for all lanes, /* Note: settings are the same for all lanes,
* so comparing first lane is sufficient*/ * so comparing first lane is sufficient*/
if ((dp_get_link_encoding_format(&lt_settings->link_settings) == DP_8b_10b_ENCODING) && if ((link_dp_get_encoding_format(&lt_settings->link_settings) == DP_8b_10b_ENCODING) &&
lt_settings->dpcd_lane_settings[0].bits.VOLTAGE_SWING_SET == lt_settings->dpcd_lane_settings[0].bits.VOLTAGE_SWING_SET ==
dpcd_lane_adjust[0].bits.VOLTAGE_SWING_LANE) dpcd_lane_adjust[0].bits.VOLTAGE_SWING_LANE)
retries_cr++; retries_cr++;
else if ((dp_get_link_encoding_format(&lt_settings->link_settings) == DP_128b_132b_ENCODING) && else if ((link_dp_get_encoding_format(&lt_settings->link_settings) == DP_128b_132b_ENCODING) &&
lt_settings->dpcd_lane_settings[0].tx_ffe.PRESET_VALUE == lt_settings->dpcd_lane_settings[0].tx_ffe.PRESET_VALUE ==
dpcd_lane_adjust[0].tx_ffe.PRESET_VALUE) dpcd_lane_adjust[0].tx_ffe.PRESET_VALUE)
retries_cr++; retries_cr++;
...@@ -282,7 +283,7 @@ enum link_training_result perform_8b_10b_channel_equalization_sequence( ...@@ -282,7 +283,7 @@ enum link_training_result perform_8b_10b_channel_equalization_sequence(
/* Note: also check that TPS4 is a supported feature*/ /* Note: also check that TPS4 is a supported feature*/
tr_pattern = lt_settings->pattern_for_eq; tr_pattern = lt_settings->pattern_for_eq;
if (is_repeater(lt_settings, offset) && dp_get_link_encoding_format(&lt_settings->link_settings) == DP_8b_10b_ENCODING) if (is_repeater(lt_settings, offset) && link_dp_get_encoding_format(&lt_settings->link_settings) == DP_8b_10b_ENCODING)
tr_pattern = DP_TRAINING_PATTERN_SEQUENCE_4; tr_pattern = DP_TRAINING_PATTERN_SEQUENCE_4;
dp_set_hw_training_pattern(link, link_res, tr_pattern, offset); dp_set_hw_training_pattern(link, link_res, tr_pattern, offset);
...@@ -371,7 +372,7 @@ enum link_training_result dp_perform_8b_10b_link_training( ...@@ -371,7 +372,7 @@ enum link_training_result dp_perform_8b_10b_link_training(
/* 2. perform link training (set link training done /* 2. perform link training (set link training done
* to false is done as well) * to false is done as well)
*/ */
repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt); repeater_cnt = dp_parse_lttpr_repeater_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
for (repeater_id = repeater_cnt; (repeater_id > 0 && status == LINK_TRAINING_SUCCESS); for (repeater_id = repeater_cnt; (repeater_id > 0 && status == LINK_TRAINING_SUCCESS);
repeater_id--) { repeater_id--) {
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "dmub/inc/dmub_cmd.h" #include "dmub/inc/dmub_cmd.h"
#include "link_dpcd.h" #include "link_dpcd.h"
#include "link_dp_training_8b_10b.h" #include "link_dp_training_8b_10b.h"
#include "link_dp_capability.h"
#include "dc_dmub_srv.h" #include "dc_dmub_srv.h"
#define DC_LOGGER \ #define DC_LOGGER \
link->ctx->logger link->ctx->logger
...@@ -300,7 +301,7 @@ static enum link_training_result dpia_training_cr_non_transparent( ...@@ -300,7 +301,7 @@ static enum link_training_result dpia_training_cr_non_transparent(
uint8_t set_cfg_data; uint8_t set_cfg_data;
enum dpia_set_config_ts ts; enum dpia_set_config_ts ts;
repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt); repeater_cnt = dp_parse_lttpr_repeater_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
/* Cap of LINK_TRAINING_MAX_CR_RETRY attempts at clock recovery. /* Cap of LINK_TRAINING_MAX_CR_RETRY attempts at clock recovery.
* Fix inherited from perform_clock_recovery_sequence() - * Fix inherited from perform_clock_recovery_sequence() -
...@@ -631,7 +632,7 @@ static enum link_training_result dpia_training_eq_non_transparent( ...@@ -631,7 +632,7 @@ static enum link_training_result dpia_training_eq_non_transparent(
else else
tr_pattern = DP_TRAINING_PATTERN_SEQUENCE_4; tr_pattern = DP_TRAINING_PATTERN_SEQUENCE_4;
repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt); repeater_cnt = dp_parse_lttpr_repeater_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
for (retries_eq = 0; retries_eq < LINK_TRAINING_MAX_RETRY_COUNT; retries_eq++) { for (retries_eq = 0; retries_eq < LINK_TRAINING_MAX_RETRY_COUNT; retries_eq++) {
...@@ -900,7 +901,7 @@ static enum link_training_result dpia_training_end( ...@@ -900,7 +901,7 @@ static enum link_training_result dpia_training_end(
if (lt_settings->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT) { if (lt_settings->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT) {
repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt); repeater_cnt = dp_parse_lttpr_repeater_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
if (hop == repeater_cnt) { /* DPTX-to-DPIA */ if (hop == repeater_cnt) { /* DPTX-to-DPIA */
/* Send SET_CONFIG(SET_TRAINING:0xff) to notify DPOA that /* Send SET_CONFIG(SET_TRAINING:0xff) to notify DPOA that
...@@ -1004,7 +1005,7 @@ enum link_training_result dc_link_dpia_perform_link_training( ...@@ -1004,7 +1005,7 @@ enum link_training_result dc_link_dpia_perform_link_training(
return result; return result;
if (lt_settings.lttpr_mode == LTTPR_MODE_NON_TRANSPARENT) if (lt_settings.lttpr_mode == LTTPR_MODE_NON_TRANSPARENT)
repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt); repeater_cnt = dp_parse_lttpr_repeater_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
/* Train each hop in turn starting with the one closest to DPTX. /* Train each hop in turn starting with the one closest to DPTX.
* In transparent or non-LTTPR mode, train only the final hop (DPRX). * In transparent or non-LTTPR mode, train only the final hop (DPRX).
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "link_dp_training_8b_10b.h" #include "link_dp_training_8b_10b.h"
#include "link_dpcd.h" #include "link_dpcd.h"
#include "link_dp_phy.h" #include "link_dp_phy.h"
#include "link_dp_capability.h"
#include "dc_link_dp.h" #include "dc_link_dp.h"
#define DC_LOGGER \ #define DC_LOGGER \
...@@ -46,7 +47,7 @@ void dp_fixed_vs_pe_read_lane_adjust( ...@@ -46,7 +47,7 @@ void dp_fixed_vs_pe_read_lane_adjust(
{ {
const uint8_t vendor_lttpr_write_data_vs[3] = {0x0, 0x53, 0x63}; const uint8_t vendor_lttpr_write_data_vs[3] = {0x0, 0x53, 0x63};
const uint8_t vendor_lttpr_write_data_pe[3] = {0x0, 0x54, 0x63}; const uint8_t vendor_lttpr_write_data_pe[3] = {0x0, 0x54, 0x63};
const uint8_t offset = dp_convert_to_count( const uint8_t offset = dp_parse_lttpr_repeater_count(
link->dpcd_caps.lttpr_caps.phy_repeater_cnt); link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
uint32_t vendor_lttpr_write_address = 0xF004F; uint32_t vendor_lttpr_write_address = 0xF004F;
uint32_t vendor_lttpr_read_address = 0xF0053; uint32_t vendor_lttpr_read_address = 0xF0053;
...@@ -95,7 +96,7 @@ void dp_fixed_vs_pe_set_retimer_lane_settings( ...@@ -95,7 +96,7 @@ void dp_fixed_vs_pe_set_retimer_lane_settings(
const union dpcd_training_lane dpcd_lane_adjust[LANE_COUNT_DP_MAX], const union dpcd_training_lane dpcd_lane_adjust[LANE_COUNT_DP_MAX],
uint8_t lane_count) uint8_t lane_count)
{ {
const uint8_t offset = dp_convert_to_count( const uint8_t offset = dp_parse_lttpr_repeater_count(
link->dpcd_caps.lttpr_caps.phy_repeater_cnt); link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
const uint8_t vendor_lttpr_write_data_reset[4] = {0x1, 0x50, 0x63, 0xFF}; const uint8_t vendor_lttpr_write_data_reset[4] = {0x1, 0x50, 0x63, 0xFF};
uint32_t vendor_lttpr_write_address = 0xF004F; uint32_t vendor_lttpr_write_address = 0xF004F;
...@@ -180,7 +181,7 @@ static enum link_training_result perform_fixed_vs_pe_nontransparent_training_seq ...@@ -180,7 +181,7 @@ static enum link_training_result perform_fixed_vs_pe_nontransparent_training_seq
/* 2. perform link training (set link training done /* 2. perform link training (set link training done
* to false is done as well) * to false is done as well)
*/ */
repeater_cnt = dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt); repeater_cnt = dp_parse_lttpr_repeater_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
for (repeater_id = repeater_cnt; (repeater_id > 0 && status == LINK_TRAINING_SUCCESS); for (repeater_id = repeater_cnt; (repeater_id > 0 && status == LINK_TRAINING_SUCCESS);
repeater_id--) { repeater_id--) {
...@@ -229,7 +230,7 @@ enum link_training_result dp_perform_fixed_vs_pe_training_sequence( ...@@ -229,7 +230,7 @@ enum link_training_result dp_perform_fixed_vs_pe_training_sequence(
struct link_training_settings *lt_settings) struct link_training_settings *lt_settings)
{ {
const uint8_t vendor_lttpr_write_data_reset[4] = {0x1, 0x50, 0x63, 0xFF}; const uint8_t vendor_lttpr_write_data_reset[4] = {0x1, 0x50, 0x63, 0xFF};
const uint8_t offset = dp_convert_to_count( const uint8_t offset = dp_parse_lttpr_repeater_count(
link->dpcd_caps.lttpr_caps.phy_repeater_cnt); link->dpcd_caps.lttpr_caps.phy_repeater_cnt);
const uint8_t vendor_lttpr_write_data_intercept_en[4] = {0x1, 0x55, 0x63, 0x0}; const uint8_t vendor_lttpr_write_data_intercept_en[4] = {0x1, 0x55, 0x63, 0x0};
const uint8_t vendor_lttpr_write_data_intercept_dis[4] = {0x1, 0x55, 0x63, 0x68}; const uint8_t vendor_lttpr_write_data_intercept_dis[4] = {0x1, 0x55, 0x63, 0x68};
...@@ -245,7 +246,7 @@ enum link_training_result dp_perform_fixed_vs_pe_training_sequence( ...@@ -245,7 +246,7 @@ enum link_training_result dp_perform_fixed_vs_pe_training_sequence(
uint8_t rate; uint8_t rate;
/* Only 8b/10b is supported */ /* Only 8b/10b is supported */
ASSERT(dp_get_link_encoding_format(&lt_settings->link_settings) == ASSERT(link_dp_get_encoding_format(&lt_settings->link_settings) ==
DP_8b_10b_ENCODING); DP_8b_10b_ENCODING);
if (lt_settings->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT) { if (lt_settings->lttpr_mode == LTTPR_MODE_NON_TRANSPARENT) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment