]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00216008 ov5642: Add exposure calculation when set mode
authorYuxi Sun <b36102@freescale.com>
Fri, 6 Jul 2012 09:29:03 +0000 (17:29 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:34:59 +0000 (08:34 +0200)
Originally only QSXGA mode use exposure calculation, now we enable
this function on every mode to fix image dark problem.

Signed-off-by: Yuxi Sun <b36102@freescale.com>
drivers/media/video/mxc/capture/ov5642.c

index 52e4f3bdaa5858d7907dce91e05601b23aae162a..2488658623cfd003534c81ba01784bd70c507be3 100644 (file)
@@ -3085,7 +3085,8 @@ err:
 }
 static int ov5642_init_mode(enum ov5642_frame_rate frame_rate,
                enum ov5642_mode mode);
-static int ov5642_write_snapshot_para(void);
+static int ov5642_write_snapshot_para(enum ov5642_frame_rate frame_rate,
+               enum ov5642_mode mode);
 static int ov5642_change_mode(enum ov5642_frame_rate new_frame_rate,
                enum ov5642_frame_rate old_frame_rate,
                enum ov5642_mode new_mode,
@@ -3107,13 +3108,6 @@ static int ov5642_change_mode(enum ov5642_frame_rate new_frame_rate,
        }
 
        if ((new_frame_rate == old_frame_rate) &&
-           (new_mode == ov5642_mode_QSXGA_2592_1944) &&
-               (orig_mode == ov5642_mode_VGA_640_480)) {
-               ov5642_data.pix.width = 2592;
-               ov5642_data.pix.height = 1944;
-               retval = ov5642_write_snapshot_para();
-               return retval;
-       } else if ((new_frame_rate == old_frame_rate) &&
            (new_mode == ov5642_mode_VGA_640_480) &&
                (orig_mode == ov5642_mode_QSXGA_2592_1944)) {
                pModeSetting = ov5642_setting_QSXGA_2_VGA;
@@ -3128,7 +3122,7 @@ static int ov5642_change_mode(enum ov5642_frame_rate new_frame_rate,
                ov5642_data.pix.width = 320;
                ov5642_data.pix.height = 240;
        } else {
-               retval = ov5642_init_mode(new_frame_rate, new_mode);
+               retval = ov5642_write_snapshot_para(new_frame_rate, new_mode);
                goto err;
        }
 
@@ -3226,7 +3220,8 @@ err:
        return retval;
 }
 
-static int ov5642_write_snapshot_para(void)
+static int ov5642_write_snapshot_para(enum ov5642_frame_rate frame_rate,
+       enum ov5642_mode mode)
 {
        bool m_60Hz = false;
        u16 capture_frame_rate = 50;
@@ -3255,7 +3250,7 @@ static int ov5642_write_snapshot_para(void)
        gain = 0;
        ov5642_read_reg(0x350b, &gain);
 
-       ov5642_init_mode(ov5642_15_fps, ov5642_mode_QSXGA_2592_1944);
+       ov5642_init_mode(frame_rate, mode);
        ret_h = ret_m = ret_l = 0;
        ov5642_read_reg(0x380e, &ret_h);
        ov5642_read_reg(0x380f, &ret_l);