[Meego-kernel] [PATCH] MRST Tablet camera driver ver-0.961, fix 10338
He, Yong M
yong.m.he at intel.com
Mon Jul 11 03:26:56 PDT 2011
From: Yong He <yong.m.he at intel.com>
Subject: [PATCH] MRST Tablet camera driver ver-0.961, fix 10338
Bug 10338 - [MM-camera]The color of previewing image on rear camera
is distorted after taken a shot.
there're several reasons for this issue,
A, the default preview banding setting is not correct,
B, when switch back from snapshot, banding need to be set again
C, the Exposure Window Mode Setting is incorrectly implemented
D, the sensor firmware do NOT need reset when wakeup from standby mode
They're all corrected in this patch
Signed-off-by: Yong He <yong.m.he at intel.com>
Index: linux-2.6.37/drivers/staging/mrstci/mrstov5640/ov5640.h
===================================================================
--- linux-2.6.37/drivers/staging/mrstci/mrstov5640/ov5640.h (revision 140)
+++ linux-2.6.37/drivers/staging/mrstci/mrstov5640/ov5640.h (revision 143)
@@ -3712,11 +3712,11 @@
{0x8e52, 0x29},
{0x8e53, 0x70},
{0x8e54, 0x00},
- {0x8e55, 0x3a},
+ {0x8e55, 0x00},
{0x8e56, 0x00},
{0x8e57, 0x00},
{0x8e58, 0xff},
- {0x8e59, 0x3a},
+ {0x8e59, 0x00},
{0x8e5a, 0x00},
{0x8e5b, 0x00},
{0x8e5c, 0xff},
@@ -4419,6 +4419,16 @@
{0x548d, 0xce},
{0x548e, 0xdf},
{0x548f, 0xeb},
+ /*EV 110708_01*/
+ {0x3a0f, 0x44},
+ {0x3a10, 0x3c},
+ {0x3a1b, 0x44},
+ {0x3a1e, 0x3c},
+ {0x3a11, 0x71},
+ {0x3a1f, 0x10},
+ /* De-Noise*/
+ {0x5306, 0x18},
+ {0x5308, 0x75},
{0xffff, 0xff},
};
@@ -4426,56 +4436,53 @@
static struct regval_list ov5640_reg_1080P_1_lane[] = {
/* 1080p */
{0x3008, 0x42},
- {0x3820, 0x41},
- {0x3821, 0x06},
+ {0x3820, 0x40},
+ {0x3821, 0x26},
{0x3814, 0x11},
{0x3815, 0x11},
- {0x3800, 0x01},
- {0x3801, 0x50},
- {0x3802, 0x01},
- {0x3803, 0xb2},
- {0x3804, 0x08},
- {0x3805, 0xef},
- {0x3806, 0x05},
-
- {0x3807, 0xf3},
+ {0x3800, 0x00},
+ {0x3801, 0x00},
+ {0x3802, 0x00},
+ {0x3803, 0x18},
+ {0x3804, 0x0a},
+ {0x3805, 0x3f},
+ {0x3806, 0x07},
+ {0x3807, 0x9f},
{0x3808, 0x07},
{0x3809, 0x80},
{0x380a, 0x04},
{0x380b, 0x38},
- {0x380c, 0x09},
- {0x380d, 0xc4},
- {0x380e, 0x04},
- {0x380f, 0x60},
+ {0x380c, 0x0b},
+ {0x380d, 0x1c},
+ {0x380e, 0x07},
+ {0x380f, 0xb0},
{0x3810, 0x00},
{0x3811, 0x10},
{0x3812, 0x00},
- {0x3813, 0x04},
+ {0x3813, 0xe0},
{0x3618, 0x04},
- {0x3612, 0x2b},
- {0x3708, 0x62},
+ {0x3612, 0x4b},
+ {0x3708, 0x21},
{0x3709, 0x12},
{0x370c, 0x00},
- {0x3a02, 0x04},
- {0x3a03, 0x60},
- {0x3a0e, 0x03},
- {0x3a0d, 0x04},
+ {0x3a02, 0x07},
+ {0x3a03, 0xb0},
+ {0x3a0e, 0x06},
+ {0x3a0d, 0x08},
{0x3a14, 0x07},
- {0x3a15, 0x60},
+ {0x3a15, 0xb0},
{0x4001, 0x02},
{0x4004, 0x06},
{0x3002, 0x00},
{0x3006, 0xff},
{0x3824, 0x04},
- {0x5001, 0x83},
+ {0x5001, 0xa3},
{0x3036, 0x54},
- {0x3035, 0x11},
+ {0x3035, 0x12},
{0x300e, 0x45},
{0x3108, 0x01},
{0x460c, 0x22},
{0x3824, 0x04},
- {0x4837, 0x15},
-
{0x3002, 0x1c},
{0x3006, 0xc3},
{0x3821, 0x06},
@@ -4484,12 +4491,18 @@
{0x460c, 0x20},
{0x3824, 0x04},
{0x460b, 0x37},
-
{0x300e, 0x25},
{0x3035, 0x11},
{0x3036, 0x51},
- {0x3108, 0x02},
+ {0x3108, 0x01},
{0x4837, 0x17},
+ {0x3008, 0x02},
+ {0x3a08, 0x01},
+ {0x3a09, 0x29},
+ {0x3a0a, 0x00},
+ {0x3a0b, 0xf7},
+ {0x3a0e, 0x06},
+ {0x3a0d, 0x07},
{0xffff, 0xff},
};
Index: linux-2.6.37/drivers/staging/mrstci/mrstov5640/mrstov5640.c
===================================================================
--- linux-2.6.37/drivers/staging/mrstci/mrstov5640/mrstov5640.c (revision 140)
+++ linux-2.6.37/drivers/staging/mrstci/mrstov5640/mrstov5640.c (revision 143)
@@ -50,7 +50,7 @@
#include "ci_sensor_common.h"
#include "ov5640.h"
-#define DRIVER_VERSION "0.960"
+#define DRIVER_VERSION "0.961"
#define GPIO_FLASH 45
static int ov5640_flash;
@@ -569,7 +569,6 @@
ov5640_s_stream(sd , 0);
spin_lock_irqsave(&ov5640_status.state_lock, flags);
ov5640_status.power = OV5640_POWER_OFF;
- ov5640_status.fw_inited = OV5640_FW_RESET;
if (ov5640_status.reg_inited == OV5640_REG_INITED) {
struct i2c_client *c = v4l2_get_subdevdata(sd);
@@ -847,13 +846,13 @@
/*2592x1944*/
{4219, 0x0a20, 0x0798, 0x0b1c, 0x07b0, 0x0094, 0x000d, 0x007c, 0x000f},
/*1920x1080*/
- {4219, 0x0780, 0x0438, 0x09c4, 0x04b0, 0x00a9, 0x0007, 0x008d, 0x0008},
+ {8438, 0x0780, 0x0438, 0x0b1c, 0x07b0, 0x0129, 0x0006, 0x00f7, 0x0007},
/*1600x1200*/
{8438, 0x0640, 0x04b0, 0x0b1c, 0x07b0, 0x0129, 0x0006, 0x00f7, 0x0007},
/*1280x1024*/
{8438, 0x0500, 0x0400, 0x0b1c, 0x07b0, 0x0129, 0x0006, 0x00f7, 0x0007},
/*1280x720*/
- {4219, 0x0500, 0x02d0, 0x0764, 0x02e4, 0x00df, 0x0003, 0x001a, 0x0003},
+ {4219, 0x0500, 0x02d0, 0x0764, 0x02e4, 0x00df, 0x0003, 0x00ba, 0x0003},
/*800x600*/
{9271, 0x0320, 0x0258, 0x0768, 0x03d8, 0x01e9, 0x0002, 0x0197, 0x0002},
/*640x480*/
@@ -1146,16 +1145,11 @@
ov5640_save_hw_status(client);
ret += ov5640_write_array(client, res_index->regs);
ov5640_restore_hw_status(client);
-
- /* only switch from preview (smaller than 720P) to
- * snapshot (higher than 720P) need exposure restore*/
- if (ov5640_status.current_res_i < RESOLUTION_INDEX_720P) {
- ov5640_restore_expo(sd,
- previous_res_i, target_res_index);
- ov5640_restore_gain(sd);
- ov5640_set_b_filter(sd, target_res_index);
- ov5640_af_change_res(client);
- }
+ ov5640_restore_expo(sd,
+ previous_res_i, target_res_index);
+ ov5640_restore_gain(sd);
+ ov5640_set_b_filter(sd, target_res_index);
+ ov5640_af_change_res(client);
} else {
spin_unlock_irqrestore(
&ov5640_status.state_lock, flags);
@@ -1843,10 +1837,10 @@
reg_2 = ov5640_status.ae_x & 0xff;
reg_3 = (ov5640_status.ae_y >> 8);
reg_4 = ov5640_status.ae_y & 0xff;
- reg_5 = ((ov5640_status.ae_x + ov5640_status.ae_w) >> 8);
- reg_6 = (ov5640_status.ae_x + ov5640_status.ae_w) & 0xff;
- reg_7 = ((ov5640_status.ae_y + ov5640_status.ae_h) >> 8);
- reg_8 = (ov5640_status.ae_y + ov5640_status.ae_h) & 0xff;
+ reg_5 = (ov5640_status.ae_w >> 8);
+ reg_6 = (ov5640_status.ae_w) & 0xff;
+ reg_7 = (ov5640_status.ae_h >> 8);
+ reg_8 = (ov5640_status.ae_h) & 0xff;
ret += ov5640_write(c, 0x5680, reg_1);
ret += ov5640_write(c, 0x5681, reg_2);
@@ -1869,31 +1863,19 @@
return ret;
}
-#define OV5640_EXPOSURE_NORMALIZED_W 800
-#define OV5640_EXPOSURE_NORMALIZED_H 384
-
static int ov5640_t_exposure_window(struct v4l2_subdev *sd, int value)
{
- unsigned int tmp_y, tmp_x;
int ret = 0;
u32 v = (u32)value;
dev_dbg(sd->v4l2_dev->dev, "%s (0x%08x)", __func__, v);
if (v & (1UL<<30)) {
- tmp_y = v & 0xffff;
- tmp_x = (v>>16) & 0x3fff;
- ov5640_status.ae_x = (tmp_x * OV5640_EXPOSURE_NORMALIZED_W) /
- ov5640_res[ov5640_status.current_res_i].width;
- ov5640_status.ae_y = (tmp_y * OV5640_EXPOSURE_NORMALIZED_H) /
- ov5640_res[ov5640_status.current_res_i].height;
+ ov5640_status.ae_x = (v>>16) & 0x3fff;
+ ov5640_status.ae_y = v & 0xffff;
} else {
- tmp_y = v & 0xffff;
- tmp_x = (v>>16) & 0x3fff;
- ov5640_status.ae_w = (tmp_x * OV5640_EXPOSURE_NORMALIZED_W) /
- ov5640_res[ov5640_status.current_res_i].width;
- ov5640_status.ae_h = (tmp_y * OV5640_EXPOSURE_NORMALIZED_H) /
- ov5640_res[ov5640_status.current_res_i].height;
+ ov5640_status.ae_w = (v>>16) & 0x3fff;
+ ov5640_status.ae_h = v & 0xffff;
}
return ret;
@@ -2075,44 +2057,44 @@
switch (value) {
case -2:
- reg_1 = 0x28;
- reg_2 = 0x20;
+ reg_1 = 0x34;
+ reg_2 = 0x2c;
reg_3 = 0x51;
- reg_4 = 0x28;
- reg_5 = 0x20;
+ reg_4 = 0x34;
+ reg_5 = 0x2c;
reg_6 = 0x10;
break;
case -1:
- reg_1 = 0x30;
- reg_2 = 0x28;
+ reg_1 = 0x3c;
+ reg_2 = 0x34;
reg_3 = 0x61;
- reg_4 = 0x30;
- reg_5 = 0x28;
+ reg_4 = 0x3c;
+ reg_5 = 0x34;
reg_6 = 0x10;
break;
case 1:
- reg_1 = 0x40;
- reg_2 = 0x38;
+ reg_1 = 0x4c;
+ reg_2 = 0x44;
reg_3 = 0x71;
- reg_4 = 0x40;
- reg_5 = 0x38;
+ reg_4 = 0x4c;
+ reg_5 = 0x44;
reg_6 = 0x10;
break;
case 2:
- reg_1 = 0x48;
- reg_2 = 0x40;
+ reg_1 = 0x54;
+ reg_2 = 0x4c;
reg_3 = 0x80;
- reg_4 = 0x48;
- reg_5 = 0x40;
+ reg_4 = 0x54;
+ reg_5 = 0x4c;
reg_6 = 0x20;
break;
case 0:
default:
- reg_1 = 0x38;
- reg_2 = 0x30;
- reg_3 = 0x61;
- reg_4 = 0x38;
- reg_5 = 0x30;
+ reg_1 = 0x44;
+ reg_2 = 0x3c;
+ reg_3 = 0x71;
+ reg_4 = 0x44;
+ reg_5 = 0x3c;
reg_6 = 0x10;
break;
}
Index: linux-2.6.37/drivers/staging/mrstci/mrstov9740/mrstov9740.c
===================================================================
--- linux-2.6.37/drivers/staging/mrstci/mrstov9740/mrstov9740.c (revision 140)
+++ linux-2.6.37/drivers/staging/mrstci/mrstov9740/mrstov9740.c (revision 143)
@@ -47,7 +47,7 @@
#include "ci_sensor_common.h"
#include "ov9740.h"
-#define DRIVER_VERSION "0.959"
+#define DRIVER_VERSION "0.961"
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#define DBG_entering pr_debug("%s entering", __func__);
@@ -1374,7 +1374,8 @@
break;
case OV9740_AE_MODE_AUTO:
default:
- ret += ov9740_write(c, 0x501d, 0);
+ ret += ov9740_read(c, 0x5690, ®_1);
+ ret += ov9740_write(c, 0x5690, reg_1 & 0xfe);
return ret;
}
@@ -1391,10 +1392,10 @@
reg_2 = ov9740_status.ae_x & 0xff;
reg_3 = (ov9740_status.ae_y >> 8);
reg_4 = ov9740_status.ae_y & 0xff;
- reg_5 = ((ov9740_status.ae_x + ov9740_status.ae_w) >> 8);
- reg_6 = (ov9740_status.ae_x + ov9740_status.ae_w) & 0xff;
- reg_7 = ((ov9740_status.ae_y + ov9740_status.ae_h) >> 8);
- reg_8 = (ov9740_status.ae_y + ov9740_status.ae_h) & 0xff;
+ reg_5 = (ov9740_status.ae_w >> 8);
+ reg_6 = (ov9740_status.ae_w) & 0xff;
+ reg_7 = (ov9740_status.ae_h >> 8);
+ reg_8 = (ov9740_status.ae_h) & 0xff;
ret += ov9740_write(c, 0x5680, reg_1);
ret += ov9740_write(c, 0x5681, reg_2);
@@ -1405,7 +1406,8 @@
ret += ov9740_write(c, 0x5686, reg_7);
ret += ov9740_write(c, 0x5687, reg_8);
- ret += ov9740_write(c, 0x501d, 0x10);
+ ret += ov9740_read(c, 0x5690, ®_1);
+ ret += ov9740_write(c, 0x5690, reg_1 | 0x1);
return ret;
}
@@ -1417,31 +1419,19 @@
return ret;
}
-#define OV9740_EXPOSURE_NORMALIZED_W 800
-#define OV9740_EXPOSURE_NORMALIZED_H 384
-
static int ov9740_t_exposure_window(struct v4l2_subdev *sd, int value)
{
- unsigned int tmp_y, tmp_x;
int ret = 0;
u32 v = (u32)value;
dev_dbg(sd->v4l2_dev->dev, "%s (0x%08x)", __func__, v);
if (v & (1UL<<30)) {
- tmp_y = v & 0xffff;
- tmp_x = (v>>16) & 0x3fff;
- ov9740_status.ae_x = (tmp_x * OV9740_EXPOSURE_NORMALIZED_W) /
- ov9740_res[ov9740_status.cur_res_i].width;
- ov9740_status.ae_y = (tmp_y * OV9740_EXPOSURE_NORMALIZED_H) /
- ov9740_res[ov9740_status.cur_res_i].height;
+ ov9740_status.ae_x = (v>>16) & 0x3fff;
+ ov9740_status.ae_y = v & 0xffff;
} else {
- tmp_y = v & 0xffff;
- tmp_x = (v>>16) & 0x3fff;
- ov9740_status.ae_w = (tmp_x * OV9740_EXPOSURE_NORMALIZED_W) /
- ov9740_res[ov9740_status.cur_res_i].width;
- ov9740_status.ae_h = (tmp_y * OV9740_EXPOSURE_NORMALIZED_H) /
- ov9740_res[ov9740_status.cur_res_i].height;
+ ov9740_status.ae_w = (v>>16) & 0x3fff;
+ ov9740_status.ae_h = v & 0xffff;
}
return ret;
Best Regards,
Yong He
Software Engineer, PCSD SW Solutions,
Intel Asia-Pacific R&D Ltd.
Phone (+86) 21-61166334
Lab (+86) 21-61167881
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.meego.com/pipermail/meego-kernel/attachments/20110711/05d1299a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linux-2.6.37-camera-ov5640-ov9740-version-0.960_to_0.961.patch
Type: application/octet-stream
Size: 10957 bytes
Desc: linux-2.6.37-camera-ov5640-ov9740-version-0.960_to_0.961.patch
URL: <http://lists.meego.com/pipermail/meego-kernel/attachments/20110711/05d1299a/attachment-0001.obj>
More information about the MeeGo-kernel
mailing list