summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby Cai <R63905@freescale.com>2013-09-11 10:37:07 +0800
committerRobby Cai <R63905@freescale.com>2013-09-11 13:44:52 +0800
commitd2ab9a5df42f3e7a3ed00fafca88951998b7850e (patch)
tree4090d46c68485733ff557a39485400f841026875
parente3b1104d47533c6735702062bac4d54c5a0690ac (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>
-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);