From: "Timur Kristóf" <timur.kristof@gmail.com>
To: amd-gfx@lists.freedesktop.org, Alexander.Deucher@amd.com,
Christian.Koenig@amd.com,
Mario Limonciello <mario.limonciello@amd.com>,
Ivan Lipski <ivan.lipski@amd.com>, Alex Hung <alex.hung@amd.com>,
Prike Liang <Prike.Liang@amd.com>, Leo Li <sunpeng.li@amd.com>,
Ray Wu <Ray.Wu@amd.com>,
siqueira@igalia.com
Cc: "Timur Kristóf" <timur.kristof@gmail.com>
Subject: [PATCH 06/14] drm/amd/display: Implement BIOS parser external encoder control
Date: Mon, 26 Jan 2026 22:08:29 +0100 [thread overview]
Message-ID: <20260126210837.21885-7-timur.kristof@gmail.com> (raw)
In-Reply-To: <20260126210837.21885-1-timur.kristof@gmail.com>
The VBIOS has a function called ExternalEncoderControl which
controls the DP bridge encoders that some GPUs use for analog
and LVDS output. Fixup this old functionality.
For reference, see the legacy non-DC amdgpu display code:
amdgpu_atombios_encoder_setup_external_encoder()
- Set same parameters for the ENABLE action as the SETUP action
- Add missing enum values for DDC setup and DAC load detection
- Fix the bits per color field
- Clarify the code that sets the link rate
- Expose the function so that it can be called by rest of DC
A subsequent commit will call this function from DCE HWSS.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
---
.../gpu/drm/amd/display/dc/bios/bios_parser.c | 14 +++++++++++
.../drm/amd/display/dc/bios/command_table.c | 23 +++++++++----------
.../gpu/drm/amd/display/dc/dc_bios_types.h | 3 +++
.../amd/display/include/bios_parser_types.h | 2 ++
4 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
index e2b74dda00fc..82877f7b3b6f 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
@@ -780,6 +780,18 @@ static enum bp_result bios_parser_encoder_control(
return bp->cmd_tbl.dig_encoder_control(bp, cntl);
}
+static enum bp_result bios_parser_external_encoder_control(
+ struct dc_bios *dcb,
+ struct bp_external_encoder_control *cntl)
+{
+ struct bios_parser *bp = BP_FROM_DCB(dcb);
+
+ if (!bp->cmd_tbl.external_encoder_control)
+ return BP_RESULT_UNSUPPORTED;
+
+ return bp->cmd_tbl.external_encoder_control(bp, cntl);
+}
+
static enum bp_result bios_parser_dac_load_detection(
struct dc_bios *dcb,
enum engine_id engine_id)
@@ -2909,6 +2921,8 @@ static const struct dc_vbios_funcs vbios_funcs = {
.encoder_control = bios_parser_encoder_control,
+ .external_encoder_control = bios_parser_external_encoder_control,
+
.dac_load_detection = bios_parser_dac_load_detection,
.transmitter_control = bios_parser_transmitter_control,
diff --git a/drivers/gpu/drm/amd/display/dc/bios/command_table.c b/drivers/gpu/drm/amd/display/dc/bios/command_table.c
index b638cb5adb92..d2d59732d338 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/command_table.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/command_table.c
@@ -2521,6 +2521,7 @@ static enum bp_result external_encoder_control_v3(
cpu_to_le16((uint16_t)cntl->connector_obj_id.id);
break;
case EXTERNAL_ENCODER_CONTROL_SETUP:
+ case EXTERNAL_ENCODER_CONTROL_ENABLE:
/* EXTERNAL_ENCODER_CONTROL_PARAMETERS_V3 pixel clock unit in
* 10KHz
* output display device pixel clock frequency in unit of 10KHz.
@@ -2537,26 +2538,24 @@ static enum bp_result external_encoder_control_v3(
if (is_input_signal_dp) {
/* Bit[0]: indicate link rate, =1: 2.7Ghz, =0: 1.62Ghz,
* only valid in encoder setup with DP mode. */
- if (LINK_RATE_HIGH == cntl->link_rate)
- cntl_params->ucConfig |= 1;
+ if (cntl->link_rate == LINK_RATE_LOW)
+ cntl_params->ucConfig |=
+ EXTERNAL_ENCODER_CONFIG_V3_DPLINKRATE_1_62GHZ;
+ else if (cntl->link_rate == LINK_RATE_HIGH)
+ cntl_params->ucConfig |=
+ EXTERNAL_ENCODER_CONFIG_V3_DPLINKRATE_2_70GHZ;
+ else
+ dm_error("Link rate not supported by external encoder");
+
/* output color depth Indicate encoder data bpc format
* in DP mode, only valid in encoder setup in DP mode.
*/
- cntl_params->ucBitPerColor =
- (uint8_t)(cntl->color_depth);
+ cntl_params->ucBitPerColor = dc_color_depth_to_atom(cntl->color_depth);
}
/* Indicate how many lanes used by external encoder, only valid
* in encoder setup and enableoutput. */
cntl_params->ucLaneNum = (uint8_t)(cntl->lanes_number);
break;
- case EXTERNAL_ENCODER_CONTROL_ENABLE:
- cntl_params->usPixelClock =
- cpu_to_le16((uint16_t)(cntl->pixel_clock / 10));
- cntl_params->ucEncoderMode =
- (uint8_t)bp->cmd_helper->encoder_mode_bp_to_atom(
- cntl->signal, false);
- cntl_params->ucLaneNum = (uint8_t)cntl->lanes_number;
- break;
default:
break;
}
diff --git a/drivers/gpu/drm/amd/display/dc/dc_bios_types.h b/drivers/gpu/drm/amd/display/dc/dc_bios_types.h
index 06fdde281a0c..6f96c5cf39fe 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_bios_types.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_bios_types.h
@@ -97,6 +97,9 @@ struct dc_vbios_funcs {
enum bp_result (*encoder_control)(
struct dc_bios *bios,
struct bp_encoder_control *cntl);
+ enum bp_result (*external_encoder_control)(
+ struct dc_bios *bios,
+ struct bp_external_encoder_control *cntl);
enum bp_result (*dac_load_detection)(
struct dc_bios *bios,
enum engine_id engine_id);
diff --git a/drivers/gpu/drm/amd/display/include/bios_parser_types.h b/drivers/gpu/drm/amd/display/include/bios_parser_types.h
index f40dc612ec73..b5d97b394131 100644
--- a/drivers/gpu/drm/amd/display/include/bios_parser_types.h
+++ b/drivers/gpu/drm/amd/display/include/bios_parser_types.h
@@ -93,6 +93,8 @@ enum bp_external_encoder_control_action {
EXTERNAL_ENCODER_CONTROL_SETUP = 0xf,
EXTERNAL_ENCODER_CONTROL_UNBLANK = 0x10,
EXTERNAL_ENCODER_CONTROL_BLANK = 0x11,
+ EXTERNAL_ENCODER_CONTROL_DAC_LOAD_DETECT = 0x12,
+ EXTERNAL_ENCODER_CONTROL_DDC_SETUP = 0x14,
};
enum bp_pipe_control_action {
--
2.52.0
next prev parent reply other threads:[~2026-01-26 21:08 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 21:08 [PATCH 00/14] drm/amd/display: Add support for external DP bridge encoders in DC Timur Kristóf
2026-01-26 21:08 ` [PATCH 01/14] drm/amd/display: Use DCE 6 link encoder for DCE 6 analog connectors Timur Kristóf
2026-01-26 21:08 ` [PATCH 02/14] drm/amd/display: Only use analog link encoder with analog engine Timur Kristóf
2026-01-26 21:08 ` [PATCH 03/14] drm/amd/display: Only use analog stream " Timur Kristóf
2026-01-26 21:08 ` [PATCH 04/14] drm/amd/display: Add color depth helper function to BIOS parser Timur Kristóf
2026-01-26 21:08 ` [PATCH 05/14] drm/amd/display: Refactor DAC load detection, move to HWSS Timur Kristóf
2026-01-30 20:00 ` Alex Hung
2026-01-26 21:08 ` Timur Kristóf [this message]
2026-01-26 21:08 ` [PATCH 07/14] drm/amd/display: Implement DDC probe over AUX channel Timur Kristóf
2026-01-30 19:53 ` Alex Hung
2026-01-26 21:08 ` [PATCH 08/14] drm/amd/display: Add ability for HWSS to prepare the DDC before use Timur Kristóf
2026-01-26 21:08 ` [PATCH 09/14] drm/amd/display: Use preferred DP link rate if specified Timur Kristóf
2026-01-26 21:08 ` [PATCH 10/14] drm/amd/display: Add DCE HWSS support for external DP bridge encoders Timur Kristóf
2026-01-26 21:08 ` [PATCH 11/14] drm/amd/display: Link detection " Timur Kristóf
2026-01-26 21:08 ` [PATCH 12/14] drm/amd/display: Use " Timur Kristóf
2026-01-26 21:08 ` [PATCH 13/14] drm/amd/display: Implement DAC load detection on " Timur Kristóf
2026-01-26 21:08 ` [PATCH 14/14] drm/amdgpu: Use DC by default on CIK APUs Timur Kristóf
2026-02-09 15:35 ` [PATCH 00/14] drm/amd/display: Add support for external DP bridge encoders in DC Rodrigo Siqueira
2026-02-09 18:12 ` Alex Hung
2026-02-09 22:10 ` Timur Kristóf
2026-02-09 23:14 ` Alex Hung
2026-02-16 4:33 ` 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=20260126210837.21885-7-timur.kristof@gmail.com \
--to=timur.kristof@gmail.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=Prike.Liang@amd.com \
--cc=Ray.Wu@amd.com \
--cc=alex.hung@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=ivan.lipski@amd.com \
--cc=mario.limonciello@amd.com \
--cc=siqueira@igalia.com \
--cc=sunpeng.li@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