Hi Mauro, Thanks for the review. On Thu, Nov 05, 2020 at 12:34:13PM +0100, Mauro Carvalho Chehab wrote: > Em Wed, 7 Oct 2020 11:44:59 +0300 > Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> escreveu: ... > > diff --git a/drivers/media/i2c/ccs/ccs-reg-access.c b/drivers/media/i2c/ccs/ccs-reg-access.c > > index aad2727570ec..9fda16b221a7 100644 > > --- a/drivers/media/i2c/ccs/ccs-reg-access.c > > +++ b/drivers/media/i2c/ccs/ccs-reg-access.c > > @@ -236,12 +236,38 @@ int ccs_read_addr_noconv(struct ccs_sensor *sensor, u32 reg, u32 *val) > > return ccs_read_addr_raw(sensor, reg, val, false, true, false); > > } > > > > +static int ccs_write_retry(struct i2c_client *client, struct i2c_msg *msg) > > +{ > > + unsigned int retries; > > + int r; > > + > > + for (retries = 0; retries < 5; retries++) { > > + /* > > + * Due to unknown reason sensor stops responding. This > > + * loop is a temporaty solution until the root cause > > + * is found. > > + */ > > + r = i2c_transfer(client->adapter, msg, 1); > > + if (r != 1) { > > + usleep_range(2000, 2000); > > Huh? Does it need to sleep precisely for 2000 us? I believe this one does not, indeed. I'll make it a range, but add a separate patch for it as this patch just moves the code form one place to another. -- Sakari Ailus