Skip to content

Commit c797ede

Browse files
Wenjing Liualexdeucher
authored andcommitted
drm/amd/display: DP link layer test 4.2.1.1 fix due to specs update
[why] DP link layer CTS specs updated to change the test parameters in test 4.2.1.1. Before it requires source to delay 400us on aux no reply. With the specs updates Errata5, it requires source to delay 3.2ms (based on LTTPR aux timeout) This causes our test to fail after updating with the latest test equipment firmware. [how] the change is to allow LTTPR 3.2ms aux timeout delay by default. And set back to 400us if LTTPR feature is not enabled. We will set 3.2ms and always enable LTTPR non transparent mode if LTTPR feature is enabled and LTTPR is present. Signed-off-by: Wenjing Liu <[email protected]> Reviewed-by: Jun Lei <[email protected]> Acked-by: Krunoslav Kovac <[email protected]> Acked-by: Rodrigo Siqueira <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 26b4750 commit c797ede

File tree

9 files changed

+59
-50
lines changed

9 files changed

+59
-50
lines changed

drivers/gpu/drm/amd/display/dc/core/dc_link.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,6 @@ static bool detect_dp(struct dc_link *link,
690690

691691
if (sink_caps->transaction_type == DDC_TRANSACTION_TYPE_I2C_OVER_AUX) {
692692
sink_caps->signal = SIGNAL_TYPE_DISPLAY_PORT;
693-
dpcd_set_source_specific_data(link);
694693
if (!detect_dp_sink_caps(link))
695694
return false;
696695
if (is_mst_supported(link)) {
@@ -855,6 +854,7 @@ static bool dc_link_detect_helper(struct dc_link *link,
855854
bool same_dpcd = true;
856855
enum dc_connection_type new_connection_type = dc_connection_none;
857856
bool perform_dp_seamless_boot = false;
857+
const uint32_t post_oui_delay = 30; // 30ms
858858

859859
DC_LOGGER_INIT(link->ctx->logger);
860860

@@ -867,6 +867,7 @@ static bool dc_link_detect_helper(struct dc_link *link,
867867
// need to re-write OUI and brightness in resume case
868868
if (link->connector_signal == SIGNAL_TYPE_EDP) {
869869
dpcd_set_source_specific_data(link);
870+
msleep(post_oui_delay);
870871
dc_link_set_default_brightness_aux(link);
871872
//TODO: use cached
872873
}
@@ -922,8 +923,6 @@ static bool dc_link_detect_helper(struct dc_link *link,
922923
case SIGNAL_TYPE_EDP: {
923924
read_current_link_settings_on_detect(link);
924925

925-
dpcd_set_source_specific_data(link);
926-
927926
detect_edp_sink_caps(link);
928927
read_current_link_settings_on_detect(link);
929928
sink_caps.transaction_type = DDC_TRANSACTION_TYPE_I2C_OVER_AUX;
@@ -1633,6 +1632,7 @@ static enum dc_status enable_link_dp(struct dc_state *state,
16331632
int i;
16341633
bool apply_seamless_boot_optimization = false;
16351634
uint32_t bl_oled_enable_delay = 50; // in ms
1635+
const uint32_t post_oui_delay = 30; // 30ms
16361636

16371637
// check for seamless boot
16381638
for (i = 0; i < state->stream_count; i++) {
@@ -1659,6 +1659,8 @@ static enum dc_status enable_link_dp(struct dc_state *state,
16591659

16601660
// during mode switch we do DP_SET_POWER off then on, and OUI is lost
16611661
dpcd_set_source_specific_data(link);
1662+
if (link->dpcd_sink_ext_caps.raw != 0)
1663+
msleep(post_oui_delay);
16621664

16631665
skip_video_pattern = true;
16641666

drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -655,16 +655,17 @@ bool dc_link_aux_transfer_with_retries(struct ddc_service *ddc,
655655
}
656656

657657

658-
uint32_t dc_link_aux_configure_timeout(struct ddc_service *ddc,
658+
bool dc_link_aux_try_to_configure_timeout(struct ddc_service *ddc,
659659
uint32_t timeout)
660660
{
661-
uint32_t prev_timeout = 0;
661+
bool result = false;
662662
struct ddc *ddc_pin = ddc->ddc_pin;
663663

664-
if (ddc->ctx->dc->res_pool->engines[ddc_pin->pin_data->en]->funcs->configure_timeout)
665-
prev_timeout =
666-
ddc->ctx->dc->res_pool->engines[ddc_pin->pin_data->en]->funcs->configure_timeout(ddc, timeout);
667-
return prev_timeout;
664+
if (ddc->ctx->dc->res_pool->engines[ddc_pin->pin_data->en]->funcs->configure_timeout) {
665+
ddc->ctx->dc->res_pool->engines[ddc_pin->pin_data->en]->funcs->configure_timeout(ddc, timeout);
666+
result = true;
667+
}
668+
return result;
668669
}
669670

670671
/*test only function*/

drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ static uint8_t dc_dp_initialize_scrambling_data_symbols(
247247

248248
static inline bool is_repeater(struct dc_link *link, uint32_t offset)
249249
{
250-
return (!link->is_lttpr_mode_transparent && offset != 0);
250+
return (link->lttpr_non_transparent_mode && offset != 0);
251251
}
252252

253253
static void dpcd_set_lt_pattern_and_lane_settings(
@@ -1040,7 +1040,7 @@ static enum link_training_result perform_clock_recovery_sequence(
10401040
/* 3. wait receiver to lock-on*/
10411041
wait_time_microsec = lt_settings->cr_pattern_time;
10421042

1043-
if (!link->is_lttpr_mode_transparent)
1043+
if (link->lttpr_non_transparent_mode)
10441044
wait_time_microsec = TRAINING_AUX_RD_INTERVAL;
10451045

10461046
wait_for_training_aux_rd_interval(
@@ -1274,7 +1274,7 @@ static void configure_lttpr_mode(struct dc_link *link)
12741274
link->dpcd_caps.lttpr_caps.mode = repeater_mode;
12751275
}
12761276

1277-
if (!link->is_lttpr_mode_transparent) {
1277+
if (link->lttpr_non_transparent_mode) {
12781278

12791279
DC_LOG_HW_LINK_TRAINING("%s\n Set LTTPR to Non Transparent Mode\n", __func__);
12801280

@@ -1479,7 +1479,7 @@ enum link_training_result dc_link_dp_perform_link_training(
14791479
&lt_settings);
14801480

14811481
/* Configure lttpr mode */
1482-
if (!link->is_lttpr_mode_transparent)
1482+
if (link->lttpr_non_transparent_mode)
14831483
configure_lttpr_mode(link);
14841484

14851485
if (link->ctx->dc->work_arounds.lt_early_cr_pattern)
@@ -1495,7 +1495,7 @@ enum link_training_result dc_link_dp_perform_link_training(
14951495

14961496
dp_set_fec_ready(link, fec_enable);
14971497

1498-
if (!link->is_lttpr_mode_transparent) {
1498+
if (link->lttpr_non_transparent_mode) {
14991499

15001500
/* 2. perform link training (set link training done
15011501
* to false is done as well)
@@ -1762,7 +1762,7 @@ static struct dc_link_settings get_max_link_cap(struct dc_link *link)
17621762
* account for lttpr repeaters cap
17631763
* notes: repeaters do not snoop in the DPRX Capabilities addresses (3.6.3).
17641764
*/
1765-
if (!link->is_lttpr_mode_transparent) {
1765+
if (link->lttpr_non_transparent_mode) {
17661766
if (link->dpcd_caps.lttpr_caps.max_lane_count < max_link_cap.lane_count)
17671767
max_link_cap.lane_count = link->dpcd_caps.lttpr_caps.max_lane_count;
17681768

@@ -1920,7 +1920,7 @@ bool dp_verify_link_cap(
19201920
max_link_cap = get_max_link_cap(link);
19211921

19221922
/* Grant extended timeout request */
1923-
if (!link->is_lttpr_mode_transparent && link->dpcd_caps.lttpr_caps.max_ext_timeout > 0) {
1923+
if (link->lttpr_non_transparent_mode && link->dpcd_caps.lttpr_caps.max_ext_timeout > 0) {
19241924
uint8_t grant = link->dpcd_caps.lttpr_caps.max_ext_timeout & 0x80;
19251925

19261926
core_link_write_dpcd(link, DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT, &grant, sizeof(grant));
@@ -3253,17 +3253,8 @@ static bool retrieve_link_cap(struct dc_link *link)
32533253
uint32_t read_dpcd_retry_cnt = 3;
32543254
int i;
32553255
struct dp_sink_hw_fw_revision dp_hw_fw_revision;
3256-
3257-
/* Set default timeout to 3.2ms and read LTTPR capabilities */
3258-
bool ext_timeout_support = link->dc->caps.extended_aux_timeout_support &&
3259-
!link->dc->config.disable_extended_timeout_support;
3260-
3261-
link->is_lttpr_mode_transparent = true;
3262-
3263-
if (ext_timeout_support) {
3264-
dc_link_aux_configure_timeout(link->ddc,
3265-
LINK_AUX_DEFAULT_EXTENDED_TIMEOUT_PERIOD);
3266-
}
3256+
bool is_lttpr_present = false;
3257+
const uint32_t post_oui_delay = 30; // 30ms
32673258

32683259
memset(dpcd_data, '\0', sizeof(dpcd_data));
32693260
memset(lttpr_dpcd_data, '\0', sizeof(lttpr_dpcd_data));
@@ -3272,6 +3263,13 @@ static bool retrieve_link_cap(struct dc_link *link)
32723263
memset(&edp_config_cap, '\0',
32733264
sizeof(union edp_configuration_cap));
32743265

3266+
/* if extended timeout is supported in hardware,
3267+
* default to LTTPR timeout (3.2ms) first as a W/A for DP link layer
3268+
* CTS 4.2.1.1 regression introduced by CTS specs requirement update.
3269+
*/
3270+
dc_link_aux_try_to_configure_timeout(link->ddc,
3271+
LINK_AUX_DEFAULT_LTTPR_TIMEOUT_PERIOD);
3272+
32753273
status = core_link_read_dpcd(link, DP_SET_POWER,
32763274
&dpcd_power_state, sizeof(dpcd_power_state));
32773275

@@ -3283,6 +3281,12 @@ static bool retrieve_link_cap(struct dc_link *link)
32833281
if (status != DC_OK || dpcd_power_state == DP_SET_POWER_D3)
32843282
udelay(1000);
32853283

3284+
dpcd_set_source_specific_data(link);
3285+
/* Sink may need to configure internals based on vendor, so allow some
3286+
* time before proceeding with possibly vendor specific transactions
3287+
*/
3288+
msleep(post_oui_delay);
3289+
32863290
for (i = 0; i < read_dpcd_retry_cnt; i++) {
32873291
status = core_link_read_dpcd(
32883292
link,
@@ -3298,8 +3302,14 @@ static bool retrieve_link_cap(struct dc_link *link)
32983302
return false;
32993303
}
33003304

3301-
if (ext_timeout_support) {
3302-
3305+
if (link->dc->caps.extended_aux_timeout_support &&
3306+
link->dc->config.allow_lttpr_non_transparent_mode) {
3307+
/* By reading LTTPR capability, RX assumes that we will enable
3308+
* LTTPR non transparent if LTTPR is present.
3309+
* Therefore, only query LTTPR capability when both LTTPR
3310+
* extended aux timeout and
3311+
* non transparent mode is supported by hardware
3312+
*/
33033313
status = core_link_read_dpcd(
33043314
link,
33053315
DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV,
@@ -3330,20 +3340,21 @@ static bool retrieve_link_cap(struct dc_link *link)
33303340
lttpr_dpcd_data[DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT -
33313341
DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV];
33323342

3333-
if (link->dpcd_caps.lttpr_caps.phy_repeater_cnt > 0 &&
3343+
is_lttpr_present = (link->dpcd_caps.lttpr_caps.phy_repeater_cnt > 0 &&
33343344
link->dpcd_caps.lttpr_caps.max_lane_count > 0 &&
33353345
link->dpcd_caps.lttpr_caps.max_lane_count <= 4 &&
3336-
link->dpcd_caps.lttpr_caps.revision.raw >= 0x14) {
3337-
link->is_lttpr_mode_transparent = false;
3338-
} else {
3339-
/*No lttpr reset timeout to its default value*/
3340-
link->is_lttpr_mode_transparent = true;
3341-
dc_link_aux_configure_timeout(link->ddc, LINK_AUX_DEFAULT_TIMEOUT_PERIOD);
3342-
}
3343-
3344-
CONN_DATA_DETECT(link, lttpr_dpcd_data, sizeof(lttpr_dpcd_data), "LTTPR Caps: ");
3346+
link->dpcd_caps.lttpr_caps.revision.raw >= 0x14);
3347+
if (is_lttpr_present)
3348+
CONN_DATA_DETECT(link, lttpr_dpcd_data, sizeof(lttpr_dpcd_data), "LTTPR Caps: ");
33453349
}
33463350

3351+
/* decide lttpr non transparent mode */
3352+
link->lttpr_non_transparent_mode = is_lttpr_present;
3353+
3354+
if (!is_lttpr_present)
3355+
dc_link_aux_try_to_configure_timeout(link->ddc, LINK_AUX_DEFAULT_TIMEOUT_PERIOD);
3356+
3357+
33473358
{
33483359
union training_aux_rd_interval aux_rd_interval;
33493360

@@ -4282,7 +4293,6 @@ void dp_set_fec_enable(struct dc_link *link, bool enable)
42824293

42834294
void dpcd_set_source_specific_data(struct dc_link *link)
42844295
{
4285-
const uint32_t post_oui_delay = 30; // 30ms
42864296
uint8_t dspc = 0;
42874297
enum dc_status ret;
42884298

@@ -4323,10 +4333,6 @@ void dpcd_set_source_specific_data(struct dc_link *link)
43234333
link->dc->vendor_signature.data.raw,
43244334
sizeof(link->dc->vendor_signature.data.raw));
43254335
}
4326-
4327-
// Sink may need to configure internals based on vendor, so allow some
4328-
// time before proceeding with possibly vendor specific transactions
4329-
msleep(post_oui_delay);
43304336
}
43314337

43324338
bool dc_link_set_backlight_level_nits(struct dc_link *link,

drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void dp_set_hw_lane_settings(
283283
{
284284
struct link_encoder *encoder = link->link_enc;
285285

286-
if (!link->is_lttpr_mode_transparent && !is_immediate_downstream(link, offset))
286+
if (link->lttpr_non_transparent_mode && !is_immediate_downstream(link, offset))
287287
return;
288288

289289
/* call Encoder to set lane settings */

drivers/gpu/drm/amd/display/dc/dc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ struct dc_config {
283283
bool edp_not_connected;
284284
bool force_enum_edp;
285285
bool forced_clocks;
286-
bool disable_extended_timeout_support; // Used to disable extended timeout and lttpr feature as well
286+
bool allow_lttpr_non_transparent_mode;
287287
bool multi_mon_pp_mclk_switch;
288288
bool disable_dmcu;
289289
bool enable_4to1MPC;

drivers/gpu/drm/amd/display/dc/dc_link.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ struct dc_link {
100100
bool link_state_valid;
101101
bool aux_access_disabled;
102102
bool sync_lt_in_progress;
103-
bool is_lttpr_mode_transparent;
103+
bool lttpr_non_transparent_mode;
104104

105105
/* caps is the same as reported_link_cap. link_traing use
106106
* reported_link_cap. Will clean up. TODO

drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,7 @@ static bool dcn21_resource_construct(
18061806
dc->caps.max_slave_planes = 1;
18071807
dc->caps.post_blend_color_processing = true;
18081808
dc->caps.force_dp_tps4_for_cp2520 = true;
1809-
dc->caps.extended_aux_timeout_support = false;
1809+
dc->caps.extended_aux_timeout_support = true;
18101810
dc->caps.dmcub_support = true;
18111811
dc->caps.is_apu = true;
18121812

drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ int dc_link_aux_transfer_raw(struct ddc_service *ddc,
105105
bool dc_link_aux_transfer_with_retries(struct ddc_service *ddc,
106106
struct aux_payload *payload);
107107

108-
uint32_t dc_link_aux_configure_timeout(struct ddc_service *ddc,
108+
bool dc_link_aux_try_to_configure_timeout(struct ddc_service *ddc,
109109
uint32_t timeout);
110110

111111
void dal_ddc_service_write_scdc_data(

drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
#define LINK_TRAINING_ATTEMPTS 4
3030
#define LINK_TRAINING_RETRY_DELAY 50 /* ms */
31-
#define LINK_AUX_DEFAULT_EXTENDED_TIMEOUT_PERIOD 3200 /*us*/
31+
#define LINK_AUX_DEFAULT_LTTPR_TIMEOUT_PERIOD 3200 /*us*/
3232
#define LINK_AUX_DEFAULT_TIMEOUT_PERIOD 552 /*us*/
3333

3434
struct dc_link;

0 commit comments

Comments
 (0)