lkml.org 
[lkml]   [2012]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 06/10 v2] drm/i915/intel_i2c: return -ENXIO for device NAK
Date
Return -ENXIO if a device NAKs a transaction.

Note: We should return -ETIMEDOUT, too if the transaction times out,
however, that error path is currently handled by the 'bit-bang fallback'.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
---
drivers/gpu/drm/i915/intel_i2c.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index 232b7cb..151b828 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -242,6 +242,7 @@ gmbus_xfer(struct i2c_adapter *adapter,
adapter);
struct drm_i915_private *dev_priv = adapter->algo_data;
int i, reg_offset;
+ int ret = 0;

if (bus->force_bit)
return intel_i2c_quirk_xfer(dev_priv,
@@ -333,6 +334,15 @@ clear_err:
I915_WRITE(GMBUS1 + reg_offset, GMBUS_SW_CLR_INT);
I915_WRITE(GMBUS1 + reg_offset, 0);

+ /*
+ * If no ACK is received during the address phase of a transaction,
+ * the adapter must report -ENXIO.
+ * It is not clear what to return if no ACK is received at other times.
+ * So, we always return -ENXIO in all NAK cases, to ensure we send
+ * it at least during the one case that is specified.
+ */
+ ret = -ENXIO;
+
done:
/* Mark the GMBUS interface as disabled. We will re-enable it at the
* start of the next xfer, till then let it sleep.
@@ -341,7 +351,7 @@ done:

mutex_unlock(&dev_priv->gmbus_mutex);

- return i;
+ return ret ?: i;

timeout:
DRM_INFO("GMBUS timed out, falling back to bit banging on pin %d [%s]\n",
--
1.7.7.3


\
 
 \ /
  Last update: 2012-03-09 19:51    [W:0.107 / U:0.172 seconds]
©2003-2014 Jasper Spaans. Advertise on this site