From 5ba397e17e8a3d520bdd293d5d5d8d54dd325b34 Mon Sep 17 00:00:00 2001 From: Aravind Venkateswaran Date: Sun, 27 Sep 2020 22:11:47 -0700 Subject: [PATCH] disp: msm: dp: fix the check for link maintenance Current implementation checks for loss of channel equilization or clock recovery only if the sink sets the link status updated bit in the DPCD. However, it is possible that the sink can issue an IRQ HPD to notify a link loss without setting the link status updated field. Update the implementation to perform a link maintenance whenever clock recovery or channel equalization is not ok irrespective of whether the link status updated bit is set. Change-Id: I2d765236b1e8ddae3c410087406546d0422cdf07 Signed-off-by: Aravind Venkateswaran --- msm/dp/dp_link.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/msm/dp/dp_link.c b/msm/dp/dp_link.c index 20a09cf9bf5f..6ff3afef2d36 100644 --- a/msm/dp/dp_link.c +++ b/msm/dp/dp_link.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ #include "dp_link.h" @@ -1113,19 +1113,15 @@ static u8 get_link_status(const u8 link_status[DP_LINK_STATUS_SIZE], int r) */ static int dp_link_process_link_status_update(struct dp_link_private *link) { - if (!(get_link_status(link->link_status, DP_LANE_ALIGN_STATUS_UPDATED) & - DP_LINK_STATUS_UPDATED) || /* link status updated */ - (drm_dp_clock_recovery_ok(link->link_status, - link->dp_link.link_params.lane_count) && - drm_dp_channel_eq_ok(link->link_status, - link->dp_link.link_params.lane_count))) - return -EINVAL; - + bool channel_eq_done = drm_dp_channel_eq_ok(link->link_status, + link->dp_link.link_params.lane_count); + bool clock_recovery_done = drm_dp_clock_recovery_ok(link->link_status, + link->dp_link.link_params.lane_count); DP_DEBUG("channel_eq_done = %d, clock_recovery_done = %d\n", - drm_dp_channel_eq_ok(link->link_status, - link->dp_link.link_params.lane_count), - drm_dp_clock_recovery_ok(link->link_status, - link->dp_link.link_params.lane_count)); + channel_eq_done, clock_recovery_done); + + if (channel_eq_done && clock_recovery_done) + return -EINVAL; return 0; }