1.有的时候读写的时候,从设备的反应时间不见得那么快 ,所以经常会出现i2c读写概率性的超时失败。特别是一次读写很多个byte的时候
所以需要将i2c中的超时等待时间调大一点。但是调太大的话会影响单次i2c的传输速率
2.i2c driver中有个retry操作,对于每次写单个byte都会概率性的出现i2c失败显示超时,即没有收到ack,那么不妨在设置retry次数为2.即当每次失败的时候
在重新发送或者读写一次。已降低发生i2c超时的概率
case I2C_RETRIES:
client->adapter->retries = arg;
break;
case I2C_TIMEOUT:
/* For historical reasons, user-space sets the timeout
* value in units of 10 ms.
*/
client->adapter->timeout = msecs_to_jiffies(arg * 10);
break;