]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
drm/i915: use the gmbus irq for waits
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Sat, 1 Dec 2012 12:53:45 +0000 (13:53 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 6 Dec 2012 12:14:37 +0000 (13:14 +0100)
commit28c70f162a315bdcfbe0bf940a740ef8bfb918d6
treeddfa342c2b509942f5c526d9b5fdde6b09c2c7e0
parent515ac2bb95f609bc4a0d2ad5f7011b3264b2bb21
drm/i915: use the gmbus irq for waits

We need two special things to properly wire this up:
- Add another argument to gmbus_wait_hw_status to pass in the
  correct interrupt bit in gmbus4.
- Since we can only get an irq for one of the two events we want,
  hand-roll the wait_event_timeout code so that we wake up every
  jiffie and can check for NAKs. This way we also subsume gmbus
  support for platforms without interrupts (or where those are not
  yet enabled).

The important bit really is to only enable one gmbus interrupt source
at the same time - with that piece of lore figured out, this seems to
work flawlessly.

Ben Widawsky rightfully complained the lack of measurements for the
claimed benefits (especially since the first version was actually
broken and fell back to bit-banging). Previously reading the 256 byte
hdmi EDID takes about 72 ms here. With this patch it's down to 33 ms.
Given that transfering the 256 bytes over i2c at wire speed takes
20.5ms alone, the reduction in additional overhead is rather nice.

v2: Chris Wilson wondered whether GMBUS4 might contain some set bits
when booting up an hence result in some spurious interrupts. Since we
clear GMBUS4 after every wait and we do gmbus transfer really early in
the setup sequence to detect displays the window is small, but still
be paranoid and clear it properly.

v3: Clarify the comment that gmbus irq generation can only support one
kind of event, why it bothers us and how we work around that limit.

Cc: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/intel_i2c.c