Skip to contentSkip to conversation

drm/amd/display: Add aconnector condition check for dpcd read

PATCH In review Zhan Liu 2 participants 2 messages Feb 10, 2020 – Feb 21, 2020

Subsystems (3)
lore
Share & tools
lore

Zhan Liu

author
#0 lore raw

PATCH 1/1 drm/amd/display: Add aconnector condition check for dpcd read

[Why]
core_link_read_dpcd() will invoke dm_helpers_dp_read_dpcd(), which needs to read dpcd info with the help of aconnector. If aconnector (dc->links[i]->prev) is NULL, then dpcd status
cannot be read.

As a result, dpcd read fails and a line of error will be printed out in dmesg.log as:
"*ERROR* Failed to found connector for link!"

[How]
Make sure that aconnector (dc->links[i]->prev) is not NULL, then read dpcd status.

---
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +14 -5
index 42fcfee2c31b..92e1574073fd 100644
@@ -1331,11 +1331,20 @@ void dcn10_init_hw(struct dc *dc)
 			if (dc->links[i]->connector_signal != SIGNAL_TYPE_DISPLAY_PORT) {
 				continue;
 			}
-			/* if any of the displays are lit up turn them off */
-			status = core_link_read_dpcd(dc->links[i], DP_SET_POWER,
-						     &dpcd_power_state, sizeof(dpcd_power_state));
-			if (status == DC_OK && dpcd_power_state == DP_POWER_STATE_D0) {
-				dp_receiver_power_ctrl(dc->links[i], false);
+
+			/*
+			 * core_link_read_dpcd() will invoke dm_helpers_dp_read_dpcd(),
+			 * which needs to read dpcd info with the help of aconnector.
+			 * If aconnector (dc->links[i]->prev) is NULL, then dpcd status
+			 * cannot be read.
+			 */
+			if (dc->links[i]->priv) {
+				/* if any of the displays are lit up turn them off */
+				status = core_link_read_dpcd(dc->links[i], DP_SET_POWER,
+								&dpcd_power_state, sizeof(dpcd_power_state));
+				if (status == DC_OK && dpcd_power_state == DP_POWER_STATE_D0) {
+					dp_receiver_power_ctrl(dc->links[i], false);
+				}
 			}
 		}
 	}
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - Internal Distribution Only]

________________________________
From: Liu, Zhan <[email protected]>
Sent: Monday, February 10, 2020 4:08 PM
To: [email protected] <[email protected]>; Liu, Zhan <[email protected]>; Gravenor, Joseph <[email protected]>
Subject: [PATCH] drm/amd/display: Add aconnector condition check for dpcd read

[Why]
core_link_read_dpcd() will invoke dm_helpers_dp_read_dpcd(), which needs to read dpcd info with the help of aconnector. If aconnector (dc->links[i]->prev) is NULL, then dpcd status
cannot be read.

As a result, dpcd read fails and a line of error will be printed out in dmesg.log as:
"*ERROR* Failed to found connector for link!"

[How]
Make sure that aconnector (dc->links[i]->prev) is not NULL, then read dpcd status.

---
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +14 -5
index 42fcfee2c31b..92e1574073fd 100644
@@ -1331,11 +1331,20 @@ void dcn10_init_hw(struct dc *dc)
                         if (dc->links[i]->connector_signal != SIGNAL_TYPE_DISPLAY_PORT) {
                                 continue;
                         }
-                       /* if any of the displays are lit up turn them off */
-                       status = core_link_read_dpcd(dc->links[i], DP_SET_POWER,
-                                                    &dpcd_power_state, sizeof(dpcd_power_state));
-                       if (status == DC_OK && dpcd_power_state == DP_POWER_STATE_D0) {
-                               dp_receiver_power_ctrl(dc->links[i], false);
+
+                       /*
+                        * core_link_read_dpcd() will invoke dm_helpers_dp_read_dpcd(),
+                        * which needs to read dpcd info with the help of aconnector.
+                        * If aconnector (dc->links[i]->prev) is NULL, then dpcd status
+                        * cannot be read.
+                        */
+                       if (dc->links[i]->priv) {
+                               /* if any of the displays are lit up turn them off */
+                               status = core_link_read_dpcd(dc->links[i], DP_SET_POWER,
+                                                               &dpcd_power_state, sizeof(dpcd_power_state));
+                               if (status == DC_OK && dpcd_power_state == DP_POWER_STATE_D0) {
+                                       dp_receiver_power_ctrl(dc->links[i], false);
+                               }
                         }
                 }
         }

--
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx