]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: init code for external panel replay
authorPeichen Huang <PeiChen.Huang@amd.com>
Mon, 15 Dec 2025 07:38:26 +0000 (15:38 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Sat, 10 Jan 2026 19:21:53 +0000 (14:21 -0500)
Prepare for supporting panel replay on external monitors.

Reviewed-by: Robin Chen <robin.chen@amd.com>
Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Peichen Huang <PeiChen.Huang@amd.com>
Signed-off-by: Matthew Stewart <matthew.stewart2@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dce/dmub_hw_lock_mgr.c
drivers/gpu/drm/amd/display/dc/inc/link_service.h
drivers/gpu/drm/amd/display/dc/link/link_dpms.c
drivers/gpu/drm/amd/display/dc/link/link_factory.c
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.h

index 5bfa2b0d2afdc6df55e9c97fb5650f82f2b45e70..7116fdd4c7ecdbb4c84037458919e70a7d816465 100644 (file)
@@ -69,7 +69,7 @@ bool dmub_hw_lock_mgr_does_link_require_lock(const struct dc *dc, const struct d
        if (link->psr_settings.psr_version == DC_PSR_VERSION_SU_1)
                return true;
 
-       if (link->replay_settings.replay_feature_enabled)
+       if (link->replay_settings.replay_feature_enabled && dc_is_embedded_signal(link->connector_signal))
                return true;
 
        if (link->psr_settings.psr_version == DC_PSR_VERSION_1) {
index 5885b4abdf38ec0bafaccbde0c83ea4464f9bc06..57bb82e949427f65109d4c0cbbb480c20764fa16 100644 (file)
@@ -283,8 +283,6 @@ struct link_service {
        bool (*edp_set_replay_allow_active)(struct dc_link *dc_link,
                        const bool *enable, bool wait, bool force_static,
                        const unsigned int *power_opts);
-       bool (*dp_setup_replay)(struct dc_link *link,
-                       const struct dc_stream_state *stream);
        bool (*edp_send_replay_cmd)(struct dc_link *link,
                        enum replay_FW_Message_type msg,
                        union dmub_replay_cmd_set *cmd_data);
@@ -304,6 +302,8 @@ struct link_service {
        bool (*edp_receiver_ready_T9)(struct dc_link *link);
        bool (*edp_receiver_ready_T7)(struct dc_link *link);
        bool (*edp_power_alpm_dpcd_enable)(struct dc_link *link, bool enable);
+       bool (*dp_setup_replay)(struct dc_link *link, const struct dc_stream_state *stream);
+       bool (*dp_pr_get_panel_inst)(const struct dc *dc, const struct dc_link *link, unsigned int *inst_out);
        bool (*dp_pr_enable)(struct dc_link *link, bool enable);
        bool (*dp_pr_update_state)(struct dc_link *link, struct dmub_cmd_pr_update_state_data *update_state_data);
        bool (*dp_pr_set_general_cmd)(struct dc_link *link, struct dmub_cmd_pr_general_cmd_data *general_cmd_data);
index 7e46ea98952c0ad46da5d04c22e1285cdcd58794..91742bde4dc28813a4abda12dfc9148d324d42e5 100644 (file)
@@ -46,6 +46,7 @@
 #include "protocols/link_dp_capability.h"
 #include "protocols/link_dp_training.h"
 #include "protocols/link_edp_panel_control.h"
+#include "protocols/link_dp_panel_replay.h"
 #include "protocols/link_dp_dpia_bw.h"
 
 #include "dm_helpers.h"
@@ -2529,6 +2530,9 @@ void link_set_dpms_on(
                        link_set_dsc_enable(pipe_ctx, true);
        }
 
+       if (link->replay_settings.config.replay_supported && !dc_is_embedded_signal(link->connector_signal))
+               dp_setup_replay(link, stream);
+
        status = enable_link(state, pipe_ctx);
 
        if (status != DC_OK) {
index e185f2caad0c76e2ce489868c81f7d3e5a2aadba..5fbcf04c625180d0312577406c901cf6a9af735c 100644 (file)
@@ -236,6 +236,7 @@ static void construct_link_service_edp_panel_control(struct link_service *link_s
 static void construct_link_service_dp_panel_replay(struct link_service *link_srv)
 {
        link_srv->dp_setup_replay = dp_setup_replay;
+       link_srv->dp_pr_get_panel_inst = dp_pr_get_panel_inst;
        link_srv->dp_pr_enable = dp_pr_enable;
        link_srv->dp_pr_update_state = dp_pr_update_state;
        link_srv->dp_pr_set_general_cmd = dp_pr_set_general_cmd;
index fdbfa5103183b8375efc8d4516f62a73386684e1..be441851d8764158fd96fd2abef74da4c1b25600 100644 (file)
@@ -75,7 +75,7 @@ static bool dp_setup_panel_replay(struct dc_link *link, const struct dc_stream_s
        if (!replay)
                return false;
 
-       if (!dc_get_edp_link_panel_inst(dc, link, &panel_inst))
+       if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
                return false;
 
        replay_context.aux_inst = link->ddc->ddc_pin->hw_info.ddc_channel;
@@ -103,14 +103,18 @@ static bool dp_setup_panel_replay(struct dc_link *link, const struct dc_stream_s
        link->replay_settings.replay_feature_enabled = dp_pr_copy_settings(link, &replay_context);
 
        if (link->replay_settings.replay_feature_enabled) {
-               pr_config_1.bits.PANEL_REPLAY_ENABLE = 1;
-               pr_config_1.bits.PANEL_REPLAY_CRC_ENABLE = 1;
-               pr_config_1.bits.IRQ_HPD_ASSDP_MISSING = 1;
-               pr_config_1.bits.IRQ_HPD_VSCSDP_UNCORRECTABLE_ERROR = 1;
-               pr_config_1.bits.IRQ_HPD_RFB_ERROR = 1;
-               pr_config_1.bits.IRQ_HPD_ACTIVE_FRAME_CRC_ERROR = 1;
-               pr_config_1.bits.PANEL_REPLAY_SELECTIVE_UPDATE_ENABLE = 1;
-               pr_config_1.bits.PANEL_REPLAY_EARLY_TRANSPORT_ENABLE = 1;
+               if (dc_is_embedded_signal(link->connector_signal)) {
+                       pr_config_1.bits.PANEL_REPLAY_ENABLE = 1;
+                       pr_config_1.bits.PANEL_REPLAY_CRC_ENABLE = 1;
+                       pr_config_1.bits.IRQ_HPD_ASSDP_MISSING = 1;
+                       pr_config_1.bits.IRQ_HPD_VSCSDP_UNCORRECTABLE_ERROR = 1;
+                       pr_config_1.bits.IRQ_HPD_RFB_ERROR = 1;
+                       pr_config_1.bits.IRQ_HPD_ACTIVE_FRAME_CRC_ERROR = 1;
+                       pr_config_1.bits.PANEL_REPLAY_SELECTIVE_UPDATE_ENABLE = 1;
+                       pr_config_1.bits.PANEL_REPLAY_EARLY_TRANSPORT_ENABLE = 1;
+               } else {
+                       pr_config_1.bits.PANEL_REPLAY_ENABLE = 1;
+               }
 
                pr_config_2.bits.SINK_REFRESH_RATE_UNLOCK_GRANTED = 0;
 
@@ -147,6 +151,23 @@ static bool dp_setup_panel_replay(struct dc_link *link, const struct dc_stream_s
        return true;
 }
 
+
+bool dp_pr_get_panel_inst(const struct dc *dc,
+               const struct dc_link *link,
+               unsigned int *inst_out)
+{
+       if (dc_is_embedded_signal(link->connector_signal)) {
+               /* TODO: just get edp link panel inst for now, fix it */
+               return dc_get_edp_link_panel_inst(dc, link, inst_out);
+       } else if (dc_is_dp_sst_signal(link->connector_signal)) {
+               /* TODO: just set to 1 for now, fix it */
+               *inst_out = 1;
+               return true;
+       }
+
+       return false;
+}
+
 bool dp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream)
 {
        if (!link)
@@ -165,7 +186,7 @@ bool dp_pr_enable(struct dc_link *link, bool enable)
        unsigned int panel_inst = 0;
        union dmub_rb_cmd cmd;
 
-       if (!dc_get_edp_link_panel_inst(dc, link, &panel_inst))
+       if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
                return false;
 
        if (link->replay_settings.replay_allow_active != enable) {
@@ -192,16 +213,16 @@ bool dp_pr_copy_settings(struct dc_link *link, struct replay_context *replay_con
        union dmub_rb_cmd cmd;
        struct pipe_ctx *pipe_ctx = NULL;
 
-       if (!dc_get_edp_link_panel_inst(dc, link, &panel_inst))
+       if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
                return false;
 
        for (unsigned int i = 0; i < MAX_PIPES; i++) {
                if (dc->current_state->res_ctx.pipe_ctx[i].stream &&
                        dc->current_state->res_ctx.pipe_ctx[i].stream->link &&
                        dc->current_state->res_ctx.pipe_ctx[i].stream->link == link &&
-                       dc->current_state->res_ctx.pipe_ctx[i].stream->link->connector_signal == SIGNAL_TYPE_EDP) {
+                       dc_is_dp_sst_signal(dc->current_state->res_ctx.pipe_ctx[i].stream->link->connector_signal)) {
                        pipe_ctx = &dc->current_state->res_ctx.pipe_ctx[i];
-                       //TODO: refactor for multi edp support
+                       /* todo: need update for MST */
                        break;
                }
        }
@@ -255,7 +276,7 @@ bool dp_pr_update_state(struct dc_link *link, struct dmub_cmd_pr_update_state_da
        unsigned int panel_inst = 0;
        union dmub_rb_cmd cmd;
 
-       if (!dc_get_edp_link_panel_inst(dc, link, &panel_inst))
+       if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
                return false;
 
        memset(&cmd, 0, sizeof(cmd));
@@ -276,7 +297,7 @@ bool dp_pr_set_general_cmd(struct dc_link *link, struct dmub_cmd_pr_general_cmd_
        unsigned int panel_inst = 0;
        union dmub_rb_cmd cmd;
 
-       if (!dc_get_edp_link_panel_inst(dc, link, &panel_inst))
+       if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
                return false;
 
        memset(&cmd, 0, sizeof(cmd));
@@ -298,7 +319,7 @@ bool dp_pr_get_state(const struct dc_link *link, uint64_t *state)
        uint32_t retry_count = 0;
        uint32_t replay_state = 0;
 
-       if (!dc_get_edp_link_panel_inst(dc, link, &panel_inst))
+       if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
                return false;
 
        do {
index b936092edb85fc8b0f472275bdc1e6c35c8883b7..5522d5911fd13027c96e96a21b5e6b6358f27f33 100644 (file)
@@ -27,8 +27,8 @@
 
 #include "link_service.h"
 
-bool dp_setup_replay(struct dc_link *link,
-               const struct dc_stream_state *stream);
+bool dp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream);
+bool dp_pr_get_panel_inst(const struct dc *dc, const struct dc_link *link, unsigned int *inst_out);
 bool dp_pr_enable(struct dc_link *link, bool enable);
 bool dp_pr_copy_settings(struct dc_link *link, struct replay_context *replay_context);
 bool dp_pr_update_state(struct dc_link *link, struct dmub_cmd_pr_update_state_data *update_state_data);