]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Expand supported Replay residency mode
authorLeon Huang <Leon.Huang1@amd.com>
Mon, 4 Mar 2024 08:52:25 +0000 (16:52 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jun 2024 20:17:13 +0000 (16:17 -0400)
[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: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Leon Huang <Leon.Huang1@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
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.h

index fd91445d4d8e6125e897eef07967f079a1660cba..be27ab7ef2da32ab44862b581854ec16d47c67f5 100644 (file)
@@ -239,23 +239,39 @@ static void dmub_replay_set_coasting_vtotal(struct dmub_replay *dmub,
  * Get Replay residency from firmware.
  */
 static void dmub_replay_residency(struct dmub_replay *dmub, uint8_t panel_inst,
-       uint32_t *residency, const bool is_start, const bool is_alpm)
+       uint32_t *residency, const bool is_start, enum pr_residency_mode mode)
 {
-       struct dmub_srv *srv = dmub->ctx->dmub_srv->dmub;
        uint16_t param = (uint16_t)(panel_inst << 8);
 
-       if (is_alpm)
+       switch (mode) {
+       case PR_RESIDENCY_MODE_PHY:
+               param |= REPLAY_RESIDENCY_FIELD_MODE_PHY;
+               break;
+       case PR_RESIDENCY_MODE_ALPM:
                param |= REPLAY_RESIDENCY_FIELD_MODE_ALPM;
+               break;
+       case PR_RESIDENCY_MODE_IPS2:
+               param |= REPLAY_RESIDENCY_REVISION_1;
+               param |= REPLAY_RESIDENCY_FIELD_MODE2_IPS;
+               break;
+       case PR_RESIDENCY_MODE_FRAME_CNT:
+               param |= REPLAY_RESIDENCY_REVISION_1;
+               param |= REPLAY_RESIDENCY_FIELD_MODE2_FRAME_CNT;
+               break;
+       case PR_RESIDENCY_MODE_ENABLEMENT_PERIOD:
+               param |= REPLAY_RESIDENCY_REVISION_1;
+               param |= REPLAY_RESIDENCY_FIELD_MODE2_EN_PERIOD;
+               break;
+       default:
+               break;
+       }
 
        if (is_start)
                param |= REPLAY_RESIDENCY_ENABLE;
 
        // Send gpint command and wait for ack
-       dmub_srv_send_gpint_command(srv, DMUB_GPINT__REPLAY_RESIDENCY, param, 30);
-
-       if (!is_start)
-               dmub_srv_get_gpint_response(srv, residency);
-       else
+       if (!dc_wake_and_execute_gpint(dmub->ctx, DMUB_GPINT__REPLAY_RESIDENCY, param,
+                                      residency, DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY))
                *residency = 0;
 }
 
index d090ec900c080880f5e35baf459a110c5b7956b5..63bbb1bb0ad5248a300c5307d060d0e5e20ce437 100644 (file)
@@ -50,7 +50,7 @@ struct dmub_replay_funcs {
        void (*replay_set_coasting_vtotal)(struct dmub_replay *dmub, uint32_t coasting_vtotal,
                uint8_t panel_inst);
        void (*replay_residency)(struct dmub_replay *dmub,
-               uint8_t panel_inst, uint32_t *residency, const bool is_start, const bool is_alpm);
+               uint8_t panel_inst, uint32_t *residency, const bool is_start, const enum pr_residency_mode mode);
        void (*replay_set_power_opt_and_coasting_vtotal)(struct dmub_replay *dmub,
                unsigned int power_opt, uint8_t panel_inst, uint32_t coasting_vtotal);
 };