<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div style="box-sizing: border-box; font-family: "Segoe UI", "Helvetica Neue", "Apple Color Emoji", "Segoe UI Emoji", Helvetica, Arial, sans-serif; font-size: 14px; orphans: 2; widows: 2">
Reviewed-by: Joseph Gravenor <Joseph.Gravenor@amd.com></div>
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Liu, Zhan <Zhan.Liu@amd.com><br>
<b>Sent:</b> Monday, February 10, 2020 4:08 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Liu, Zhan <Zhan.Liu@amd.com>; Gravenor, Joseph <Joseph.Gravenor@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/display: Add aconnector condition check for dpcd read</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">[Why]<br>
core_link_read_dpcd() will invoke dm_helpers_dp_read_dpcd(),<br>
which needs to read dpcd info with the help of aconnector.<br>
If aconnector (dc->links[i]->prev) is NULL, then dpcd status<br>
 cannot be read.<br>
<br>
As a result, dpcd read fails and a line of error will be<br>
printed out in dmesg.log as:<br>
"*ERROR* Failed to found connector for link!"<br>
<br>
[How]<br>
Make sure that aconnector (dc->links[i]->prev) is not NULL,<br>
then read dpcd status.<br>
<br>
Signed-off-by: Zhan Liu <zhan.liu@amd.com><br>
---<br>
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 19 ++++++++++++++-----<br>
 1 file changed, 14 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c<br>
index 42fcfee2c31b..92e1574073fd 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c<br>
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c<br>
@@ -1331,11 +1331,20 @@ void dcn10_init_hw(struct dc *dc)<br>
                         if (dc->links[i]->connector_signal != SIGNAL_TYPE_DISPLAY_PORT) {<br>
                                 continue;<br>
                         }<br>
-                       /* if any of the displays are lit up turn them off */<br>
-                       status = core_link_read_dpcd(dc->links[i], DP_SET_POWER,<br>
-                                                    &dpcd_power_state, sizeof(dpcd_power_state));<br>
-                       if (status == DC_OK && dpcd_power_state == DP_POWER_STATE_D0) {<br>
-                               dp_receiver_power_ctrl(dc->links[i], false);<br>
+<br>
+                       /*<br>
+                        * core_link_read_dpcd() will invoke dm_helpers_dp_read_dpcd(),<br>
+                        * which needs to read dpcd info with the help of aconnector.<br>
+                        * If aconnector (dc->links[i]->prev) is NULL, then dpcd status<br>
+                        * cannot be read.<br>
+                        */<br>
+                       if (dc->links[i]->priv) {<br>
+                               /* if any of the displays are lit up turn them off */<br>
+                               status = core_link_read_dpcd(dc->links[i], DP_SET_POWER,<br>
+                                                               &dpcd_power_state, sizeof(dpcd_power_state));<br>
+                               if (status == DC_OK && dpcd_power_state == DP_POWER_STATE_D0) {<br>
+                                       dp_receiver_power_ctrl(dc->links[i], false);<br>
+                               }<br>
                         }<br>
                 }<br>
         }<br>
-- <br>
2.17.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>