AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: James Lin <PingLei.Lin@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Harry Wentland <harry.wentland@amd.com>,
	Leo Li <sunpeng.li@amd.com>,
	Aurabindo Pillai <aurabindo.pillai@amd.com>,
	Roman Li <roman.li@amd.com>, Wayne Lin <wayne.lin@amd.com>,
	Tom Chung <chiahsuan.chung@amd.com>,
	"Fangzhi Zuo" <jerry.zuo@amd.com>,
	Dan Wheeler <daniel.wheeler@amd.com>, Ray Wu <Ray.Wu@amd.com>,
	Ivan Lipski <ivan.lipski@amd.com>, Alex Hung <alex.hung@amd.com>,
	James Lin <PingLei.Lin@amd.com>,
	Chenyu Chen <Chen-Yu.Chen@amd.com>,
	Matthew Stewart <Matthew.Stewart2@amd.com>,
	"Nevenko Stupar" <nevenko.stupar@amd.com>,
	Gabe Teeger <gabe.teeger@amd.com>,
	"James Lin" <pinglei.lin@amd.com>
Subject: [PATCH 09/20] drm/amd/display: Refactor dc_link_aux_transfer_raw
Date: Wed, 6 May 2026 12:31:07 +0800	[thread overview]
Message-ID: <20260506043342.2164710-10-PingLei.Lin@amd.com> (raw)
In-Reply-To: <20260506043342.2164710-1-PingLei.Lin@amd.com>

From: Matthew Stewart <Matthew.Stewart2@amd.com>

[Why & How]
The logic for choosing between the dce_aux_transfer function variants is
moved into dce_aux.c rather than link_ddc.c.

The "dce_aux_transfer_with_retries" function now uses
dce_aux_transfer_raw in its implementation as the logic is equivalent.

Reviewed-by: Nevenko Stupar <nevenko.stupar@amd.com>
Reviewed-by: Gabe Teeger <gabe.teeger@amd.com>
Signed-off-by: Matthew Stewart <Matthew.Stewart2@amd.com>
Signed-off-by: James Lin <pinglei.lin@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c  | 20 ++++++++++++-------
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.h  |  4 ++++
 .../amd/display/dc/link/protocols/link_ddc.c  |  7 +------
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
index eee58f946fae..181944ce77ab 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
@@ -559,6 +559,18 @@ static enum i2caux_transaction_action i2caux_action_from_payload(struct aux_payl
 int dce_aux_transfer_raw(struct ddc_service *ddc,
 		struct aux_payload *payload,
 		enum aux_return_code_type *operation_result)
+{
+	if (ddc->ctx->dc->debug.enable_dmub_aux_for_legacy_ddc ||
+	    !ddc->ddc_pin) {
+		return dce_aux_transfer_dmub_raw(ddc, payload, operation_result);
+	} else {
+		return dce_aux_transfer_raw_with_ddc_pin(ddc, payload, operation_result);
+	}
+}
+
+int dce_aux_transfer_raw_with_ddc_pin(struct ddc_service *ddc,
+		struct aux_payload *payload,
+		enum aux_return_code_type *operation_result)
 {
 	struct ddc *ddc_pin = ddc->ddc_pin;
 	struct dce_aux *aux_engine;
@@ -740,13 +752,7 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc,
 		if (payload->write)
 			dce_aux_log_payload("  write", payload->data, payload->length, 16);
 
-		/* Check whether aux to be processed via dmub or dcn directly */
-		if (ddc->ctx->dc->debug.enable_dmub_aux_for_legacy_ddc
-			|| ddc->ddc_pin == NULL) {
-			ret = dce_aux_transfer_dmub_raw(ddc, payload, &operation_result);
-		} else {
-			ret = dce_aux_transfer_raw(ddc, payload, &operation_result);
-		}
+		ret = dce_aux_transfer_raw(ddc, payload, &operation_result);
 
 		DC_TRACE_LEVEL_MESSAGE(DAL_TRACE_LEVEL_INFORMATION,
 					LOG_FLAG_I2cAux_DceAux,
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
index c850ed49281f..8f4745694016 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
@@ -304,6 +304,10 @@ int dce_aux_transfer_raw(struct ddc_service *ddc,
 		struct aux_payload *cmd,
 		enum aux_return_code_type *operation_result);
 
+int dce_aux_transfer_raw_with_ddc_pin(struct ddc_service *ddc,
+		struct aux_payload *cmd,
+		enum aux_return_code_type *operation_result);
+
 int dce_aux_transfer_dmub_raw(struct ddc_service *ddc,
 		struct aux_payload *payload,
 		enum aux_return_code_type *operation_result);
diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c
index ef9306686b14..70f854cca029 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c
@@ -401,12 +401,7 @@ int link_aux_transfer_raw(struct ddc_service *ddc,
 		struct aux_payload *payload,
 		enum aux_return_code_type *operation_result)
 {
-	if (ddc->ctx->dc->debug.enable_dmub_aux_for_legacy_ddc ||
-	    !ddc->ddc_pin) {
-		return dce_aux_transfer_dmub_raw(ddc, payload, operation_result);
-	} else {
-		return dce_aux_transfer_raw(ddc, payload, operation_result);
-	}
+	return dce_aux_transfer_raw(ddc, payload, operation_result);
 }
 
 uint32_t link_get_fixed_vs_pe_retimer_write_address(struct dc_link *link)
-- 
2.43.0


  parent reply	other threads:[~2026-05-06  7:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06  4:30 [PATCH 00/20] DC Patches May 11 2026 James Lin
2026-05-06  4:30 ` [PATCH 01/20] drm/amd/display: Fix refresh rate round up case James Lin
2026-05-06  4:31 ` [PATCH 02/20] drm/amd/display: Fix white screen on boot with OLED panel James Lin
2026-05-06  4:31 ` [PATCH 03/20] drm/amd/display: Fix CRC open failure during active rendering James Lin
2026-05-06  4:31 ` [PATCH 04/20] drm/amd/display: Fix signed/unsigned comparison mismatches James Lin
2026-05-06  4:31 ` [PATCH 05/20] drm/amd/display: Fix compiler warnings in dml2 James Lin
2026-05-06  4:31 ` [PATCH 06/20] drm/amd/display: Fix multiple compiler warnings James Lin
2026-05-06  4:31 ` [PATCH 07/20] drm/amd/display: Fix warnings James Lin
2026-05-06  4:31 ` [PATCH 08/20] drm/amd/display: only call pmfw if smu present flags true James Lin
2026-05-06  4:31 ` James Lin [this message]
2026-05-06  4:31 ` [PATCH 10/20] drm/amd/display: always-true lower-bound assert James Lin
2026-05-06  4:31 ` [PATCH 11/20] drm/amd/display: Separate ABM functions into dedicated power_abm.c file James Lin
2026-05-06  4:31 ` [PATCH 12/20] drm/amd/display: Add additional IPS entry/exit for PSR/Replay James Lin
2026-05-06  4:31 ` [PATCH 13/20] drm/amd/display: Enable IPS on DCN42 James Lin
2026-05-06  4:31 ` [PATCH 14/20] drm/amd/display: Fix enum decl warnings James Lin
2026-05-06  4:31 ` [PATCH 15/20] drm/amd/display: enable ODM 2:1 on single eDP based on pixel clock James Lin
2026-05-06  4:31 ` [PATCH 16/20] drm/amd/display: Revert "Unify fast update classification paths" James Lin
2026-05-06  4:31 ` [PATCH 17/20] drm/amd/display: Revert "Enable HUBP/OPTC/DPP power gating" James Lin
2026-05-06  4:31 ` [PATCH 18/20] drm/amd/display: Wrap DCN32 phantom-plane allocation in DC_RUN_WITH_PREEMPTION_ENABLED James Lin
2026-05-06  4:31 ` [PATCH 19/20] drm/amd/display: [FW Promotion] Release 0.1.59.0 James Lin
2026-05-06  4:31 ` [PATCH 20/20] drm/amd/display: Promote DC to 3.2.382 James Lin
2026-05-11 13:05 ` [PATCH 00/20] DC Patches May 11 2026 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=20260506043342.2164710-10-PingLei.Lin@amd.com \
    --to=pinglei.lin@amd.com \
    --cc=Chen-Yu.Chen@amd.com \
    --cc=Matthew.Stewart2@amd.com \
    --cc=Ray.Wu@amd.com \
    --cc=alex.hung@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=aurabindo.pillai@amd.com \
    --cc=chiahsuan.chung@amd.com \
    --cc=daniel.wheeler@amd.com \
    --cc=gabe.teeger@amd.com \
    --cc=harry.wentland@amd.com \
    --cc=ivan.lipski@amd.com \
    --cc=jerry.zuo@amd.com \
    --cc=nevenko.stupar@amd.com \
    --cc=roman.li@amd.com \
    --cc=sunpeng.li@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