Message ID | 1312229013-8821-1-git-send-email-jbarnes@virtuousgeek.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, 1 Aug 2011 13:03:33 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> + udelay(100);
udelay isn't my favorite function to use while waiting for hardware to
clean up. Do we expect to get into this path regularly? Is it just when
hardware is broken? How many times around this loop do we go before
things work?
If we only occasionally enter this loop, and if we end up going around
several times, it seems like using msleep would be nicer to the system.
On Mon, 01 Aug 2011 13:53:59 -0700 Keith Packard <keithp@keithp.com> wrote: > On Mon, 1 Aug 2011 13:03:33 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote: > > > + udelay(100); > > udelay isn't my favorite function to use while waiting for hardware to > clean up. Do we expect to get into this path regularly? Is it just when > hardware is broken? How many times around this loop do we go before > things work? > > If we only occasionally enter this loop, and if we end up going around > several times, it seems like using msleep would be nicer to the system. We enter it enough that a sleep would be preferable (3-5 times in my testing). I'll fix it up and resend.
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 4493641..34fbe7b 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 < 10; try++) { + status = I915_READ(ch_ctl); + if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0) + break; + udelay(100); + } + + if (try == 10) { + WARN(1, "dp_aux_ch not started status 0x%08x\n", + I915_READ(ch_ctl)); return -EBUSY; }
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. 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(-)