]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ENGR00279087-1 camera: enable mclk before read the camera ID
authorRobby Cai <R63905@freescale.com>
Wed, 11 Sep 2013 02:37:07 +0000 (10:37 +0800)
committerJason Liu <r64343@freescale.com>
Wed, 30 Oct 2013 01:55:38 +0000 (09:55 +0800)
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>
drivers/media/platform/mxc/capture/ov5640.c

index cfb86ed3b565e41241c8aac70776446bfcddf933..4759b9a478cea5d4c50f7dfdb2d6164f34d8792f 100644 (file)
@@ -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);