From: Thomas Cort Date: Mon, 16 Sep 2013 23:16:12 +0000 (-0400) Subject: i2c: increase read/write timeout X-Git-Tag: v3.3.0~796 X-Git-Url: http://zhaoyanbai.com/repos/CHANGES?a=commitdiff_plain;h=cb5e2921b329d700bcdef103766c0c4ca53761b9;p=minix.git i2c: increase read/write timeout The sht21 temperature and humidity sensor holds the i2c bus while an ADC conversion is in progress. For example, a temperature measurement is requested, a read operation is started, and the sht21 doesn't respond to the read request until the result of the measurement is ready. The conversion time isn't constant. On rare occations (one in hundreds of samples) the timeout in the i2c driver expires returning an error. The example code from Sensirion, the sht21's manufacturer, suggests a bus timeout of 1 second to accommodate the sht21. This commit increases the bus timeout to 1 second. The timeout is only reached when chips do not respond normally, so the change doesn't affect the performance of any other drivers. Change-Id: I57b0f958a5d0b69b221af380b771fe67401ff604 --- diff --git a/drivers/i2c/arch/earm/omap_i2c.c b/drivers/i2c/arch/earm/omap_i2c.c index 300b6d3de..674a7fe48 100644 --- a/drivers/i2c/arch/earm/omap_i2c.c +++ b/drivers/i2c/arch/earm/omap_i2c.c @@ -319,8 +319,8 @@ omap_i2c_poll(uint16_t mask) spin_t spin; uint16_t status; - /* poll for up to 250 ms */ - spin_init(&spin, 250000); + /* poll for up to 1 s */ + spin_init(&spin, 1000000); do { status = omap_i2c_read_status(); if ((status & mask) != 0) { /* any bits in mask set */