[PATCHv2] drm/i915/dp: Change aux_ctl reg read to polling read

Arun R Murthy arun.r.murthy at intel.com
Thu Dec 1 03:49:00 UTC 2022


Signed-off-by: Arun R Murthy <arun.r.murthy at intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp_aux.c | 24 ++++++++++++---------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux.c b/drivers/gpu/drm/i915/display/intel_dp_aux.c
index 664bebdecea7..22c0a59850df 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_aux.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux.c
@@ -40,20 +40,24 @@ intel_dp_aux_wait_done(struct intel_dp *intel_dp)
 	i915_reg_t ch_ctl = intel_dp->aux_ch_ctl_reg(intel_dp);
 	const unsigned int timeout_ms = 10;
 	u32 status;
-	bool done;
-
-#define C (((status = intel_uncore_read_notrace(&i915->uncore, ch_ctl)) & DP_AUX_CH_CTL_SEND_BUSY) == 0)
-	done = wait_event_timeout(i915->display.gmbus.wait_queue, C,
-				  msecs_to_jiffies_timeout(timeout_ms));
+	int try;
 
+	for (try = 0; try < 10; try++) {
+		status = intel_uncore_read_notrace(&i915->uncore, ch_ctl);
+		if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0)
+			break;
+		msleep(1);
+	}
 	/* just trace the final value */
 	trace_i915_reg_rw(false, ch_ctl, status, sizeof(status), true);
 
-	if (!done)
-		drm_err(&i915->drm,
-			"%s: did not complete or timeout within %ums (status 0x%08x)\n",
-			intel_dp->aux.name, timeout_ms, status);
-#undef C
+	if (try == 3) {
+		status = intel_uncore_read_notrace(&i915->uncore, ch_ctl);
+		if ((status & DP_AUX_CH_CTL_SEND_BUSY) != 0)
+			drm_err(&i915->drm,
+				"%s: did not complete or timeout within %ums (status 0x%08x)\n",
+				intel_dp->aux.name, timeout_ms, status);
+	}
 
 	return status;
 }
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list