Commit f739ce57 authored by Zhan Liu's avatar Zhan Liu Committed by Alex Deucher
Browse files

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.

Signed-off-by: default avatarZhan Liu <zhan.liu@amd.com>
Reviewed-by: default avatarJoseph Gravenor <Joseph.Gravenor@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b80cd524
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -1328,13 +1328,20 @@ void dcn10_init_hw(struct dc *dc)
		enum dc_status status = DC_ERROR_UNEXPECTED;

		for (i = 0; i < dc->link_count; i++) {
			if (dc->links[i]->connector_signal != SIGNAL_TYPE_DISPLAY_PORT) {
			if (dc->links[i]->connector_signal != SIGNAL_TYPE_DISPLAY_PORT)
				continue;
			}

			/*
			 * 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) {
				if (status == DC_OK && dpcd_power_state == DP_POWER_STATE_D0)
					dp_receiver_power_ctrl(dc->links[i], false);
			}
		}