aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorRobby Cai <R63905@freescale.com>2013-09-10 22:37:07 -0400
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:05:35 -0400
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,
1877 return retval; 1877 return retval;
1878 } 1878 }
1879 1879
1880 clk_prepare_enable(ov5640_data.sensor_clk);
1881
1880 ov5640_data.io_init = ov5640_reset; 1882 ov5640_data.io_init = ov5640_reset;
1881 ov5640_data.i2c_client = client; 1883 ov5640_data.i2c_client = client;
1882 ov5640_data.pix.pixelformat = V4L2_PIX_FMT_YUYV; 1884 ov5640_data.pix.pixelformat = V4L2_PIX_FMT_YUYV;
@@ -1896,17 +1898,21 @@ static int ov5640_probe(struct i2c_client *client,
1896 1898
1897 retval = ov5640_read_reg(OV5640_CHIP_ID_HIGH_BYTE, &chip_id_high); 1899 retval = ov5640_read_reg(OV5640_CHIP_ID_HIGH_BYTE, &chip_id_high);
1898 if (retval < 0 || chip_id_high != 0x56) { 1900 if (retval < 0 || chip_id_high != 0x56) {
1901 clk_disable_unprepare(ov5640_data.sensor_clk);
1899 pr_warning("camera ov5640 is not found\n"); 1902 pr_warning("camera ov5640 is not found\n");
1900 return -ENODEV; 1903 return -ENODEV;
1901 } 1904 }
1902 retval = ov5640_read_reg(OV5640_CHIP_ID_LOW_BYTE, &chip_id_low); 1905 retval = ov5640_read_reg(OV5640_CHIP_ID_LOW_BYTE, &chip_id_low);
1903 if (retval < 0 || chip_id_low != 0x40) { 1906 if (retval < 0 || chip_id_low != 0x40) {
1907 clk_disable_unprepare(ov5640_data.sensor_clk);
1904 pr_warning("camera ov5640 is not found\n"); 1908 pr_warning("camera ov5640 is not found\n");
1905 return -ENODEV; 1909 return -ENODEV;
1906 } 1910 }
1907 1911
1908 ov5640_power_down(1); 1912 ov5640_power_down(1);
1909 1913
1914 clk_disable_unprepare(ov5640_data.sensor_clk);
1915
1910 ov5640_int_device.priv = &ov5640_data; 1916 ov5640_int_device.priv = &ov5640_data;
1911 retval = v4l2_int_device_register(&ov5640_int_device); 1917 retval = v4l2_int_device_register(&ov5640_int_device);
1912 1918