UPSTREAM: drm/i915/intel_i2c: always wait for IDLE before clearing NAK
authorDaniel Kurtz <djkurtz@chromium.org>
Fri, 30 Mar 2012 11:46:38 +0000 (19:46 +0800)
committerGrant Grundler <grundler@google.com>
Thu, 24 May 2012 22:13:19 +0000 (15:13 -0700)
commit4e31e5ecbbcbb30d0f4c769c9e88555f28eac1b6
tree120ba3c36bd99faa63432f86b3f32bae6fa40683
parent75763e3134ddb25e3e750d0a2119b921fa6fd366
UPSTREAM: drm/i915/intel_i2c: always wait for IDLE before clearing NAK

The GMBUS controller can report a NAK condition while a transaction is
still active. If the driver is fast enough, and the bus is slow enough,
the driver may clear the NAK condition while the controller is still
busy, resulting in a confused GMBUS controller.  This will leave the
controller in a bad state such that the next transaction may fail.

Also, return -ENXIO if a device NAKs a transaction.

Note: this patch also refactors gmbus_xfer to remove the "done" label.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit e646d5773572bf52017983d758bdf05777dc5600)

Change-Id: Ib8be3789c0bada08946ed510b13f931a83473e54
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
drivers/gpu/drm/i915/intel_i2c.c