[Meego-kernel] [PATCH] MRST Tablet camera driver ver-0.952, fix 9891
Kristen Carlson Accardi
kristen at linux.intel.com
Tue Jun 21 09:45:20 PDT 2011
On Tue, 21 Jun 2011 17:12:21 +0800
"He, Yong M" <yong.m.he at intel.com> wrote:
>
> From: Yong He <yong.m.he at intel.com>
> Subject: [PATCH] MRST Tablet camera driver ver-0.952, fix 9891
>
> Hi Kristen,
>
> Please help to review the patch. Thanks a lot!
> The patching sequence is
>
> linux-2.6.37-camera-debug-printk-ov9740.patch (already in)
> linux-2.6.37-camera-debug-printk-ov5640.patch
> linux-2.6.37-camera-ov5640-ov9740-version-0.95_to_0.951.patch
> then
> linux-2.6.37-camera-ov5640-ov9740-version-0.951_to_0.952.patch
Hi Yong, I just had a question about your locking, below.
>
> ----
> Bug 9891<https://bugzilla.otcshare.org/show_bug.cgi?id=9891> - Bad picture quality of front camera caused by incorrect exposure settings
>
> Resolution:
> 1, save auto-exposure & gain settings when doing preview.
> 2, Switch from preview to capture mode (larger resolution)
> 3, calculate new exposure settings according to the new resolution.
>
> Signed-off-by: Yong He <yong.m.he at intel.com>
> Index: linux-2.6.37/drivers/staging/mrstci/mrstov9740/mrstov9740.c
> ===================================================================
> --- linux-2.6.37/drivers/staging/mrstci/mrstov9740/mrstov9740.c (revision 109)
> +++ linux-2.6.37/drivers/staging/mrstci/mrstov9740/mrstov9740.c (working copy)
> @@ -48,7 +48,7 @@
> #include "ci_sensor_common.h"
> #include "ov9740.h"
> -#define DRIVER_VERSION "0.941"
> +#define DRIVER_VERSION "0.952"
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> #define DBG_entering pr_debug("%s entering", __func__);
> @@ -124,7 +124,46 @@
> #define N_RES (ARRAY_SIZE(ov9740_res))
> +struct ov9740_exp_info_1_t {
> + uint16_t ho;
> + uint16_t vo;
> + uint16_t gain16;
> + uint32_t shutter16;
> +};
> +
> +struct ov9740_exp_info_2_t {
> + uint8_t iso;
> + uint8_t lightfreq;
> +};
> +
> /*
> + * 2 -- VGA index in the array ov9740_res[],
> + * which is the default resolution setting
> + */
> +#define RESOLUTION_INDEX_VGA 2
> +
> +static struct __ov9740_status_ {
> + /* lock */
> + spinlock_t state_lock;
> +
> + /* sw status*/
> + int cur_res_i;
> +
> + /* hw status*/
> + int hflip, vflip;
> +
> + /* exposure status */
> + struct ov9740_exp_info_1_t snapshot;
> + struct ov9740_exp_info_1_t preview;
> + struct ov9740_exp_info_2_t expo;
> +} ov9740_status = {
> + .state_lock = __SPIN_LOCK_UNLOCKED(),
> + .cur_res_i = RESOLUTION_INDEX_VGA,
> + .hflip = 0,
> + .vflip = 0,
> +};
> +
> +/*
> * I2C Read & Write stuff
> */
> static int ov9740_read(struct i2c_client *c, u16 reg, u8 *value)
> @@ -221,6 +260,43 @@
> */
> return ret;
> }
> +
> +static int ov9740_set_aec_agc(struct i2c_client *c, int on)
> +{
> + int ret = 0;
> + struct v4l2_subdev *sd = i2c_get_clientdata(c);
> + dev_dbg(sd->v4l2_dev->dev, "ov9740_set_aec_agc: (%d)", on);
> +
> + if (on)
> + ret = ov9740_write(c, 0x3503, 0x00);
> + else
> + ret = ov9740_write(c, 0x3503, 0x03);
> +
> + return ret;
> +}
> +
> +static int ov9740_hw_init(struct i2c_client *c)
> +{
> + int ret;
> + unsigned long flags;
> + DBG_entering;
> +
> + spin_lock_irqsave(&ov9740_status.state_lock, flags);
> + ov9740_status.cur_res_i = RESOLUTION_INDEX_VGA;
> + spin_unlock_irqrestore(&ov9740_status.state_lock, flags);
> +
> + /* Set registers into default config value */
> + ret = ov9740_write_array(c, ov9740_def);
> + ret += ov9740_write_array(c, ov9740_reg_vga);
> + ov9740_write(c, 0x0100, 0x00);
> + ov9740_set_data_pin_in(c);
> + ret += ov9740_set_aec_agc(c, 1);
> + msleep(100);
> +
> + DBG_leaving;
> + return ret;
> +}
> +
> /*
> * Sensor specific helper function
> */
> @@ -282,21 +358,10 @@
> info->cie_profile = 0;
> memcpy(info->name, "ov9740", 7);
> - //
> - // added
> - // ret = ov9740_write(c, OV9740_SYS, 0x80);
> /* Set registers into default config value */
> - ret = ov9740_write_array(c, ov9740_def);
> - ret += ov9740_write_array(c, ov9740_reg_vga);
> + ret = ov9740_hw_init(c);
> - /* added by wen to stop sensor from streaming */
> - // ov9740_write(c, 0x3086, 0x0f);
> - // commented out in workshop
> - //
> -/// ov9740_set_data_pin_in(c);
> - ssleep(1);
> -
> - DBG_leaving;
> + DBG_leaving;
> return ret;
> }
> @@ -420,8 +485,8 @@
> return index;
> }
> -
> -static uint8_t find_OV9740_TIMING_index(int res) {
> +static uint8_t find_ov9740_res_index(int res)
> +{
> uint8_t index;
> switch (res) {
> @@ -444,11 +509,273 @@
> return index;
> }
> -static int previous_res = 2;//SENSOR_RES_VGA;
> +struct ov9740_setting_tbl_t {
> + uint32_t sysclk;
> + uint16_t REG_034cw;
> + uint16_t REG_034ew;
> + uint16_t REG_0342w;
> + uint16_t REG_0340w;
> +
> + uint16_t REG_3a08w;
> + uint16_t REG_3a0aw;
> + uint8_t REG_3a0e;
> + uint8_t REG_3a0d;
> +} __attribute__((packed));
> +
> +const struct ov9740_setting_tbl_t const ov9740_setting_ext[8] = {
> + /*1280x720*/
> + {3792, 0x0500, 0x02d0, 0x0662, 0x0307, 0x0074, 0x0060, 0x06, 0x08},
> + /*800x600*/
> + {3792, 0x0320, 0x0258, 0x0662, 0x0307, 0x0074, 0x0060, 0x06, 0x08},
> + /*640x480*/
> + {7583, 0x0280, 0x01e0, 0x0662, 0x0307, 0x00e8, 0x00c1, 0x03, 0x04},
> + /*320x240*/
> + {7583, 0x0140, 0x00f0, 0x0662, 0x0307, 0x00e8, 0x00c1, 0x03, 0x04},
> +};
> +
> +static int ov9740_set_b_filter(struct v4l2_subdev *sd, uint8_t idx)
> +{
> + uint16_t val;
> + int ret = 0;
> + struct i2c_client *c = v4l2_get_subdevdata(sd);
> +
> + /*50hz*/
> + val = ((ov9740_setting_ext[idx].REG_3a08w>>8)&0x03);
> + ret += ov9740_write(c, 0x3a08, val);
> + val = ov9740_setting_ext[idx].REG_3a08w&0xFF;
> + ret += ov9740_write(c, 0x3a09, val);
> +
> + /*60hz*/
> + val = ((ov9740_setting_ext[idx].REG_3a0aw>>8)&0x03);
> + ret += ov9740_write(c, 0x3a0a, val);
> + val = ov9740_setting_ext[idx].REG_3a0aw&0xFF;
> + ret += ov9740_write(c, 0x3a0b, val);
> +
> + val = ((ov9740_setting_ext[idx].REG_3a0e));
> + ret += ov9740_write(c, 0x3a0e, val);
> + val = ov9740_setting_ext[idx].REG_3a0d;
> + ret += ov9740_write(c, 0x3a0d, val);
> +
> + /* Set Gain Limit */
> + ret += ov9740_write(c, 0x3a18, 0x01);
> + ret += ov9740_write(c, 0x3a19, 0xfc);
> +
> + dev_dbg(sd->v4l2_dev->dev,
> + "ov9740_set_b_filter: ov9740_setting_ext[%d]."
> + "REG_3a08w <- 0x%x", idx,
> + ov9740_setting_ext[idx].REG_3a08w);
> + dev_dbg(sd->v4l2_dev->dev,
> + "ov9740_set_b_filter: ov9740_setting_ext[%d]."
> + "REG_3a0aw <- 0x%x", idx,
> + ov9740_setting_ext[idx].REG_3a0aw);
> +
> + return ret;
> +}
> +
> +static int ov9740_save_expo_val(struct v4l2_subdev *sd)
are the accesses to ov9740_status in the below save/restore routines
safe from race conditions? Does your caller need to hold a lock prior
to calling these routines?
> +{
> + uint8_t val;
> + uint32_t shutter16;
> + uint16_t gain16;
> + int ret = 0;
> + struct i2c_client *c = v4l2_get_subdevdata(sd);
> +
> + /*Shutter*/
> + ret += ov9740_read(c, 0x0202, &val);
> + shutter16 = val&0x0F;
> + shutter16 <<= 8;
> + ret += ov9740_read(c, 0x0203, &val);
> + shutter16 += val;
> +
> + /*Gain*/
> + ret += ov9740_read(c, 0x0204, &val);
> + gain16 = val&0x03;
> + gain16 <<= 8;
> + ret += ov9740_read(c, 0x0205, &val);
> + gain16 += val;
> +
> + ov9740_status.preview.gain16 = gain16;
> + ov9740_status.preview.shutter16 = shutter16;
> +
> + /*lightfreq*/
> + ret += ov9740_read(c, 0x3C0C, &val);
> + if ((val&0x01) == 1)
> + ov9740_status.expo.lightfreq = 50;
> + else
> + ov9740_status.expo.lightfreq = 60;
> +
> + dev_dbg(sd->v4l2_dev->dev, "ov9740_save_expo_val: "
> + "ov9740_status.preview.gain16 -> 0x%x",
> + ov9740_status.preview.gain16);
> + dev_dbg(sd->v4l2_dev->dev, "ov9740_save_expo_val: "
> + "ov9740_status.preview.shutter16 -> 0x%x",
> + ov9740_status.preview.shutter16);
> + dev_dbg(sd->v4l2_dev->dev, "ov9740_save_expo_val: "
> + "ov9740_status.expo.lightfreq -> 0x%x",
> + ov9740_status.expo.lightfreq);
> +
> + return ret;
> +}
> +
> +static long long local_do_div(long long x, long long y)
> +{
> + unsigned long mod;
> + mod = do_div(x, y);
> + return x;
> +}
> +
> +static int ov9740_restore_gain(struct v4l2_subdev *sd)
> +{
> + struct i2c_client *c = v4l2_get_subdevdata(sd);
> + uint16_t val;
> + int ret = 0;
> +
> + val = ov9740_status.snapshot.gain16&0xFF;
> + ret += ov9740_write(c, 0x0205, val);
> + val = (ov9740_status.snapshot.gain16>>8);
> + ret += ov9740_write(c, 0x0204, val);
> + dev_dbg(sd->v4l2_dev->dev, "ov9740_set_gain: ov9740_status.snapshot"
> + ".gain16 <- 0x%x", ov9740_status.snapshot.gain16);
> +
> + return ret;
> +}
> +
> +static int ov9740_restore_expo(struct v4l2_subdev *sd,
> + uint8_t pre_idx, uint8_t cap_idx)
> +{
> + uint64_t x, y;
> + uint64_t exposure;
> + uint32_t bandwidth;
> + uint32_t frmbandlinesmax;
> + uint32_t shutter, frmshuttermax;
> + uint16_t gain16, maxgain16;
> + uint16_t val;
> + struct i2c_client *c = v4l2_get_subdevdata(sd);
> + int ret = 0;
> +
> + if (ov9740_status.preview.gain16 < 16)
> + return -1;
> +
> + if (ov9740_status.preview.shutter16 < 16)
> + return -1;
> +
> + if (ov9740_status.expo.lightfreq < 1)
> + return -1;
> +
> + x = ov9740_setting_ext[pre_idx].REG_0342w;
> + x *= ov9740_status.preview.gain16;
> + x *= (ov9740_status.preview.shutter16/16);
> +
> + y = ov9740_setting_ext[cap_idx].REG_0342w;
> + dev_dbg(sd->v4l2_dev->dev,
> + "ov9740_restore_expo: x = 0x%Lx, y = 0x%Lx", x, y);
> + dev_dbg(sd->v4l2_dev->dev,
> + "ov9740_status.preview.gain16 = 0x%x,"
> + "ov9740_status.preview.shutter16 = 0x%x",
> + ov9740_status.preview.gain16,
> + ov9740_status.preview.shutter16);
> +
> + x = (x*ov9740_setting_ext[cap_idx].sysclk + 8)>>4;
> + y = (y*ov9740_setting_ext[pre_idx].sysclk + 8)>>4;
> +
> + dev_dbg(sd->v4l2_dev->dev,
> + "ov9740_restore_expo: x2 = 0x%Lx, y2 = 0x%Lx", x, y);
> + exposure = do_div(x, y);
> + exposure = x;
> + dev_dbg(sd->v4l2_dev->dev,
> + "ov9740_restore_expo: exposure = 0x%Lx", exposure);
> +
> + maxgain16 = 0x01fc; /* 32x */
> + ret += ov9740_write(c, 0x3a18, 0x01);
> + ret += ov9740_write(c, 0x3a19, 0xfc);
> +
> + if (ov9740_status.expo.lightfreq == 60) {
> + bandwidth = ov9740_setting_ext[cap_idx].REG_3a0aw;
> + frmbandlinesmax =
> + bandwidth*ov9740_setting_ext[cap_idx].REG_3a0d;
> + } else {
> + bandwidth = ov9740_setting_ext[cap_idx].REG_3a08w;
> + frmbandlinesmax =
> + bandwidth*ov9740_setting_ext[cap_idx].REG_3a0e;
> + }
> +
> + if (exposure < 16) {
> + /* smaller than 1 line*/
> + shutter = 1;
> + gain16 = 16;
> + } else if (exposure < (bandwidth*16)) {
> + /* smaller than 1 banding*/
> + gain16 = 16;
> + shutter = ((exposure+8)>>4);
> + } else {
> + if (exposure < (frmbandlinesmax*16)) {
> + /* smaller than 1 frame*/
> + x = exposure;
> + y = (bandwidth*16);
> + shutter = (uint32_t)local_do_div(x, y);
> + shutter *= bandwidth;
> +
> + x = exposure+shutter/2;
> + y = shutter;
> + gain16 = (uint16_t)local_do_div(x, y);
> + } else {
> + /* larger than 1 frame*/
> + shutter = frmbandlinesmax;
> + x = exposure+shutter/2;
> + y = shutter;
> + gain16 = (uint16_t)local_do_div(x, y);
> + if (gain16 > maxgain16) {
> + /* larger than maxim gain & frame*/
> + x = exposure +
> + ((uint32_t)maxgain16)*(bandwidth-1);
> + y = maxgain16*bandwidth;
> + shutter = (uint32_t)local_do_div(x, y);
> + shutter *= bandwidth;
> + x = exposure;
> + y = shutter;
> + gain16 = (uint32_t)local_do_div(x, y);
> + }
> + }
> + }
> +
> + ov9740_status.snapshot.shutter16 = shutter*16;
> + ov9740_status.snapshot.gain16 = gain16;
> +
> + frmshuttermax = ov9740_setting_ext[cap_idx].REG_0340w-1;
> +
> + if (frmshuttermax <= shutter) {
> + if (shutter > 2*frmshuttermax) {
> + frmshuttermax *= 2;
> + shutter = frmshuttermax-4;
> + } else {
> + frmshuttermax = shutter+4;
> + }
> + val = frmshuttermax&0xFF;
> + ret += ov9740_write(c, 0x0341, val);
> + val = frmshuttermax>>8;
> + ret += ov9740_write(c, 0x0340, val);
> + }
> +
> + val = (ov9740_status.snapshot.shutter16&0xFF);
> + ret += ov9740_write(c, 0x0203, val);
> + val = ((ov9740_status.snapshot.shutter16>>8)&0xFF);
> + ret += ov9740_write(c, 0x0202, val);
> +
> + dev_dbg(sd->v4l2_dev->dev, "ov9740_restore_expo: "
> + "frmshuttermax <- 0x%x",
> + frmshuttermax);
> + dev_dbg(sd->v4l2_dev->dev, "ov9740_restore_expo: "
> + "ov9740_status.preview.shutter16 <- 0x%x",
> + ov9740_status.snapshot.shutter16);
> +
> + return ret;
> +}
> +
> static int ov9740_set_fmt(struct v4l2_subdev *sd,
> struct v4l2_mbus_framefmt *fmt)
> {
> + unsigned long flags;
> struct i2c_client *client = v4l2_get_subdevdata(sd);
> struct ci_sensor_config *info = to_sensor_config(sd);
> int ret = 0;
> @@ -470,17 +797,26 @@
> if (res_index->regs) {
> uint8_t target_res_index;
> - target_res_index = find_OV9740_TIMING_index(res_index->res);
> + target_res_index = find_ov9740_res_index(res_index->res);
> + spin_lock_irqsave(&ov9740_status.state_lock, flags);
> - if (previous_res != target_res_index) {
> + if (ov9740_status.cur_res_i != target_res_index) {
> + int previous_res_i = ov9740_status.cur_res_i;
> + ov9740_status.cur_res_i = target_res_index;
> + spin_unlock_irqrestore(
> + &ov9740_status.state_lock, flags);
> dev_dbg(sd->v4l2_dev->dev,
> "changing res from index-%d to index-%d (%dx%d)",
> - previous_res, target_res_index, width, height);
> - dev_dbg(sd->v4l2_dev->dev, "Set Resolution Configs");
> + previous_res_i, target_res_index, width, height);
> ret += ov9740_write_array(client, res_index->regs);
> - previous_res = target_res_index;
> + ov9740_restore_gain(sd);
> + ov9740_restore_expo(sd,
> + previous_res_i, target_res_index);
> + ov9740_set_b_filter(sd, target_res_index);
> }
> else {
> + spin_unlock_irqrestore(
> + &ov9740_status.state_lock, flags);
> dev_dbg(sd->v4l2_dev->dev,
> "same res index-%d (%dx%d)",
> target_res_index, width, height);
> @@ -813,9 +1149,12 @@
> dev_dbg(sd->v4l2_dev->dev,
> "set stream on, sleep 300 ms for sensor adjusting...\n");
> ov9740_write(client, 0x0100, 0x01);
> + ov9740_set_aec_agc(client, 1);
> msleep(300);
> }
> } else {
> + ov9740_set_aec_agc(client, 0);
> + ov9740_save_expo_val(sd);
> ov9740_write(client, 0x0100, 0x00);
> }
> @@ -894,16 +1233,17 @@
> target_fps = param->parm.capture.timeperframe.denominator / param->parm.capture.timeperframe.numerator;
> - if (ov9740_res[previous_res].used) {
> + if (ov9740_res[ov9740_status.cur_res_i].used) {
> for (fps_i = 0; fps_i < OV9740_N_FPS; fps_i++) {
> - if (target_fps == ov9740_res[previous_res].fps[fps_i]) {
> + if (target_fps == ov9740_res[ov9740_status.cur_res_i].fps[fps_i]) {
> // found the target fps
> u8 val;
> dev_dbg(sd->v4l2_dev->dev, "set sensor FPS to %d\n", target_fps);
> ov9740_read(client, 0x0100, &val);
> if (val == 0x01) ov9740_s_stream(sd, 0);
> - target_vts = (ov9740_vts_setting[previous_res] * ov9740_res[previous_res].fps[0]) / target_fps;
> + target_vts = (ov9740_vts_setting[ov9740_status.cur_res_i] *
> + ov9740_res[ov9740_status.cur_res_i].fps[0]) / target_fps;
> ov9740_write(client, 0x0340, (target_vts>>8)&0xff);
> ov9740_write(client, 0x0341, target_vts&0xff);
> @@ -921,7 +1261,7 @@
> } else {
> dev_dbg(sd->v4l2_dev->dev,
> "Warning!! current_res (%d) is not used??\n",
> - previous_res);
> + ov9740_status.cur_res_i);
> }
> DBG_leaving;
> Index: linux-2.6.37/drivers/staging/mrstci/mrstov9740/ov9740.h
> ===================================================================
> --- linux-2.6.37/drivers/staging/mrstci/mrstov9740/ov9740.h (revision 109)
> +++ linux-2.6.37/drivers/staging/mrstci/mrstov9740/ov9740.h (working copy)
> @@ -67,7 +67,7 @@
> {0x0348 , 0x05},
> {0x0349 , 0x0c},
> {0x034a , 0x02},
> - {0x034b , 0xd8},
> + {0x034b , 0xd9},
> {0x034c , 0x05},
> {0x034d , 0x00},
> {0x034e , 0x02},
> @@ -358,15 +358,10 @@
> {0x5848 , 0x02},
> {0x5849 , 0xcc},
> - // Start streaming
> - {0x0100 , 0x01}, // start streaming
> -
> {0xffff, 0xff},
> };
> static struct regval_list ov9740_reg_720p[] = {
> - //OV9740 DVP 1280*720 15FPS
> -
> -// {0x0101 , 0x01},
> + /*OV9740 DVP 1280*720 15FPS*/
> {0x3104 , 0x20},
> {0x0305 , 0x03},
> {0x0307 , 0x5b},
> @@ -384,7 +379,7 @@
> {0x0348 , 0x05},
> {0x0349 , 0x0c},
> {0x034a , 0x02},
> - {0x034b , 0xd8},
> + {0x034b , 0xd9},
> {0x034c , 0x05},
> {0x034d , 0x00},
> {0x034e , 0x02},
> @@ -404,27 +399,24 @@
> {0x381a , 0x00},
> {0x5001 , 0xff},
> {0x5003 , 0xff},
> - {0x501e , 0x05}, // Scale X input
> - {0x501f , 0x00}, // Scale X input
> - {0x5020 , 0x02}, // Scale Y input
> - {0x5021 , 0xd0}, // Scale Y input
> + {0x501e , 0x05}, /* Scale X input*/
> + {0x501f , 0x00}, /* Scale X input*/
> + {0x5020 , 0x02}, /* Scale Y input*/
> + {0x5021 , 0xd0}, /* Scale Y input*/
> {0x530d , 0x06},
> - {0x0100 , 0x01},
> {0xffff, 0xff},
> };
> static struct regval_list ov9740_reg_svga[] = {
> - //OV9740 DVP 800x600 15FPS
> -
> -// {0x0101 , 0x01}, // Orientation
> + /*OV9740 DVP 800x600 15FPS*/
> {0x3104 , 0x20},
> {0x0305 , 0x03},
> {0x0307 , 0x5b},
> {0x0303 , 0x01},
> {0x0301 , 0x0a},
> {0x3010 , 0x01},
> - {0x300e , 0x12}, // Timing setting
> + {0x300e , 0x12}, /* Timing setting*/
> {0x0340 , 0x03},
> {0x0341 , 0x07},
> {0x0342 , 0x06},
> @@ -436,7 +428,7 @@
> {0x0348 , 0x04},
> {0x0349 , 0x67},
> {0x034a , 0x02},
> - {0x034b , 0xd8},
> + {0x034b , 0xd9},
> {0x034c , 0x03},
> {0x034d , 0x20},
> {0x034e , 0x02},
> @@ -455,28 +447,25 @@
> {0x4608 , 0x02},
> {0x4609 , 0x70},
> {0x5001 , 0xff},
> - {0x5003 , 0xff}, // Scaling
> - {0x501e , 0x03}, // Scale X input
> - {0x501f , 0xc0}, // Scale X input
> - {0x5020 , 0x02}, // Scale Y input
> - {0x5021 , 0xd0}, // Scale Y input
> + {0x5003 , 0xff}, /* Scaling*/
> + {0x501e , 0x03}, /* Scale X input*/
> + {0x501f , 0xc0}, /* Scale X input*/
> + {0x5020 , 0x02}, /* Scale Y input*/
> + {0x5021 , 0xd0}, /* Scale Y input*/
> {0x530d , 0x06},
> - {0x0100 , 0x01},
> {0xffff, 0xff},
> };
> static struct regval_list ov9740_reg_vga[] = {
> - //OV9740 DVP 640x480 30FPS
> -
> -// {0x0101 , 0x01}, // Orientation
> + /*OV9740 DVP 640x480 30FPS*/
> {0x3104 , 0x20},
> {0x0305 , 0x03},
> {0x0307 , 0x5b},
> {0x0303 , 0x01},
> {0x0301 , 0x0a},
> {0x3010 , 0x01},
> - {0x300e , 0x12}, // Timing setting
> + {0x300e , 0x12}, /* Timing setting*/
> {0x0340 , 0x03},
> {0x0341 , 0x07},
> {0x0342 , 0x06},
> @@ -488,7 +477,7 @@
> {0x0348 , 0x04},
> {0x0349 , 0x67},
> {0x034a , 0x02},
> - {0x034b , 0xd8},
> + {0x034b , 0xd9},
> {0x034c , 0x02},
> {0x034d , 0x80},
> {0x034e , 0x01},
> @@ -503,29 +492,25 @@
> {0x4608 , 0x02},
> {0x4609 , 0x70},
> {0x5001 , 0xff},
> - {0x5003 , 0xff}, // Scaling
> - {0x501e , 0x03}, // Scale X input
> - {0x501f , 0xc0}, // Scale X input
> - {0x5020 , 0x02}, // Scale Y input
> - {0x5021 , 0xd0}, // Scale Y input
> + {0x5003 , 0xff}, /* Scaling*/
> + {0x501e , 0x03}, /* Scale X input*/
> + {0x501f , 0xc0}, /* Scale X input*/
> + {0x5020 , 0x02}, /* Scale Y input*/
> + {0x5021 , 0xd0}, /* Scale Y input*/
> {0x530d , 0x06},
> - {0x0100 , 0x01},
> -
> {0xffff, 0xff},
> };
> static struct regval_list ov9740_reg_qvga[] = {
> - //OV9740 DVP 320x240 30FPS
> -
> -// {0x0101 , 0x01}, // Orientation
> + /*OV9740 DVP 320x240 30FPS*/
> {0x3104 , 0x20},
> {0x0305 , 0x03},
> {0x0307 , 0x5b},
> {0x0303 , 0x01},
> {0x0301 , 0x0a},
> {0x3010 , 0x01},
> - {0x300e , 0x12}, // Timing setting
> + {0x300e , 0x12}, /* Timing setting*/
> {0x0340 , 0x03},
> {0x0341 , 0x07},
> {0x0342 , 0x06},
> @@ -537,7 +522,7 @@
> {0x0348 , 0x04},
> {0x0349 , 0x67},
> {0x034a , 0x02},
> - {0x034b , 0xd8},
> + {0x034b , 0xd9},
> {0x034c , 0x01},
> {0x034d , 0x40},
> {0x034e , 0x00},
> @@ -552,25 +537,24 @@
> {0x4608 , 0x02},
> {0x4609 , 0x70},
> {0x5001 , 0xff},
> - {0x5003 , 0xff}, // Scaling
> - {0x501e , 0x03}, // Scale X input
> - {0x501f , 0xc0}, // Scale X input
> - {0x5020 , 0x02}, // Scale Y input
> - {0x5021 , 0xd0}, // Scale Y input
> + {0x5003 , 0xff}, /* Scaling*/
> + {0x501e , 0x03}, /* Scale X input*/
> + {0x501f , 0xc0}, /* Scale X input*/
> + {0x5020 , 0x02}, /* Scale Y input*/
> + {0x5021 , 0xd0}, /* Scale Y input*/
> {0x530d , 0x06},
> - {0x0100 , 0x01},
> {0xffff, 0xff},
> };
> static u32 ov9740_vts_setting[] = {
> - // 1280x720
> + /* 1280x720*/
> 0x307,
> - // 800x600
> + /* 800x600*/
> 0x307,
> - // 640x480
> + /* 640x480*/
> 0x307,
> - // 320x240
> + /* 320x240*/
> 0x307,
> };
>
>
> Best Regards,
>
> Yong He
> Software Engineer, PCSD SW Solutions,
> Intel Asia-Pacific R&D Ltd.
> Phone (+86) 21-61166334
> Lab (+86) 21-61167881
>
More information about the MeeGo-kernel
mailing list