From: Peichen Huang <[email protected]>

[WHY & HOW]
If the enable state is already as expect then just return.

Reviewed-by: Robin Chen <[email protected]>
Reviewed-by: Wenjing Liu <[email protected]>
Signed-off-by: Peichen Huang <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
---
 .../dc/link/protocols/link_dp_panel_replay.c  | 23 ++++++++++---------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git 
a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c 
b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c
index 6661078c0241..96afce4ffbfa 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c
@@ -252,23 +252,24 @@ bool dp_pr_enable(struct dc_link *link, bool enable)
        if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
                return false;
 
+       if (link->replay_settings.replay_allow_active == enable)
+               return true;
+
        if (enable && !dc_is_embedded_signal(link->connector_signal))
                dp_pr_set_static_screen_param(link);
 
-       if (link->replay_settings.replay_allow_active != enable) {
-               //for sending PR enable commands to DMUB
-               memset(&cmd, 0, sizeof(cmd));
+       // for sending PR enable commands to DMUB
+       memset(&cmd, 0, sizeof(cmd));
 
-               cmd.pr_enable.header.type = DMUB_CMD__PR;
-               cmd.pr_enable.header.sub_type = DMUB_CMD__PR_ENABLE;
-               cmd.pr_enable.header.payload_bytes = sizeof(struct 
dmub_cmd_pr_enable_data);
-               cmd.pr_enable.data.panel_inst = panel_inst;
-               cmd.pr_enable.data.enable = enable ? 1 : 0;
+       cmd.pr_enable.header.type = DMUB_CMD__PR;
+       cmd.pr_enable.header.sub_type = DMUB_CMD__PR_ENABLE;
+       cmd.pr_enable.header.payload_bytes = sizeof(struct 
dmub_cmd_pr_enable_data);
+       cmd.pr_enable.data.panel_inst = panel_inst;
+       cmd.pr_enable.data.enable = enable ? 1 : 0;
+       dc_wake_and_execute_dmub_cmd(dc->ctx, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
 
-               dc_wake_and_execute_dmub_cmd(dc->ctx, &cmd, 
DM_DMUB_WAIT_TYPE_WAIT);
+       link->replay_settings.replay_allow_active = enable;
 
-               link->replay_settings.replay_allow_active = enable;
-       }
        return true;
 }
 
-- 
2.43.0

Reply via email to