drm/amd/display: Dpia hpd status not in sync after S4
authorMeenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>
Tue, 19 Dec 2023 20:51:24 +0000 (15:51 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 9 Jan 2024 20:43:54 +0000 (15:43 -0500)
[Why]
Dpia hpd status not in sync causing driver not enabling BW Alloc after
S4.

[How]
Update hpd_status of the link when querying hpd state from dmub in
dpia_query_hpd_status().

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Meenakshikumar Somasundaram <meenakshikumar.somasundaram@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/link/protocols/link_dp_dpia.c

index 982eda3c46f5680af8c60042e4cc7fc8909f68d3..6af42ba9885c054ead528e11d14007622af098a8 100644 (file)
@@ -82,25 +82,33 @@ bool dpia_query_hpd_status(struct dc_link *link)
 {
        union dmub_rb_cmd cmd = {0};
        struct dc_dmub_srv *dmub_srv = link->ctx->dmub_srv;
-       bool is_hpd_high = false;
 
        /* prepare QUERY_HPD command */
        cmd.query_hpd.header.type = DMUB_CMD__QUERY_HPD_STATE;
        cmd.query_hpd.data.instance = link->link_id.enum_id - ENUM_ID_1;
        cmd.query_hpd.data.ch_type = AUX_CHANNEL_DPIA;
 
-       /* Return HPD status reported by DMUB if query successfully executed. */
-       if (dc_wake_and_execute_dmub_cmd(dmub_srv->ctx, &cmd, DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY) &&
-           cmd.query_hpd.data.status == AUX_RET_SUCCESS)
-               is_hpd_high = cmd.query_hpd.data.result;
-
-       DC_LOG_DEBUG("%s: link(%d) dpia(%d) cmd_status(%d) result(%d)\n",
-               __func__,
-               link->link_index,
-               link->link_id.enum_id - ENUM_ID_1,
-               cmd.query_hpd.data.status,
-               cmd.query_hpd.data.result);
-
-       return is_hpd_high;
+       /* Query dpia hpd status from dmub */
+       if (dc_wake_and_execute_dmub_cmd(dmub_srv->ctx, &cmd,
+               DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY) &&
+           cmd.query_hpd.data.status == AUX_RET_SUCCESS) {
+               DC_LOG_DEBUG("%s: for link(%d) dpia(%d) success, current_hpd_status(%d) new_hpd_status(%d)\n",
+                       __func__,
+                       link->link_index,
+                       link->link_id.enum_id - ENUM_ID_1,
+                       link->hpd_status,
+                       cmd.query_hpd.data.result);
+               link->hpd_status = cmd.query_hpd.data.result;
+       } else {
+               DC_LOG_ERROR("%s: for link(%d) dpia(%d) failed with status(%d), current_hpd_status(%d) new_hpd_status(0)\n",
+                       __func__,
+                       link->link_index,
+                       link->link_id.enum_id - ENUM_ID_1,
+                       cmd.query_hpd.data.status,
+                       link->hpd_status);
+               link->hpd_status = false;
+       }
+
+       return link->hpd_status;
 }