]> Pileus Git - ~andy/linux/commit
drm/i915/intel_i2c: use WAIT cycle, not STOP
authorDaniel Kurtz <djkurtz@chromium.org>
Fri, 30 Mar 2012 11:46:39 +0000 (19:46 +0800)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 12 Apr 2012 19:14:07 +0000 (21:14 +0200)
commit72d66afd1461effb143784a0f6cde2a9f9908b70
tree29f0f2117a8705112860a371e089070f24022041
parente646d5773572bf52017983d758bdf05777dc5600
drm/i915/intel_i2c: use WAIT cycle, not STOP

The i915 is only able to generate a STOP cycle (i.e. finalize an i2c
transaction) during a DATA or WAIT phase.  In other words, the
controller rejects a STOP requested as part of the first transaction in a
sequence.

Thus, for the first transaction we must always use a WAIT cycle, detect
when the device has finished (and is in a WAIT phase), and then either
start the next transaction, or, if there are no more transactions,
generate a STOP cycle.

Note: Theoretically, the last transaction of a multi-transaction sequence
could initiate a STOP cycle.  However, this slight optimization is left
for another patch.  We return -ETIMEDOUT if the hardware doesn't
deactivate after the STOP cycle.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
[danvet: added comment to the code that gmbus can't generate STOP on
the very first cycle.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_i2c.c