From: kfx Date: Tue, 14 Feb 2012 02:58:35 +0000 (+0800) Subject: I2C: if received nak when send address, retry 3 times X-Git-Tag: firefly_0821_release~9625 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fbbf4f7a3782d624b84cb693c666a299c3a1310d;p=firefly-linux-kernel-4.4.55.git I2C: if received nak when send address, retry 3 times --- diff --git a/drivers/i2c/busses/i2c-rk29.c b/drivers/i2c/busses/i2c-rk29.c index 06aea18ad670..69af912074c8 100755 --- a/drivers/i2c/busses/i2c-rk29.c +++ b/drivers/i2c/busses/i2c-rk29.c @@ -398,7 +398,7 @@ static int rk29_send_address(struct rk29_i2c_data *i2c, if((lsr & I2C_LSR_RCV_NAK) && !(msg->flags & I2C_M_IGNORE_NAK)) { dev_info(i2c->dev, "addr: 0x%x receive no ack\n", msg->addr); - return -EINVAL; + return -EAGAIN; } if(start && (msg->flags & I2C_M_TEN)) ret = rk29_send_2nd_addr(i2c, msg, start); @@ -722,6 +722,9 @@ static int rk29_i2c_probe(struct platform_device *pdev) i2c->adap.algo = &rk29_i2c_algorithm; i2c->adap.class = I2C_CLASS_HWMON; i2c->adap.nr = pdata->bus_num; + i2c->adap.retries = 3; + i2c->adap.timeout = msecs_to_jiffies(500); + spin_lock_init(&i2c->cmd_lock); i2c->dev = &pdev->dev;