media: ccs: Wait until software reset is done
Verify the software reset has been completed until proceeding. The spec does not guarantee a delay but presumably 100 ms should be enough. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
e1988e7ad0
commit
51fc72e541
|
@ -1553,11 +1553,26 @@ static int ccs_power_on(struct device *dev)
|
|||
*/
|
||||
|
||||
if (!sensor->reset && !sensor->xshutdown) {
|
||||
u8 retry = 100;
|
||||
u32 reset;
|
||||
|
||||
rval = ccs_write(sensor, SOFTWARE_RESET, CCS_SOFTWARE_RESET_ON);
|
||||
if (rval < 0) {
|
||||
dev_err(dev, "software reset failed\n");
|
||||
goto out_cci_addr_fail;
|
||||
}
|
||||
|
||||
do {
|
||||
rval = ccs_read(sensor, SOFTWARE_RESET, &reset);
|
||||
reset = !rval && reset == CCS_SOFTWARE_RESET_OFF;
|
||||
if (reset)
|
||||
break;
|
||||
|
||||
usleep_range(1000, 2000);
|
||||
} while (--retry);
|
||||
|
||||
if (!reset)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (sensor->hwcfg.i2c_addr_alt) {
|
||||
|
|
Loading…
Reference in New Issue