@@ -986,7 +986,7 @@ static bool dc_link_detect_helper(struct dc_link *link,
986
986
* empty which leads to allocate_mst_payload() has "0"
987
987
* pbn_per_slot value leading to exception on dc_fixpt_div()
988
988
*/
989
- dp_verify_mst_link_cap (link );
989
+ dp_verify_mst_link_cap (link , NULL );
990
990
991
991
/*
992
992
* This call will initiate MST topology discovery. Which
@@ -1150,6 +1150,7 @@ static bool dc_link_detect_helper(struct dc_link *link,
1150
1150
// verify link cap for SST non-seamless boot
1151
1151
if (!perform_dp_seamless_boot )
1152
1152
dp_verify_link_cap_with_retries (link ,
1153
+ NULL ,
1153
1154
& link -> reported_link_cap ,
1154
1155
LINK_TRAINING_MAX_VERIFY_RETRY );
1155
1156
} else {
@@ -2503,7 +2504,8 @@ static void write_i2c_redriver_setting(
2503
2504
DC_LOG_DEBUG ("Set redriver failed" );
2504
2505
}
2505
2506
2506
- static void disable_link (struct dc_link * link , enum signal_type signal )
2507
+ static void disable_link (struct dc_link * link , const struct link_resource * link_res ,
2508
+ enum signal_type signal )
2507
2509
{
2508
2510
/*
2509
2511
* TODO: implement call for dp_set_hw_test_pattern
@@ -2522,20 +2524,20 @@ static void disable_link(struct dc_link *link, enum signal_type signal)
2522
2524
struct dc_link_settings link_settings = link -> cur_link_settings ;
2523
2525
#endif
2524
2526
if (dc_is_dp_sst_signal (signal ))
2525
- dp_disable_link_phy (link , signal );
2527
+ dp_disable_link_phy (link , link_res , signal );
2526
2528
else
2527
- dp_disable_link_phy_mst (link , signal );
2529
+ dp_disable_link_phy_mst (link , link_res , signal );
2528
2530
2529
2531
if (dc_is_dp_sst_signal (signal ) ||
2530
2532
link -> mst_stream_alloc_table .stream_count == 0 ) {
2531
2533
#if defined(CONFIG_DRM_AMD_DC_DCN )
2532
2534
if (dp_get_link_encoding_format (& link_settings ) == DP_8b_10b_ENCODING ) {
2533
2535
dp_set_fec_enable (link , false);
2534
- dp_set_fec_ready (link , false);
2536
+ dp_set_fec_ready (link , link_res , false);
2535
2537
}
2536
2538
#else
2537
2539
dp_set_fec_enable (link , false);
2538
- dp_set_fec_ready (link , false);
2540
+ dp_set_fec_ready (link , link_res , false);
2539
2541
#endif
2540
2542
}
2541
2543
} else {
@@ -2646,7 +2648,7 @@ static enum dc_status enable_link(
2646
2648
* new link settings.
2647
2649
*/
2648
2650
if (link -> link_status .link_active ) {
2649
- disable_link (link , pipe_ctx -> stream -> signal );
2651
+ disable_link (link , & pipe_ctx -> link_res , pipe_ctx -> stream -> signal );
2650
2652
}
2651
2653
2652
2654
switch (pipe_ctx -> stream -> signal ) {
@@ -4109,7 +4111,7 @@ static void fpga_dp_hpo_enable_link_and_stream(struct dc_state *state, struct pi
4109
4111
stream -> link -> cur_link_settings = link_settings ;
4110
4112
4111
4113
/* Enable clock, Configure lane count, and Enable Link Encoder*/
4112
- enable_dp_hpo_output (stream -> link , & stream -> link -> cur_link_settings );
4114
+ enable_dp_hpo_output (stream -> link , & pipe_ctx -> link_res , & stream -> link -> cur_link_settings );
4113
4115
4114
4116
#ifdef DIAGS_BUILD
4115
4117
/* Workaround for FPGA HPO capture DP link data:
@@ -4353,7 +4355,8 @@ void core_link_enable_stream(
4353
4355
if (status != DC_FAIL_DP_LINK_TRAINING ||
4354
4356
pipe_ctx -> stream -> signal == SIGNAL_TYPE_DISPLAY_PORT_MST ) {
4355
4357
if (false == stream -> link -> link_status .link_active )
4356
- disable_link (stream -> link , pipe_ctx -> stream -> signal );
4358
+ disable_link (stream -> link , & pipe_ctx -> link_res ,
4359
+ pipe_ctx -> stream -> signal );
4357
4360
BREAK_TO_DEBUGGER ();
4358
4361
return ;
4359
4362
}
@@ -4502,14 +4505,14 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx)
4502
4505
* state machine.
4503
4506
* In DP2 or MST mode, our encoder will stay video active
4504
4507
*/
4505
- disable_link (pipe_ctx -> stream -> link , pipe_ctx -> stream -> signal );
4508
+ disable_link (pipe_ctx -> stream -> link , & pipe_ctx -> link_res , pipe_ctx -> stream -> signal );
4506
4509
dc -> hwss .disable_stream (pipe_ctx );
4507
4510
} else {
4508
4511
dc -> hwss .disable_stream (pipe_ctx );
4509
- disable_link (pipe_ctx -> stream -> link , pipe_ctx -> stream -> signal );
4512
+ disable_link (pipe_ctx -> stream -> link , & pipe_ctx -> link_res , pipe_ctx -> stream -> signal );
4510
4513
}
4511
4514
#else
4512
- disable_link (pipe_ctx -> stream -> link , pipe_ctx -> stream -> signal );
4515
+ disable_link (pipe_ctx -> stream -> link , & pipe_ctx -> link_res , pipe_ctx -> stream -> signal );
4513
4516
4514
4517
dc -> hwss .disable_stream (pipe_ctx );
4515
4518
#endif
@@ -4592,16 +4595,22 @@ void dc_link_set_drive_settings(struct dc *dc,
4592
4595
{
4593
4596
4594
4597
int i ;
4598
+ struct pipe_ctx * pipe = NULL ;
4599
+ const struct link_resource * link_res ;
4595
4600
4596
- for (i = 0 ; i < dc -> link_count ; i ++ ) {
4597
- if (dc -> links [i ] == link )
4598
- break ;
4599
- }
4601
+ link_res = dc_link_get_cur_link_res (link );
4600
4602
4601
- if (i >= dc -> link_count )
4603
+ for (i = 0 ; i < MAX_PIPES ; i ++ ) {
4604
+ pipe = & dc -> current_state -> res_ctx .pipe_ctx [i ];
4605
+ if (pipe -> stream && pipe -> stream -> link ) {
4606
+ if (pipe -> stream -> link == link )
4607
+ break ;
4608
+ }
4609
+ }
4610
+ if (pipe && link_res )
4611
+ dc_link_dp_set_drive_settings (pipe -> stream -> link , link_res , lt_settings );
4612
+ else
4602
4613
ASSERT_CRITICAL (false);
4603
-
4604
- dc_link_dp_set_drive_settings (dc -> links [i ], lt_settings );
4605
4614
}
4606
4615
4607
4616
void dc_link_set_preferred_link_settings (struct dc * dc ,
@@ -4793,6 +4802,9 @@ void dc_link_overwrite_extended_receiver_cap(
4793
4802
4794
4803
bool dc_link_is_fec_supported (const struct dc_link * link )
4795
4804
{
4805
+ /* TODO - use asic cap instead of link_enc->features
4806
+ * we no longer know which link enc to use for this link before commit
4807
+ */
4796
4808
struct link_encoder * link_enc = NULL ;
4797
4809
4798
4810
/* Links supporting dynamically assigned link encoder will be assigned next
@@ -4887,3 +4899,22 @@ uint32_t dc_bandwidth_in_kbps_from_timing(
4887
4899
return kbps ;
4888
4900
4889
4901
}
4902
+
4903
+ const struct link_resource * dc_link_get_cur_link_res (const struct dc_link * link )
4904
+ {
4905
+ int i ;
4906
+ struct pipe_ctx * pipe = NULL ;
4907
+ const struct link_resource * link_res = NULL ;
4908
+
4909
+ for (i = 0 ; i < MAX_PIPES ; i ++ ) {
4910
+ pipe = & link -> dc -> current_state -> res_ctx .pipe_ctx [i ];
4911
+ if (pipe -> stream && pipe -> stream -> link && pipe -> top_pipe == NULL ) {
4912
+ if (pipe -> stream -> link == link ) {
4913
+ link_res = & pipe -> link_res ;
4914
+ break ;
4915
+ }
4916
+ }
4917
+ }
4918
+
4919
+ return link_res ;
4920
+ }
0 commit comments