[media] media: i2c: ov2659: speedup probe if no device connected

The ov2659 driver performs device detection and initialization in the
following way:
 - send reset command REG_SOFTWARE_RESET
 - load array of predefined register's setting (~150 values)
 - read device version REG_SC_CHIP_ID_H/REG_SC_CHIP_ID_L
 - check version and exit if invalid.

As result, for not connected device there will be >~150 i2c transactions
executed before device version checking and exit (there are no
failures detected because ov2659 declared as I2C_CLIENT_SCCB and NACKs
are ignored in this case).

Let's fix that by checking the chip version first and start
initialization only if it's supported.

Cc: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
Grygorii Strashko 2015-12-21 11:54:46 -02:00 committed by Mauro Carvalho Chehab
parent d5441ea58c
commit 2e490139b1

View File

@ -1321,10 +1321,6 @@ static int ov2659_detect(struct v4l2_subdev *sd)
} }
usleep_range(1000, 2000); usleep_range(1000, 2000);
ret = ov2659_init(sd, 0);
if (ret < 0)
return ret;
/* Check sensor revision */ /* Check sensor revision */
ret = ov2659_read(client, REG_SC_CHIP_ID_H, &pid); ret = ov2659_read(client, REG_SC_CHIP_ID_H, &pid);
if (!ret) if (!ret)
@ -1338,8 +1334,10 @@ static int ov2659_detect(struct v4l2_subdev *sd)
dev_err(&client->dev, dev_err(&client->dev,
"Sensor detection failed (%04X, %d)\n", "Sensor detection failed (%04X, %d)\n",
id, ret); id, ret);
else else {
dev_info(&client->dev, "Found OV%04X sensor\n", id); dev_info(&client->dev, "Found OV%04X sensor\n", id);
ret = ov2659_init(sd, 0);
}
} }
return ret; return ret;