From: Peichen Huang <[email protected]>

[WHY]
Driver only process hpd irq when a branch device or when
the link is established. It would cause some irq for bw_alloc
mode of dp tunneling are ignored.

[HOW]
Driver should process hpd irq if bw_alloc and dp tunneling
are enabled.

Reviewed-by: Cruise Hung <[email protected]>
Signed-off-by: Peichen Huang <[email protected]>
Signed-off-by: Aurabindo Pillai <[email protected]>
---
 .../dc/link/protocols/link_dp_dpia_bw.c       | 19 +++++++++++++++----
 .../dc/link/protocols/link_dp_irq_handler.c   |  4 +++-
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c 
b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
index 8a3c18ae97a7..b16eb97ae11c 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
@@ -273,17 +273,28 @@ bool link_dpia_enable_usb4_dp_bw_alloc_mode(struct 
dc_link *link)
  */
 void link_dp_dpia_handle_bw_alloc_status(struct dc_link *link, uint8_t status)
 {
-       link->dpia_bw_alloc_config.estimated_bw = get_estimated_bw(link);
-
        if (status & DP_TUNNELING_BW_REQUEST_SUCCEEDED) {
                DC_LOG_DEBUG("%s: BW Allocation request succeeded on link(%d)",
                                __func__, link->link_index);
-       } else if (status & DP_TUNNELING_BW_REQUEST_FAILED) {
+       }
+
+       if (status & DP_TUNNELING_BW_REQUEST_FAILED) {
                DC_LOG_DEBUG("%s: BW Allocation request failed on link(%d)  
allocated/estimated BW=%d",
                                __func__, link->link_index, 
link->dpia_bw_alloc_config.estimated_bw);
 
                link_dpia_send_bw_alloc_request(link, 
link->dpia_bw_alloc_config.estimated_bw);
-       } else if (status & DP_TUNNELING_ESTIMATED_BW_CHANGED) {
+       }
+
+       if (status & DP_TUNNELING_BW_ALLOC_CAP_CHANGED) {
+               link->dpia_bw_alloc_config.bw_granularity = 
get_bw_granularity(link);
+
+               DC_LOG_DEBUG("%s: Granularity changed on link(%d)  new 
granularity=%d",
+                               __func__, link->link_index, 
link->dpia_bw_alloc_config.bw_granularity);
+       }
+
+       if (status & DP_TUNNELING_ESTIMATED_BW_CHANGED) {
+               link->dpia_bw_alloc_config.estimated_bw = 
get_estimated_bw(link);
+
                DC_LOG_DEBUG("%s: Estimated BW changed on link(%d)  new 
estimated BW=%d",
                                __func__, link->link_index, 
link->dpia_bw_alloc_config.estimated_bw);
        }
diff --git 
a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c 
b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c
index 693477413347..4b01ab0a5a7f 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c
@@ -398,10 +398,12 @@ bool dp_should_allow_hpd_rx_irq(const struct dc_link 
*link)
         * Don't handle RX IRQ unless one of following is met:
         * 1) The link is established (cur_link_settings != unknown)
         * 2) We know we're dealing with a branch device, SST or MST
+        * 3) The link is bw_alloc enabled.
         */
 
        if ((link->cur_link_settings.lane_count != LANE_COUNT_UNKNOWN) ||
-               is_dp_branch_device(link))
+               is_dp_branch_device(link) ||
+               link->dpia_bw_alloc_config.bw_alloc_enabled)
                return true;
 
        return false;
-- 
2.51.0

Reply via email to