summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorRobby Cai <R63905@freescale.com>2013-09-11 10:37:07 +0800
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 08:05:35 -0500
commitf80294d77168833ecaa8faaf099564d84163dc2f (patch)
tree25281c1ab849e3236f97841ab62214c2222429d1 /drivers/media
parentc736ac09a85320c30d4724f377a7b1d7dc8f08f0 (diff)
ENGR00279087-1 camera: enable mclk before read the camera ID
When the camera driver is built as module and done 'insmod' command, the camera will not be detected. The error message is as follows. $ insmod ov5640_camera.ko ov5640 2-003c: cannot get io voltage ov5640_read_reg:write reg error:reg=300a camera ov5640 is not found The reason is the mclk need to be enabled before read camera registers. This patch fixes it. To balance the usecount for the mclk, we need disable the mclk afterwards. Signed-off-by: Robby Cai <R63905@freescale.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/mxc/capture/ov5640.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/platform/mxc/capture/ov5640.c b/drivers/media/platform/mxc/capture/ov5640.c
index cfb86ed3b565..4759b9a478ce 100644
--- a/drivers/media/platform/mxc/capture/ov5640.c
+++ b/drivers/media/platform/mxc/capture/ov5640.c
@@ -1877,6 +1877,8 @@ static int ov5640_probe(struct i2c_client *client,
return retval;
}
+ clk_prepare_enable(ov5640_data.sensor_clk);
+
ov5640_data.io_init = ov5640_reset;
ov5640_data.i2c_client = client;
ov5640_data.pix.pixelformat = V4L2_PIX_FMT_YUYV;
@@ -1896,17 +1898,21 @@ static int ov5640_probe(struct i2c_client *client,
retval = ov5640_read_reg(OV5640_CHIP_ID_HIGH_BYTE, &chip_id_high);
if (retval < 0 || chip_id_high != 0x56) {
+ clk_disable_unprepare(ov5640_data.sensor_clk);
pr_warning("camera ov5640 is not found\n");
return -ENODEV;
}
retval = ov5640_read_reg(OV5640_CHIP_ID_LOW_BYTE, &chip_id_low);
if (retval < 0 || chip_id_low != 0x40) {
+ clk_disable_unprepare(ov5640_data.sensor_clk);
pr_warning("camera ov5640 is not found\n");
return -ENODEV;
}
ov5640_power_down(1);
+ clk_disable_unprepare(ov5640_data.sensor_clk);
+
ov5640_int_device.priv = &ov5640_data;
retval = v4l2_int_device_register(&ov5640_int_device);