[PATCH 6.19 244/781] drm/amd/display: Pass proper DAC encoder ID to VBIOS

Greg Kroah-Hartman
2026-02-25T01:31:23Z

From: Timur Kristóf <timur.kristof@gmail.com>

[ Upstream commit 436d0d22aa7035a9f9b24fb14cd0e84d6571ea87 ]

Similarly to the analog_engine field, add a new analog_id field
which contains the encoder ID of the analog encoder that
corresponds to the link encoder.

Previously, the default encoder ID of the link encoder was used,
which meant that we passed the wrong ID in case of DVI-I.

Fixes: 5834c33fd3f6 ("drm/amd/display: Add concept of analog encoders (v2)")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 2 ++
drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h | 2 ++
drivers/gpu/drm/amd/display/dc/link/link_factory.c | 11 ++++++-----
.../amd/display/dc/resource/dce110/dce110_resource.c | 2 ++
4 files changed, 12 insertions(+), 5 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 87dbb8d7ed27d..5c1a10f77733a 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
@@ -850,6 +850,7 @@ void dce110_link_encoder_construct(
enc110->base.funcs = &dce110_lnk_enc_funcs;
enc110->base.ctx = init_data->ctx;
enc110->base.id = init_data->encoder;
+ enc110->base.analog_id = init_data->analog_encoder;

enc110->base.hpd_source = init_data->hpd_source;
enc110->base.connector = init_data->connector;
@@ -1793,6 +1794,7 @@ void dce60_link_encoder_construct(
enc110->base.funcs = &dce60_lnk_enc_funcs;
enc110->base.ctx = init_data->ctx;
enc110->base.id = init_data->encoder;
+ enc110->base.analog_id = init_data->analog_encoder;

enc110->base.hpd_source = init_data->hpd_source;
enc110->base.connector = init_data->connector;
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h b/drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h
index df512920a9fab..e638325e35ecf 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h
@@ -47,6 +47,7 @@ struct encoder_init_data {
enum hpd_source_id hpd_source;
/* TODO: in DAL2, here was pointer to EventManagerInterface */
struct graphics_object_id encoder;
+ struct graphics_object_id analog_encoder;
enum engine_id analog_engine;
struct dc_context *ctx;
enum transmitter transmitter;
@@ -81,6 +82,7 @@ struct link_encoder {
int32_t aux_channel_offset;
struct dc_context *ctx;
struct graphics_object_id id;
+ struct graphics_object_id analog_id;
struct graphics_object_id connector;
uint32_t output_signals;
enum engine_id preferred_engine;
diff --git a/drivers/gpu/drm/amd/display/dc/link/link_factory.c b/drivers/gpu/drm/amd/display/dc/link/link_factory.c
index c79c18efb6f89..d9cb6b6714009 100644
--- a/drivers/gpu/drm/amd/display/dc/link/link_factory.c
+++ b/drivers/gpu/drm/amd/display/dc/link/link_factory.c
@@ -433,20 +433,19 @@ static enum channel_id get_ddc_line(struct dc_link *link)
return channel;
}

-static enum engine_id find_analog_engine(struct dc_link *link)
+static enum engine_id find_analog_engine(struct dc_link *link, struct graphics_object_id *enc)
{
struct dc_bios *bp = link->ctx->dc_bios;
- struct graphics_object_id encoder = {0};
enum bp_result bp_result = BP_RESULT_OK;
int i;

for (i = 0; i < 3; i++) {
- bp_result = bp->funcs->get_src_obj(bp, link->link_id, i, &encoder);
+ bp_result = bp->funcs->get_src_obj(bp, link->link_id, i, enc);

if (bp_result != BP_RESULT_OK)
return ENGINE_ID_UNKNOWN;

- switch (encoder.id) {
+ switch (enc->id) {
case ENCODER_ID_INTERNAL_DAC1:
case ENCODER_ID_INTERNAL_KLDSCP_DAC1:
return ENGINE_ID_DACA;
@@ -456,6 +455,7 @@ static enum engine_id find_analog_engine(struct dc_link *link)
}
}

+ memset(enc, 0, sizeof(*enc));
return ENGINE_ID_UNKNOWN;
}

@@ -508,7 +508,7 @@ static bool construct_phy(struct dc_link *link,
*/
bp_funcs->get_src_obj(bios, link->link_id, 0, &link_encoder);
transmitter_from_encoder = translate_encoder_to_transmitter(link_encoder);
- link_analog_engine = find_analog_engine(link);
+ link_analog_engine = find_analog_engine(link, &enc_init_data.analog_encoder);

if (transmitter_from_encoder == TRANSMITTER_UNKNOWN &&
!analog_engine_supported(link_analog_engine)) {
@@ -648,6 +648,7 @@ static bool construct_phy(struct dc_link *link,
enc_init_data.channel = get_ddc_line(link);
enc_init_data.hpd_source = get_hpd_line(link);
enc_init_data.transmitter = transmitter_from_encoder;
+ enc_init_data.analog_engine = find_analog_engine(link, &enc_init_data.analog_encoder);
enc_init_data.encoder = link_encoder;
enc_init_data.analog_engine = link_analog_engine;

diff --git a/drivers/gpu/drm/amd/display/dc/resource/dce110/dce110_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dce110/dce110_resource.c
index cd54382c0af3e..7c09825cd9bd3 100644
--- a/drivers/gpu/drm/amd/display/dc/resource/dce110/dce110_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/resource/dce110/dce110_resource.c
@@ -895,6 +895,8 @@ static void get_pixel_clock_parameters(
*/
pixel_clk_params->requested_pix_clk_100hz = stream->timing.pix_clk_100hz;
pixel_clk_params->encoder_object_id = stream->link->link_enc->id;
+ if (dc_is_rgb_signal(pipe_ctx->stream->signal))
+ pixel_clk_params->encoder_object_id = stream->link->link_enc->analog_id;
pixel_clk_params->signal_type = pipe_ctx->stream->signal;
pixel_clk_params->controller_id = pipe_ctx->stream_res.tg->inst + 1;
/* TODO: un-hardcode*/
--
2.51.0