From: Ausef Yousof <ausef.you...@amd.com>

This reverts commit f767e41a6f6b70cd222edd24549c1fa753c550fc.

[why & how]
The offending commit caused a lighting issue for Samsung Odyssey G9
monitors when connecting via USB-C. The commit was intended to block certain 
UHBR rates.

Reviewed-by: Charlene Liu <charlene....@amd.com>
Signed-off-by: Ausef Yousof <ausef.you...@amd.com>
Signed-off-by: Zaeem Mohamed <zaeem.moha...@amd.com>
---
 .../dc/link/protocols/link_dp_capability.c    | 22 +++++--------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c 
b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c
index 93b81918216d..72ef0c3a7ebd 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c
@@ -1417,8 +1417,7 @@ static bool get_usbc_cable_id(struct dc_link *link, union 
dp_cable_id *cable_id)
 
        if (!link->ctx->dmub_srv ||
                        link->ep_type != DISPLAY_ENDPOINT_PHY ||
-                       link->link_enc->features.flags.bits.DP_IS_USB_C == 0 ||
-                       link->link_enc->features.flags.bits.IS_DP2_CAPABLE == 0)
+                       link->link_enc->features.flags.bits.DP_IS_USB_C == 0)
                return false;
 
        memset(&cmd, 0, sizeof(cmd));
@@ -1431,9 +1430,7 @@ static bool get_usbc_cable_id(struct dc_link *link, union 
dp_cable_id *cable_id)
                cable_id->raw = cmd.cable_id.data.output_raw;
                DC_LOG_DC("usbc_cable_id = %d.\n", cable_id->raw);
        }
-
-       ASSERT(cmd.cable_id.header.ret_status);
-       return true;
+       return cmd.cable_id.header.ret_status == 1;
 }
 
 static void retrieve_cable_id(struct dc_link *link)
@@ -2130,8 +2127,6 @@ struct dc_link_settings dp_get_max_link_cap(struct 
dc_link *link)
        /* get max link encoder capability */
        if (link_enc)
                link_enc->funcs->get_max_link_cap(link_enc, &max_link_cap);
-       else
-               return max_link_cap;
 
        /* Lower link settings based on sink's link cap */
        if (link->reported_link_cap.lane_count < max_link_cap.lane_count)
@@ -2165,15 +2160,10 @@ struct dc_link_settings dp_get_max_link_cap(struct 
dc_link *link)
         */
        cable_max_link_rate = get_cable_max_link_rate(link);
 
-       if (!link->dc->debug.ignore_cable_id) {
-               if (cable_max_link_rate != LINK_RATE_UNKNOWN)
-                       // cable max link rate known
-                       max_link_cap.link_rate = MIN(max_link_cap.link_rate, 
cable_max_link_rate);
-               else if (link_enc->funcs->is_in_alt_mode && 
link_enc->funcs->is_in_alt_mode(link_enc))
-                       // cable max link rate ambiguous, DP alt mode, limit to 
HBR3
-                       max_link_cap.link_rate = MIN(max_link_cap.link_rate, 
LINK_RATE_HIGH3);
-               //else {}
-                       // cable max link rate ambiguous, DP, do nothing
+       if (!link->dc->debug.ignore_cable_id &&
+                       cable_max_link_rate != LINK_RATE_UNKNOWN) {
+               if (cable_max_link_rate < max_link_cap.link_rate)
+                       max_link_cap.link_rate = cable_max_link_rate;
 
                if (!link->dpcd_caps.cable_id.bits.UHBR13_5_CAPABILITY &&
                                link->dpcd_caps.cable_id.bits.CABLE_TYPE >= 2)
-- 
2.34.1

Reply via email to