]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/amd/display: Retry Replay residency
authorChunTao Tso <ChunTao.Tso@amd.com>
Thu, 8 Aug 2024 09:25:55 +0000 (17:25 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 27 Aug 2024 21:53:14 +0000 (17:53 -0400)
[Why]
Because sometime DMUB GPINT will time out,
 it will cause we return 0 as residency number.

[How]
Retry to avoid this happened.

Reviewed-by: Robin Chen <robin.chen@amd.com>
Signed-off-by: ChunTao Tso <ChunTao.Tso@amd.com>
Signed-off-by: Zaeem Mohamed <zaeem.mohamed@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 14f9359616728224606246a6d40e1991eb3981b1..c31e4f26a305b0d5ba1002c38a6eb4e7877fa7fe 100644 (file)
@@ -12,6 +12,8 @@
 
 #define MAX_PIPES 6
 
+#define GPINT_RETRY_NUM 20
+
 static const uint8_t DP_SINK_DEVICE_STR_ID_1[] = {7, 1, 8, 7, 3};
 static const uint8_t DP_SINK_DEVICE_STR_ID_2[] = {7, 1, 8, 7, 5};
 
@@ -222,6 +224,7 @@ static void dmub_replay_residency(struct dmub_replay *dmub, uint8_t panel_inst,
        uint32_t *residency, const bool is_start, enum pr_residency_mode mode)
 {
        uint16_t param = (uint16_t)(panel_inst << 8);
+       uint32_t i = 0;
 
        switch (mode) {
        case PR_RESIDENCY_MODE_PHY:
@@ -249,10 +252,17 @@ static void dmub_replay_residency(struct dmub_replay *dmub, uint8_t panel_inst,
        if (is_start)
                param |= REPLAY_RESIDENCY_ENABLE;
 
-       // Send gpint command and wait for ack
-       if (!dc_wake_and_execute_gpint(dmub->ctx, DMUB_GPINT__REPLAY_RESIDENCY, param,
-                                      residency, DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY))
-               *residency = 0;
+       for (i = 0; i < GPINT_RETRY_NUM; i++) {
+               // Send gpint command and wait for ack
+               if (dc_wake_and_execute_gpint(dmub->ctx, DMUB_GPINT__REPLAY_RESIDENCY, param,
+                       residency, DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY))
+                       return;
+
+               udelay(100);
+       }
+
+       // it means gpint retry many times
+       *residency = 0;
 }
 
 /*