diff mbox

drm/i915/dp: wait for previous AUX channel activity to clear

Message ID 1312233275-10843-1-git-send-email-jbarnes@virtuousgeek.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jesse Barnes Aug. 1, 2011, 9:14 p.m. UTC
Before initiating a new read or write on the DP AUX channel, wait for
any outstanding activity to complete.  This may happen during normal
retry behavior.  If the wait fails (i.e. after 1ms the AUX channel is
still busy) dump a backtrace to make the caller easier to spot.

v2: use msleep instead, and timeout after 3ms (only ever saw 1 retry
    with msleep in testing)

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=38136.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_dp.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

Comments

Keith Packard Aug. 1, 2011, 9:42 p.m. UTC | #1
On Mon,  1 Aug 2011 14:14:35 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:

> +	for (try = 0; try < 3; try++) {
> +		status = I915_READ(ch_ctl);
> +		if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0)
> +			break;
> +		msleep(1);
> +	}
> +
> +	if (try == 10) {

10 != 3
Jesse Barnes Aug. 1, 2011, 10 p.m. UTC | #2
On Mon, 01 Aug 2011 14:42:25 -0700
Keith Packard <keithp@keithp.com> wrote:

> On Mon,  1 Aug 2011 14:14:35 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> 
> > +	for (try = 0; try < 3; try++) {
> > +		status = I915_READ(ch_ctl);
> > +		if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0)
> > +			break;
> > +		msleep(1);
> > +	}
> > +
> > +	if (try == 10) {
> 
> 10 != 3

Oh well that will make the backtrace silent, won't it...
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 4493641..de570ce 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -315,9 +315,17 @@  intel_dp_aux_ch(struct intel_dp *intel_dp,
 	else
 		precharge = 5;
 
-	if (I915_READ(ch_ctl) & DP_AUX_CH_CTL_SEND_BUSY) {
-		DRM_ERROR("dp_aux_ch not started status 0x%08x\n",
-			  I915_READ(ch_ctl));
+	/* Try to wait for any previous AUX channel activity */
+	for (try = 0; try < 3; try++) {
+		status = I915_READ(ch_ctl);
+		if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0)
+			break;
+		msleep(1);
+	}
+
+	if (try == 10) {
+		WARN(1, "dp_aux_ch not started status 0x%08x\n",
+		     I915_READ(ch_ctl));
 		return -EBUSY;
 	}