Commit 5e9ff159 authored by George Shen's avatar George Shen Committed by Alex Deucher

drm/amd/display: Minor refactor of DP PHY test automation

[Why]
Improve readability and maintainability of code.

[How]
Refactor test pattern size calculation out of function
call parameter and store value in variable.
Signed-off-by: default avatarGeorge Shen <george.shen@amd.com>
Reviewed-by: default avatarWenjing Liu <Wenjing.Liu@amd.com>
Acked-by: default avatarStylon Wang <stylon.wang@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 194038fd
...@@ -2755,9 +2755,10 @@ static void dp_test_send_phy_test_pattern(struct dc_link *link) ...@@ -2755,9 +2755,10 @@ static void dp_test_send_phy_test_pattern(struct dc_link *link)
union phy_test_pattern dpcd_test_pattern; union phy_test_pattern dpcd_test_pattern;
union lane_adjust dpcd_lane_adjustment[2]; union lane_adjust dpcd_lane_adjustment[2];
unsigned char dpcd_post_cursor_2_adjustment = 0; unsigned char dpcd_post_cursor_2_adjustment = 0;
unsigned char test_80_bit_pattern[ unsigned char test_pattern_buffer[
(DP_TEST_80BIT_CUSTOM_PATTERN_79_72 - (DP_TEST_80BIT_CUSTOM_PATTERN_79_72 -
DP_TEST_80BIT_CUSTOM_PATTERN_7_0)+1] = {0}; DP_TEST_80BIT_CUSTOM_PATTERN_7_0)+1] = {0};
unsigned int test_pattern_size = 0;
enum dp_test_pattern test_pattern; enum dp_test_pattern test_pattern;
struct dc_link_training_settings link_settings; struct dc_link_training_settings link_settings;
union lane_adjust dpcd_lane_adjust; union lane_adjust dpcd_lane_adjust;
...@@ -2827,12 +2828,15 @@ static void dp_test_send_phy_test_pattern(struct dc_link *link) ...@@ -2827,12 +2828,15 @@ static void dp_test_send_phy_test_pattern(struct dc_link *link)
break; break;
} }
if (test_pattern == DP_TEST_PATTERN_80BIT_CUSTOM) if (test_pattern == DP_TEST_PATTERN_80BIT_CUSTOM) {
test_pattern_size = (DP_TEST_80BIT_CUSTOM_PATTERN_79_72 -
DP_TEST_80BIT_CUSTOM_PATTERN_7_0) + 1;
core_link_read_dpcd( core_link_read_dpcd(
link, link,
DP_TEST_80BIT_CUSTOM_PATTERN_7_0, DP_TEST_80BIT_CUSTOM_PATTERN_7_0,
test_80_bit_pattern, test_pattern_buffer,
sizeof(test_80_bit_pattern)); test_pattern_size);
}
/* prepare link training settings */ /* prepare link training settings */
link_settings.link = link->cur_link_settings; link_settings.link = link->cur_link_settings;
...@@ -2870,9 +2874,8 @@ static void dp_test_send_phy_test_pattern(struct dc_link *link) ...@@ -2870,9 +2874,8 @@ static void dp_test_send_phy_test_pattern(struct dc_link *link)
test_pattern, test_pattern,
DP_TEST_PATTERN_COLOR_SPACE_UNDEFINED, DP_TEST_PATTERN_COLOR_SPACE_UNDEFINED,
&link_training_settings, &link_training_settings,
test_80_bit_pattern, test_pattern_buffer,
(DP_TEST_80BIT_CUSTOM_PATTERN_79_72 - test_pattern_size);
DP_TEST_80BIT_CUSTOM_PATTERN_7_0)+1);
} }
static void dp_test_send_link_test_pattern(struct dc_link *link) static void dp_test_send_link_test_pattern(struct dc_link *link)
......
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