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)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 12 Apr 2012 19:14:07 +0000 (21:14 +0200)
commite646d5773572bf52017983d758bdf05777dc5600
tree62faf9f29abac026e1250b9ba6b75e24dcd7056f
parent7a39a9d4767e8d22d60f2c4bf5eece4f4398c274
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>
drivers/gpu/drm/i915/intel_i2c.c