AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Timur Kristóf" <timur.kristof@gmail.com>
To: amd-gfx@lists.freedesktop.org, Alexander.Deucher@amd.com,
	Mario Limonciello <mario.limonciello@amd.com>,
	Ivan Lipski <ivan.lipski@amd.com>,
	harry.wentland@amd.com, Alex Hung <alex.hung@amd.com>,
	Ray Wu <Ray.Wu@amd.com>,
	siqueira@igalia.com, Mauro Rossi <issor.oruam@gmail.com>
Cc: "Timur Kristóf" <timur.kristof@gmail.com>,
	"Alex Deucher" <alexander.deucher@amd.com>
Subject: [PATCH 4/8] drm/amd/display: Turn off DAC in DCE link encoder using VBIOS
Date: Mon,  2 Feb 2026 12:25:04 +0100	[thread overview]
Message-ID: <20260202112508.43000-5-timur.kristof@gmail.com> (raw)
In-Reply-To: <20260202112508.43000-1-timur.kristof@gmail.com>

Apparently, the VBIOS DAC1EncoderControl function is much more
graceful about turning off the DAC. It writes various DAC
registers in a specific sequence. Use that instead of just
clearing the DAC_ENABLE register.

Do this in just the dce110_link_encoder_disable_output
function and remove it from the HWSS.

Fixes: 0fbe321a93ce ("drm/amd/display: Implement DCE analog link encoders (v2)")
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Mauro Rossi <issor.oruam@gmail.com>
Suggested-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../drm/amd/display/dc/dce/dce_link_encoder.c | 30 +++++++++++--------
 .../amd/display/dc/hwss/dce110/dce110_hwseq.c |  3 --
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c b/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
index 7f0766b5fa3d..f8fcf8d1a4dd 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
@@ -133,6 +133,21 @@ static enum bp_result link_transmitter_control(
 	return result;
 }
 
+static enum bp_result link_dac_encoder_control(
+	struct dce110_link_encoder *link_enc,
+	enum bp_encoder_control_action action,
+	uint32_t pix_clk_100hz)
+{
+	struct dc_bios *bios = link_enc->base.ctx->dc_bios;
+	struct bp_encoder_control encoder_control = {0};
+
+	encoder_control.action = action;
+	encoder_control.engine_id = link_enc->base.analog_engine;
+	encoder_control.pixel_clock = pix_clk_100hz / 10;
+
+	return bios->funcs->encoder_control(bios, &encoder_control);
+}
+
 static void enable_phy_bypass_mode(
 	struct dce110_link_encoder *enc110,
 	bool enable)
@@ -1345,19 +1360,8 @@ void dce110_link_encoder_disable_output(
 	struct bp_transmitter_control cntl = { 0 };
 	enum bp_result result;
 
-	switch (enc->analog_engine) {
-	case ENGINE_ID_DACA:
-		REG_UPDATE(DAC_ENABLE, DAC_ENABLE, 0);
-		break;
-	case ENGINE_ID_DACB:
-		/* DACB doesn't seem to be present on DCE6+,
-		 * although there are references to it in the register file.
-		 */
-		DC_LOG_ERROR("%s DACB is unsupported\n", __func__);
-		break;
-	default:
-		break;
-	}
+	if (enc->analog_engine != ENGINE_ID_UNKNOWN)
+		link_dac_encoder_control(enc110, ENCODER_CONTROL_DISABLE, 0);
 
 	/* The code below only applies to connectors that support digital signals. */
 	if (enc->transmitter == TRANSMITTER_UNKNOWN)
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
index bd3a9f008699..c53c61a4cb5e 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
@@ -1199,9 +1199,6 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
 		dccg->funcs->disable_symclk_se(dccg, stream_enc->stream_enc_inst,
 					       link_enc->transmitter - TRANSMITTER_UNIPHY_A);
 	}
-
-	if (dc_is_rgb_signal(pipe_ctx->stream->signal))
-		dce110_dac_encoder_control(pipe_ctx, false);
 }
 
 void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,
-- 
2.52.0


  parent reply	other threads:[~2026-02-02 11:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02 11:25 [PATCH 0/8] drm/amd/display: Fix and cleanup analog encoders Timur Kristóf
2026-02-02 11:25 ` [PATCH 1/8] drm/amd/display: Use DCE 6 link encoder for DCE 6 analog connectors Timur Kristóf
2026-02-18  4:51   ` Alex Hung
2026-02-02 11:25 ` [PATCH 2/8] drm/amd/display: Fix disabling fastboot on DCE 6-8 Timur Kristóf
2026-02-18  4:53   ` Alex Hung
2026-02-02 11:25 ` [PATCH 3/8] drm/amd/display: Don't call find_analog_engine() twice Timur Kristóf
2026-02-02 11:25 ` Timur Kristóf [this message]
2026-02-02 11:25 ` [PATCH 5/8] drm/amd/display: Initialize DAC in DCE link encoder using VBIOS Timur Kristóf
2026-02-02 11:25 ` [PATCH 6/8] drm/amd/display: Set CRTC source for DAC using registers Timur Kristóf
2026-02-02 11:25 ` [PATCH 7/8] drm/amd/display: Enable DAC in DCE link encoder Timur Kristóf
2026-02-02 11:25 ` [PATCH 8/8] drm/amd/display: Remove unneeded DAC link encoder register Timur Kristóf
2026-02-02 21:25 ` [PATCH 0/8] drm/amd/display: Fix and cleanup analog encoders Alex Deucher
2026-02-03  0:47   ` Alex Hung
2026-02-16 14:41     ` Alex Deucher
2026-02-16 17:53       ` Alex Hung
2026-02-18  4:54 ` Alex Hung

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=20260202112508.43000-5-timur.kristof@gmail.com \
    --to=timur.kristof@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Ray.Wu@amd.com \
    --cc=alex.hung@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=issor.oruam@gmail.com \
    --cc=ivan.lipski@amd.com \
    --cc=mario.limonciello@amd.com \
    --cc=siqueira@igalia.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