drm/amd/display: Update link rate from DPCD 10
authorWesley Chalmers <Wesley.Chalmers@amd.com>
Thu, 16 May 2019 16:40:25 +0000 (12:40 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 11 Jun 2019 17:49:08 +0000 (12:49 -0500)
[WHY]
Some panels return a link rate of 0 (unknown) in DPCD 0. In this case,
an appropriate mode cannot be set, and certain panels will show
corruption as they are forced to use a mode they do not support.

[HOW]
Read DPCD 10 in the case where supported link rate from DPCD 0 is
unknown, and pass that value on to the reported link rate.
This re-introduces behaviour present in previous versions that appears
to have been accidentally removed.

Signed-off-by: Wesley Chalmers <Wesley.Chalmers@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c

index 65d6caedbd82c1d122f6d3e77b8b77e317657559..2d519e5fc3ea6f04dc9684b5eedc0bd8dda3a714 100644 (file)
@@ -1624,8 +1624,7 @@ static bool decide_edp_link_settings(struct dc_link *link, struct dc_link_settin
        uint32_t link_bw;
 
        if (link->dpcd_caps.dpcd_rev.raw < DPCD_REV_14 ||
-                       link->dpcd_caps.edp_supported_link_rates_count == 0 ||
-                       link->dc->config.optimize_edp_link_rate == false) {
+                       link->dpcd_caps.edp_supported_link_rates_count == 0) {
                *link_setting = link->verified_link_cap;
                return true;
        }
@@ -2609,7 +2608,8 @@ void detect_edp_sink_caps(struct dc_link *link)
        memset(supported_link_rates, 0, sizeof(supported_link_rates));
 
        if (link->dpcd_caps.dpcd_rev.raw >= DPCD_REV_14 &&
-                       link->dc->config.optimize_edp_link_rate) {
+                       (link->dc->config.optimize_edp_link_rate ||
+                       link->reported_link_cap.link_rate == LINK_RATE_UNKNOWN)) {
                // Read DPCD 00010h - 0001Fh 16 bytes at one shot
                core_link_read_dpcd(link, DP_SUPPORTED_LINK_RATES,
                                                        supported_link_rates, sizeof(supported_link_rates));
@@ -2624,6 +2624,9 @@ void detect_edp_sink_caps(struct dc_link *link)
                                link_rate = linkRateInKHzToLinkRateMultiplier(link_rate_in_khz);
                                link->dpcd_caps.edp_supported_link_rates[link->dpcd_caps.edp_supported_link_rates_count] = link_rate;
                                link->dpcd_caps.edp_supported_link_rates_count++;
+
+                               if (link->reported_link_cap.link_rate < link_rate)
+                                       link->reported_link_cap.link_rate = link_rate;
                        }
                }
        }