From: Leon Huang <leon.hua...@amd.com>

[Why]
Dmub provides several Replay residency calculation methods,
but current interface only supports either ALPM or PHY mode

[How]
Modify the interface for supporting different types
of Replay residency calculation.

Reviewed-by: Robin Chen <robin.c...@amd.com>
Acked-by: Roman Li <roman...@amd.com>
Signed-off-by: Leon Huang <leon.hua...@amd.com>
Tested-by: Daniel Wheeler <daniel.whee...@amd.com>
---
 drivers/gpu/drm/amd/display/dc/inc/link.h                  | 2 +-
 .../amd/display/dc/link/protocols/link_edp_panel_control.c | 7 +++++--
 .../amd/display/dc/link/protocols/link_edp_panel_control.h | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/inc/link.h 
b/drivers/gpu/drm/amd/display/dc/inc/link.h
index bf29fc58ea6a..7ab8ba5e23ed 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/link.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/link.h
@@ -288,7 +288,7 @@ struct link_service {
                        struct dc_link *link, uint32_t coasting_vtotal);
        bool (*edp_replay_residency)(const struct dc_link *link,
                        unsigned int *residency, const bool is_start,
-                       const bool is_alpm);
+                       const enum pr_residency_mode mode);
        bool (*edp_set_replay_power_opt_and_coasting_vtotal)(struct dc_link 
*link,
                        const unsigned int *power_opts, uint32_t 
coasting_vtotal);
 
diff --git 
a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c 
b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
index 0682dbbad448..689c5fb44e86 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
@@ -1056,7 +1056,7 @@ bool edp_set_coasting_vtotal(struct dc_link *link, 
uint32_t coasting_vtotal)
 }
 
 bool edp_replay_residency(const struct dc_link *link,
-       unsigned int *residency, const bool is_start, const bool is_alpm)
+       unsigned int *residency, const bool is_start, const enum 
pr_residency_mode mode)
 {
        struct dc  *dc = link->ctx->dc;
        struct dmub_replay *replay = dc->res_pool->replay;
@@ -1065,8 +1065,11 @@ bool edp_replay_residency(const struct dc_link *link,
        if (!dc_get_edp_link_panel_inst(dc, link, &panel_inst))
                return false;
 
+       if (!residency)
+               return false;
+
        if (replay != NULL && link->replay_settings.replay_feature_enabled)
-               replay->funcs->replay_residency(replay, panel_inst, residency, 
is_start, is_alpm);
+               replay->funcs->replay_residency(replay, panel_inst, residency, 
is_start, mode);
        else
                *residency = 0;
 
diff --git 
a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h 
b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h
index eee8a4db6f85..cb6d95cc36e4 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h
@@ -61,7 +61,7 @@ bool edp_send_replay_cmd(struct dc_link *link,
                        union dmub_replay_cmd_set *cmd_data);
 bool edp_set_coasting_vtotal(struct dc_link *link, uint32_t coasting_vtotal);
 bool edp_replay_residency(const struct dc_link *link,
-       unsigned int *residency, const bool is_start, const bool is_alpm);
+       unsigned int *residency, const bool is_start, const enum 
pr_residency_mode mode);
 bool edp_get_replay_state(const struct dc_link *link, uint64_t *state);
 bool edp_set_replay_power_opt_and_coasting_vtotal(struct dc_link *link,
        const unsigned int *power_opts, uint32_t coasting_vtotal);
-- 
2.34.1

Reply via email to