]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Wake DMCUB before sending a command for replay feature
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Mon, 4 Dec 2023 21:35:04 +0000 (16:35 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jun 2024 20:17:13 +0000 (16:17 -0400)
[Why]
We can hang in place trying to send commands when the DMCUB isn't
powered on.

[How]
For functions that execute within a DC context or DC lock we can wrap
the direct calls to dm_execute_dmub_cmd/list with code that exits idle
power optimizations and reallows once we're done with the command
submission on success.

For DM direct submissions the DM will need to manage the enter/exit
sequencing manually.

We cannot invoke a DMCUB command directly within the DM execution helper
or we can deadlock.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c

index 33cfeb730d7d64a96de4f3fc48769afcd6127c83..318d0dc113e6c52e106f3b172fe48a7a5bfbaaf0 100644 (file)
@@ -78,7 +78,7 @@ static void dmub_replay_enable(struct dmub_replay *dmub, bool enable, bool wait,
 
        cmd.replay_enable.header.payload_bytes = sizeof(struct dmub_rb_cmd_replay_enable_data);
 
-       dm_execute_dmub_cmd(dc, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
+       dc_wake_and_execute_dmub_cmd(dc, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
 
        /* Below loops 1000 x 500us = 500 ms.
         *  Exit REPLAY may need to wait 1-2 frames to power up. Timeout after at
@@ -121,7 +121,7 @@ static void dmub_replay_set_power_opt(struct dmub_replay *dmub, unsigned int pow
        cmd.replay_set_power_opt.replay_set_power_opt_data.power_opt = power_opt;
        cmd.replay_set_power_opt.replay_set_power_opt_data.panel_inst = panel_inst;
 
-       dm_execute_dmub_cmd(dc, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
+       dc_wake_and_execute_dmub_cmd(dc, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
 }
 
 /*
@@ -225,7 +225,7 @@ static void dmub_replay_set_coasting_vtotal(struct dmub_replay *dmub,
        cmd.replay_set_coasting_vtotal.header.payload_bytes = sizeof(struct dmub_cmd_replay_set_coasting_vtotal_data);
        cmd.replay_set_coasting_vtotal.replay_set_coasting_vtotal_data.coasting_vtotal = coasting_vtotal;
 
-       dm_execute_dmub_cmd(dc, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
+       dc_wake_and_execute_dmub_cmd(dc, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
 }
 
 /*