All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: stylon.wang@amd.com, Sunpeng.Li@amd.com, Harry.Wentland@amd.com,
	qingqing.zhuo@amd.com, Rodrigo.Siqueira@amd.com,
	roman.li@amd.com, Wenjing Liu <wenjing.liu@amd.com>,
	solomon.chiu@amd.com, Aurabindo.Pillai@amd.com,
	Wayne Lin <Wayne.Lin@amd.com>,
	Bhawanpreet.Lakha@amd.com, agustin.gutierrez@amd.com,
	pavle.kotarac@amd.com
Subject: [PATCH 20/24] drm/amd/display: allow set dp drive setting when stream is not present
Date: Sun, 23 Jan 2022 13:20:17 -0500	[thread overview]
Message-ID: <20220123182021.4154032-21-Rodrigo.Siqueira@amd.com> (raw)
In-Reply-To: <20220123182021.4154032-1-Rodrigo.Siqueira@amd.com>

From: Wenjing Liu <wenjing.liu@amd.com>

[why]
There is a change previously to disallow DM to set dp drive setings when
stream is not present. The logic might not work well with DP PHY
complaince scenario with a PHY test fixture attachment. We need to make
the method allow DP link drive settings changes even without stream
attached to it.

[how]
revert back to previous code in set drive setting function then add an
empty link_resource structure, then assign link resource based on
current link resource if link resource is allocated to the current pipe.

Reviewed-by: Wayne Lin <Wayne.Lin@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 30 ++++++++-----------
 drivers/gpu/drm/amd/display/dc/dc_link.h      |  3 +-
 2 files changed, 15 insertions(+), 18 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 d0aba8d7b1c3..6be2ae743cc5 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -4454,22 +4454,17 @@ void dc_link_set_drive_settings(struct dc *dc,
 {
 
 	int i;
-	struct pipe_ctx *pipe = NULL;
-	const struct link_resource *link_res;
+	struct link_resource link_res;
 
-	link_res = dc_link_get_cur_link_res(link);
+	for (i = 0; i < dc->link_count; i++)
+		if (dc->links[i] == link)
+			break;
 
-	for (i = 0; i < MAX_PIPES; i++) {
-		pipe = &dc->current_state->res_ctx.pipe_ctx[i];
-		if (pipe->stream && pipe->stream->link) {
-			if (pipe->stream->link == link)
-				break;
-		}
-	}
-	if (pipe && link_res)
-		dc_link_dp_set_drive_settings(pipe->stream->link, link_res, lt_settings);
-	else
+	if (i >= dc->link_count)
 		ASSERT_CRITICAL(false);
+
+	dc_link_get_cur_link_res(link, &link_res);
+	dc_link_dp_set_drive_settings(dc->links[i], &link_res, lt_settings);
 }
 
 void dc_link_set_preferred_link_settings(struct dc *dc,
@@ -4711,23 +4706,24 @@ uint32_t dc_bandwidth_in_kbps_from_timing(
 
 }
 
-const struct link_resource *dc_link_get_cur_link_res(const struct dc_link *link)
+void dc_link_get_cur_link_res(const struct dc_link *link,
+		struct link_resource *link_res)
 {
 	int i;
 	struct pipe_ctx *pipe = NULL;
-	const struct link_resource *link_res = NULL;
+
+	memset(link_res, 0, sizeof(*link_res));
 
 	for (i = 0; i < MAX_PIPES; i++) {
 		pipe = &link->dc->current_state->res_ctx.pipe_ctx[i];
 		if (pipe->stream && pipe->stream->link && pipe->top_pipe == NULL) {
 			if (pipe->stream->link == link) {
-				link_res = &pipe->link_res;
+				*link_res = pipe->link_res;
 				break;
 			}
 		}
 	}
 
-	return link_res;
 }
 
 /**
diff --git a/drivers/gpu/drm/amd/display/dc/dc_link.h b/drivers/gpu/drm/amd/display/dc/dc_link.h
index b1c79b3f26aa..6c02244e7fe7 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_link.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_link.h
@@ -459,7 +459,8 @@ bool dc_link_should_enable_fec(const struct dc_link *link);
 uint32_t dc_link_bw_kbps_from_raw_frl_link_rate_data(uint8_t bw);
 enum dp_link_encoding dc_link_dp_mst_decide_link_encoding_format(const struct dc_link *link);
 
-const struct link_resource *dc_link_get_cur_link_res(const struct dc_link *link);
+void dc_link_get_cur_link_res(const struct dc_link *link,
+		struct link_resource *link_res);
 /* take a snapshot of current link resource allocation state */
 void dc_get_cur_link_res_map(const struct dc *dc, uint32_t *map);
 /* restore link resource allocation state from a snapshot */
-- 
2.25.1


  parent reply	other threads:[~2022-01-23 18:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23 18:19 [PATCH 00/24] DC Patches Jan 23, 2022 Rodrigo Siqueira
2022-01-23 18:19 ` [PATCH 01/24] drm/amd/display: add protection in link encoder matching logic Rodrigo Siqueira
2022-01-23 18:19 ` [PATCH 02/24] drm/amd/display: do not compare integers of different widths Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 03/24] drm/amd/display: Driver support for MCLK query tool Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 04/24] drm/amd/display: Change error to warning when hpd remains low for eDP Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 05/24] drm/amd/display: Only set PSR version when valid Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 06/24] drm/amd/display: Change return type of dm_helpers_dp_mst_stop_top_mgr Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 07/24] drm/amd/display: Use PSR version selected during set_psr_caps Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 08/24] drm/amd/display: Add Cable ID support for native DP Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 09/24] drm/amd/display: Add Synaptics Fifo Reset Workaround Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 10/24] drm/amd/display: Retrieve MST Downstream Port Status Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 11/24] drm/amd/display: Add DSC Enable for Synaptics Hub Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 12/24] drm/amd/display: Support synchronized indirect reg access Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 13/24] drm/amd/display: Basic support with device ID Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 14/24] drm/amd/display: remove PHY repeater count check for LTTPR mode Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 15/24] drm/amd/display: Update VSC HDR infoPacket on TF change Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 16/24] drm/amd/display: [FW Promotion] Release 0.0.101.0 Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 17/24] drm/amd/display: Reset preferred training settings immediately Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 18/24] drm/amd/display: 3.2.170 Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 19/24] drm/amd/display: Remove unnecessary function definition Rodrigo Siqueira
2022-01-23 18:20 ` Rodrigo Siqueira [this message]
2022-01-23 18:20 ` [PATCH 21/24] drm/amd/display: Fix disabling dccg clocks Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 22/24] drm/amd/display: Disable physym clock Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 23/24] drm/amd/display: fix zstate allow interface to PMFW Rodrigo Siqueira
2022-01-23 18:20 ` [PATCH 24/24] drm/amd/display: add debug option for z9 disable interface Rodrigo Siqueira
2022-01-24 14:06 ` [PATCH 00/24] DC Patches Jan 23, 2022 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=20220123182021.4154032-21-Rodrigo.Siqueira@amd.com \
    --to=rodrigo.siqueira@amd.com \
    --cc=Aurabindo.Pillai@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=Wayne.Lin@amd.com \
    --cc=agustin.gutierrez@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --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=wenjing.liu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.