summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/soc_camera/ov5642.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/i2c/soc_camera/ov5642.c')
-rw-r--r--drivers/media/i2c/soc_camera/ov5642.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/media/i2c/soc_camera/ov5642.c b/drivers/media/i2c/soc_camera/ov5642.c
index 61824c6..d886c0b 100644
--- a/drivers/media/i2c/soc_camera/ov5642.c
+++ b/drivers/media/i2c/soc_camera/ov5642.c
@@ -980,29 +980,40 @@ static struct v4l2_subdev_ops ov5642_subdev_ops = {
static int ov5642_video_probe(struct i2c_client *client)
{
+ struct v4l2_subdev *subdev = i2c_get_clientdata(client);
int ret;
u8 id_high, id_low;
u16 id;
+ ret = ov5642_s_power(subdev, 1);
+ if (ret < 0)
+ return ret;
+
/* Read sensor Model ID */
ret = reg_read(client, REG_CHIP_ID_HIGH, &id_high);
if (ret < 0)
- return ret;
+ goto done;
id = id_high << 8;
ret = reg_read(client, REG_CHIP_ID_LOW, &id_low);
if (ret < 0)
- return ret;
+ goto done;
id |= id_low;
dev_info(&client->dev, "Chip ID 0x%04x detected\n", id);
- if (id != 0x5642)
- return -ENODEV;
+ if (id != 0x5642) {
+ ret = -ENODEV;
+ goto done;
+ }
- return 0;
+ ret = 0;
+
+done:
+ ov5642_s_power(subdev, 0);
+ return ret;
}
static int ov5642_probe(struct i2c_client *client,
OpenPOWER on IntegriCloud