AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anson Jacob <Anson.Jacob@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: stylon.wang@amd.com, Jun Lei <Jun.Lei@amd.com>,
	solomon.chiu@amd.com, Sunpeng.Li@amd.com, Harry.Wentland@amd.com,
	qingqing.zhuo@amd.com, Rodrigo.Siqueira@amd.com,
	roman.li@amd.com,
	Meenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>,
	Anson.Jacob@amd.com, Aurabindo.Pillai@amd.com, wayne.lin@amd.com,
	mikita.lipski@amd.com, Bhawanpreet.Lakha@amd.com,
	agustin.gutierrez@amd.com, pavle.kotarac@amd.com
Subject: [PATCH 16/22] drm/amd/display: Add hpd pending flag to indicate detection of new hpd.
Date: Thu, 4 Nov 2021 16:52:09 -0400	[thread overview]
Message-ID: <20211104205215.1125899-17-Anson.Jacob@amd.com> (raw)
In-Reply-To: <20211104205215.1125899-1-Anson.Jacob@amd.com>

From: Meenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>

[Why]
For dpia link, link->hpd_status indicates current state, but driver
fails to capture hpd transitions in certain scenarios such as during
link training.

[How]
Added link->hpd_pending flag that captures arrival of new hpd.

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Anson Jacob <Anson.Jacob@amd.com>
Signed-off-by: Meenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c |  6 +++---
 .../drm/amd/display/dc/core/dc_link_dpia.c    | 20 +++++++++----------
 drivers/gpu/drm/amd/display/dc/dc_link.h      |  1 +
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index c4944ba59ec6..2e2dcd5518da 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -270,10 +270,10 @@ bool dc_link_detect_sink(struct dc_link *link, enum dc_connection_type *type)
 
 	/* Link may not have physical HPD pin. */
 	if (link->ep_type != DISPLAY_ENDPOINT_PHY) {
-		if (link->hpd_status)
-			*type = dc_connection_single;
-		else
+		if (link->is_hpd_pending || !link->hpd_status)
 			*type = dc_connection_none;
+		else
+			*type = dc_connection_single;
 
 		return true;
 	}
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dpia.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dpia.c
index b1c9f77d6bf4..d72122593959 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dpia.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dpia.c
@@ -94,17 +94,17 @@ static enum link_training_result dpia_configure_link(struct dc_link *link,
 		lt_settings);
 
 	status = dpcd_configure_channel_coding(link, lt_settings);
-	if (status != DC_OK && !link->hpd_status)
+	if (status != DC_OK && link->is_hpd_pending)
 		return LINK_TRAINING_ABORT;
 
 	/* Configure lttpr mode */
 	status = dpcd_configure_lttpr_mode(link, lt_settings);
-	if (status != DC_OK && !link->hpd_status)
+	if (status != DC_OK && link->is_hpd_pending)
 		return LINK_TRAINING_ABORT;
 
 	/* Set link rate, lane count and spread. */
 	status = dpcd_set_link_settings(link, lt_settings);
-	if (status != DC_OK && !link->hpd_status)
+	if (status != DC_OK && link->is_hpd_pending)
 		return LINK_TRAINING_ABORT;
 
 	if (link->preferred_training_settings.fec_enable)
@@ -112,7 +112,7 @@ static enum link_training_result dpia_configure_link(struct dc_link *link,
 	else
 		fec_enable = true;
 	status = dp_set_fec_ready(link, fec_enable);
-	if (status != DC_OK && !link->hpd_status)
+	if (status != DC_OK && link->is_hpd_pending)
 		return LINK_TRAINING_ABORT;
 
 	return LINK_TRAINING_SUCCESS;
@@ -388,7 +388,7 @@ static enum link_training_result dpia_training_cr_non_transparent(struct dc_link
 	}
 
 	/* Abort link training if clock recovery failed due to HPD unplug. */
-	if (!link->hpd_status)
+	if (link->is_hpd_pending)
 		result = LINK_TRAINING_ABORT;
 
 	DC_LOG_HW_LINK_TRAINING("%s\n DPIA(%d) clock recovery\n"
@@ -490,7 +490,7 @@ static enum link_training_result dpia_training_cr_transparent(struct dc_link *li
 	}
 
 	/* Abort link training if clock recovery failed due to HPD unplug. */
-	if (!link->hpd_status)
+	if (link->is_hpd_pending)
 		result = LINK_TRAINING_ABORT;
 
 	DC_LOG_HW_LINK_TRAINING("%s\n DPIA(%d) clock recovery\n"
@@ -675,7 +675,7 @@ static enum link_training_result dpia_training_eq_non_transparent(struct dc_link
 	}
 
 	/* Abort link training if equalization failed due to HPD unplug. */
-	if (!link->hpd_status)
+	if (link->is_hpd_pending)
 		result = LINK_TRAINING_ABORT;
 
 	DC_LOG_HW_LINK_TRAINING("%s\n DPIA(%d) equalization\n"
@@ -758,7 +758,7 @@ static enum link_training_result dpia_training_eq_transparent(struct dc_link *li
 	}
 
 	/* Abort link training if equalization failed due to HPD unplug. */
-	if (!link->hpd_status)
+	if (link->is_hpd_pending)
 		result = LINK_TRAINING_ABORT;
 
 	DC_LOG_HW_LINK_TRAINING("%s\n DPIA(%d) equalization\n"
@@ -892,10 +892,10 @@ static void dpia_training_abort(struct dc_link *link, uint32_t hop)
 				__func__,
 				link->link_id.enum_id - ENUM_ID_1,
 				link->lttpr_mode,
-				link->hpd_status);
+				link->is_hpd_pending);
 
 	/* Abandon clean-up if sink unplugged. */
-	if (!link->hpd_status)
+	if (link->is_hpd_pending)
 		return;
 
 	if (hop != DPRX)
diff --git a/drivers/gpu/drm/amd/display/dc/dc_link.h b/drivers/gpu/drm/amd/display/dc/dc_link.h
index b732398dac89..d449e72a4e2a 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_link.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_link.h
@@ -113,6 +113,7 @@ struct dc_link {
 	 * DIG encoder. */
 	bool is_dig_mapping_flexible;
 	bool hpd_status; /* HPD status of link without physical HPD pin. */
+	bool is_hpd_pending; /* Indicates a new received hpd */
 
 	bool edp_sink_present;
 
-- 
2.25.1


  parent reply	other threads:[~2021-11-04 20:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 20:51 [PATCH 00/22] DC Patches Nov 4, 2021 Anson Jacob
2021-11-04 20:51 ` [PATCH 01/22] drm/amd/display: Add helper for blanking all dp displays Anson Jacob
2021-11-04 20:51 ` [PATCH 02/22] drm/amd/display: Pass panel inst to a PSR command Anson Jacob
2021-11-04 20:51 ` [PATCH 03/22] drm/amd/display: remove dmcub_support cap dependency Anson Jacob
2021-11-04 20:51 ` [PATCH 04/22] drm/amd/display: Add comment where CONFIG_DRM_AMD_DC_DCN macro ends Anson Jacob
2021-11-04 20:51 ` [PATCH 05/22] drm/amd/display: Fix RGB MPO underflow with multiple displays Anson Jacob
2021-11-04 20:51 ` [PATCH 06/22] drm/amd/display: Use link_enc_cfg API for queries Anson Jacob
2021-11-04 20:52 ` [PATCH 07/22] drm/amd/display: Fix detection of aligned DMUB firmware meta info Anson Jacob
2021-11-04 20:52 ` [PATCH 08/22] drm/amd/display: bring dcn31 clk mgr in line with other version style Anson Jacob
2021-11-04 20:52 ` [PATCH 09/22] drm/amd/display: clean up some formats and log Anson Jacob
2021-11-04 20:52 ` [PATCH 10/22] drm/amd/display: use link_rate_set above DPCD 1.3 (#1527) Anson Jacob
2021-11-04 20:52 ` [PATCH 11/22] drm/amd/display: fix stale info in link encoder assignment Anson Jacob
2021-11-04 20:52 ` [PATCH 12/22] drm/amd/display: retain/release stream pointer in link enc table Anson Jacob
2021-11-04 20:52 ` [PATCH 13/22] drm/amd/display: Don't lock connection_mutex for DMUB HPD Anson Jacob
2021-11-04 20:52 ` [PATCH 14/22] drm/amd/display: Add callbacks for DMUB HPD IRQ notifications Anson Jacob
2021-11-04 20:52 ` [PATCH 15/22] drm/amd/display: Fix Coverity Issues Anson Jacob
2021-11-04 20:52 ` Anson Jacob [this message]
2021-11-04 20:52 ` [PATCH 17/22] drm/amd/display: Adjust code indentation Anson Jacob
2021-11-04 20:52 ` [PATCH 18/22] drm/amd/display: 3.2.161 Anson Jacob
2021-11-04 20:52 ` [PATCH 19/22] drm/amd/display: To support sending TPS3 pattern when restoring link Anson Jacob
2021-11-04 20:52 ` [PATCH 20/22] drm/amd/display: Query all entries in assignment table during updates Anson Jacob
2021-11-04 20:52 ` [PATCH 21/22] drm/amd/display: Initialise encoder assignment when initialising dc_state Anson Jacob
2021-11-04 20:52 ` [PATCH 22/22] drm/amd/display: Wait for ACK for INBOX0 HW Lock Anson Jacob
2021-11-05 20:14 ` [PATCH 00/22] DC Patches Nov 4, 2021 Wheeler, Daniel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211104205215.1125899-17-Anson.Jacob@amd.com \
    --to=anson.jacob@amd.com \
    --cc=Aurabindo.Pillai@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Jun.Lei@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=agustin.gutierrez@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=meenakshikumar.somasundaram@amd.com \
    --cc=mikita.lipski@amd.com \
    --cc=pavle.kotarac@amd.com \
    --cc=qingqing.zhuo@amd.com \
    --cc=roman.li@amd.com \
    --cc=solomon.chiu@amd.com \
    --cc=stylon.wang@amd.com \
    --cc=wayne.lin@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox