Skip to content

Commit

Permalink
i2c-bcm2708: Increase timeouts to allow larger transfers
Browse files Browse the repository at this point in the history
Use the timeout value provided by the I2C_TIMEOUT ioctl when waiting
for completion. The default timeout is 1 second.

See: #260
  • Loading branch information
Phil Elwell committed Jun 30, 2015
1 parent 133d5c1 commit 285fcbb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/i2c/busses/i2c-bcm2708.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@
#define BSC_S_DONE 0x00000002
#define BSC_S_TA 0x00000001

#define I2C_TIMEOUT_MS 150
#define I2C_WAIT_LOOP_COUNT 40
#define I2C_WAIT_LOOP_COUNT 200

#define DRV_NAME "bcm2708_i2c"
#define DRV_NAME "bcm2708_i2c"

static unsigned int baudrate = CONFIG_I2C_BCM2708_BAUDRATE;
module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
Expand Down Expand Up @@ -305,7 +304,7 @@ static int bcm2708_i2c_master_xfer(struct i2c_adapter *adap,
goto error_timeout;
}

ret = wait_for_completion_timeout(&bi->done, msecs_to_jiffies(I2C_TIMEOUT_MS));
ret = wait_for_completion_timeout(&bi->done, adap->timeout);
if (ret == 0) {
dev_err(&adap->dev, "transfer timed out\n");
goto error_timeout;
Expand Down

0 comments on commit 285fcbb

Please sign in to comment.