diff options
| author | Mohsan Habibi <mohsan@motorola.com> | 2014-07-09 19:57:53 -0400 |
|---|---|---|
| committer | Mohsan Habibi <mohsan@motorola.com> | 2014-07-15 20:46:19 +0000 |
| commit | 7cb82f0204f4607988c1e3c88069978eb71fbb95 (patch) | |
| tree | 845e60da9590b5101708077720252a1028851ede | |
| parent | 54f749c6467379305aaa11ebf9274629aaa3d6e7 (diff) | |
| download | olio-linux-3.10-7cb82f0204f4607988c1e3c88069978eb71fbb95.tar.xz olio-linux-3.10-7cb82f0204f4607988c1e3c88069978eb71fbb95.zip | |
IKXCLOCK-2689 i2c: omap: reduce timeout and don't wait after transfer complete
Such a long timeout of 1s for a transfer to finish or wait for the
bus to become free causes an i2c client to become blocked for at
least 2s, if the attached slave is misbehaving. This timeout can
be reduced to 500ms; 500ms is plenty long enough for a single i2c
transfer to finish even in clock stretching cases.
Also, after an i2c transfer is complete, there's no benefit in
waiting for the bus to become ready, since the check will be done
again just before the next transfer.
Finally, in case the bus never gets freed, let's return an error
immediately after clearing the bus, regardless if the recovery
was successful. This will allow the i2c client to try the transfer
again on its own terms, instead of having the i2c driver attempt
to proceed with the transfer immediately after the recovery.
Change-Id: I6bc950948bd012aae4c3029b9c00603354a938fa
Signed-off-by: Mohsan Habibi <mohsan@motorola.com>
| -rw-r--r-- | drivers/i2c/busses/i2c-omap.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 1592dc0dc81..0e15ad357aa 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -56,7 +56,7 @@ #define OMAP_I2C_REV_ON_4430_PLUS 0x50400002 /* timeout waiting for the controller to respond */ -#define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000)) +#define OMAP_I2C_TIMEOUT (msecs_to_jiffies(500)) /* For OMAP3 I2C_IV has changed to I2C_WE (wakeup enable) */ enum { @@ -695,6 +695,13 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) if (r < 0) { dev_err(dev->dev, "Unable to recover i2c bus from bb\n"); goto out; + } else { + /* Even if bus successfully cleared up, return an error + * and abort transfer, to allow the i2c client to retry + * the transfer on its own terms. + */ + r = -EREMOTEIO; + goto out; } } @@ -733,8 +740,6 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) if (r == 0) r = num; - omap_i2c_wait_for_bb(dev); - pm_qos_update_request(&dev->pm_qos_request, PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE); |