drm/amd/display: prefer preferred link cap over verified link settings
authorWenjing Liu <Wenjing.Liu@amd.com>
Fri, 22 Mar 2019 23:33:46 +0000 (19:33 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 10 Apr 2019 18:53:28 +0000 (13:53 -0500)
[why]
when preferred link cap is set, we should always use
preferred in all validation.
we should not use preferred for some validation but use
verified for others.

[how]
create getter function that gets verified link cap.
if preferred is set, return preferred link settings instead.

Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Nikola Cornij <Nikola.Cornij@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
drivers/gpu/drm/amd/display/dc/dc_link.h

index 51b85a8ef9f24046b5713181db9fd236ef584404..2b1cd8bd5e0327647d91c29c0fd250d9939283f5 100644 (file)
@@ -597,6 +597,15 @@ uint32_t dc_link_bandwidth_kbps(
 
 }
 
+const struct dc_link_settings *dc_link_get_verified_link_cap(
+               const struct dc_link *link)
+{
+       if (link->preferred_link_setting.lane_count != LANE_COUNT_UNKNOWN &&
+                       link->preferred_link_setting.link_rate != LINK_RATE_UNKNOWN)
+               return &link->preferred_link_setting;
+       return &link->verified_link_cap;
+}
+
 static void destruct(struct dc *dc)
 {
        dc_release_state(dc->current_state);
index 0d8ef8f7cb584b4a0bf58d2ff9e930b29d36287d..acb4f829e042e1a8cd350cdb3513ab5115454306 100644 (file)
@@ -1549,7 +1549,7 @@ bool dp_validate_mode_timing(
                return true;
 
        /* We always use verified link settings */
-       link_setting = &link->verified_link_cap;
+       link_setting = dc_link_get_verified_link_cap(link);
 
        /* TODO: DYNAMIC_VALIDATION needs to be implemented */
        /*if (flags.DYNAMIC_VALIDATION == 1 &&
index 7b61fb7b1bb736812c02ab1d3abdc52c0e723af4..4e26d6e93b315fc61d4eee5dd83452f05872f4ba 100644 (file)
@@ -250,6 +250,9 @@ uint32_t dc_link_bandwidth_kbps(
        const struct dc_link *link,
        const struct dc_link_settings *link_setting);
 
+const struct dc_link_settings *dc_link_get_verified_link_cap(
+               const struct dc_link *link);
+
 bool dc_submit_i2c(
                struct dc *dc,
                uint32_t link_index,