From 25cf4819baf1c9a8151fb452073e4c5ce3a5306f Mon Sep 17 00:00:00 2001 From: ddl Date: Tue, 24 Apr 2012 15:40:22 +0800 Subject: [PATCH] camera: ov2659 add some delay after init or capture, init array and svga array add some change --- drivers/media/video/ov2659.c | 297 ++++++++++++++++++++++++++++++++++- 1 file changed, 294 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/ov2659.c b/drivers/media/video/ov2659.c index 29dcb243d6ea..3b2b4d1286b0 100755 --- a/drivers/media/video/ov2659.c +++ b/drivers/media/video/ov2659.c @@ -263,6 +263,224 @@ static struct reginfo sensor_init_data[] = {0x5062, 0x7d}, {0x5063, 0x69}, {0x3004, 0x20}, + + //add for 800*600 sida + +{0x0103,0x01}, +{0x3000,0x0f}, +{0x3001,0xff}, +{0x3002,0xff}, +{0x0100,0x01}, +{0x3633,0x3d}, +{0x3620,0x02}, +{0x3631,0x11}, +{0x3612,0x04}, +{0x3630,0x20}, +{0x4702,0x02}, +{0x370c,0x34}, + + //output format 800x600 +{0x3800,0x00}, +{0x3801,0x00}, +{0x3802,0x00}, +{0x3803,0x00}, +{0x3804,0x06}, +{0x3805,0x5f}, +{0x3806,0x04}, +{0x3807,0xb7}, +{0x3808,0x03}, //800 +{0x3809,0x20}, // +{0x380a,0x02}, //600 +{0x380b,0x58}, // +{0x3811,0x08}, +{0x3813,0x02}, +{0x3814,0x31}, +{0x3815,0x31}, + + //mirror and flip +{0x3820,0x81}, //87 +{0x3821,0x01}, //07 +{0x5002,0x10}, +{0x4608,0x00}, +{0x4609,0xa0}, + +{0x3623,0x00}, +{0x3634,0x76}, +{0x3701,0x44}, +{0x3702,0x18}, +{0x3703,0x24}, +{0x3704,0x24}, +{0x3705,0x0c}, +{0x370a,0x52}, + + //frame rate +{0x3003,0x80}, +{0x3004,0x20}, +{0x3005,0x18}, +{0x3006,0x0d}, + +{0x380c,0x05}, //dummy pixels +{0x380d,0x14}, // +{0x380e,0x02}, //dummy lines +{0x380f,0xe3}, // + //banding +{0x3a08,0x00}, +{0x3a09,0x5c}, //50hz +{0x3a0a,0x00}, +{0x3a0b,0x4d}, //60hz +{0x3a0d,0x06}, //60hz step +{0x3a0e,0x07}, //50hz step + +{0x350c,0x00}, +{0x350d,0x00}, +{0x4300,0x30}, +{0x5086,0x02}, +{0x5000,0xfb}, +{0x5001,0x1f}, +{0x507e,0x3c}, //saturation +{0x507f,0x3c}, +{0x507c,0x80}, +{0x507d,0x00}, +{0x507a,0x10}, +{0x507b,0x02}, + //gamma +{0x5025,0x06}, +{0x5026,0x0c}, +{0x5027,0x19}, +{0x5028,0x34}, +{0x5029,0x4a}, +{0x502a,0x5a}, +{0x502b,0x67}, +{0x502c,0x71}, +{0x502d,0x7c}, +{0x502e,0x8c}, +{0x502f,0x9b}, +{0x5030,0xa9}, +{0x5031,0xc0}, +{0x5032,0xd5}, +{0x5033,0xe8}, +{0x5034,0x20}, + + //color matrix +{0x5070,0x28}, //1c +{0x5071,0x48}, //53 +{0x5072,0x10}, //05 +{0x5073,0x10}, +{0x5074,0xd4}, +{0x5075,0xe4}, +{0x5076,0xc8}, +{0x5077,0xe4}, +{0x5078,0x1c}, +{0x5079,0x98}, +{0x507a,0x00}, +//AWB +{0x5035,0x68}, +{0x5036,0x11}, +{0x5037,0x92}, +{0x5038,0x21}, +{0x5039,0xe1}, +{0x503a,0x01}, +{0x503c,0x10}, +{0x503d,0x08}, +{0x503e,0x08}, +{0x503f,0x5c}, +{0x5040,0x6c}, +{0x5041,0x0e}, +{0x5042,0x1c}, +{0x5043,0x2e}, +{0x5044,0x52}, +{0x5045,0x3c}, +{0x5046,0x45}, +{0x5047,0xf8}, +{0x5048,0x08}, +{0x5049,0x70}, +{0x504a,0xf0}, +{0x504b,0xf0}, + + //lens shading +{0x5000,0xfb}, +{0x500c,0x03}, +{0x500d,0x18}, +{0x500e,0x02}, +{0x500f,0x80}, +{0x5010,0x26}, +{0x5011,0x00}, +{0x5012,0x66}, +{0x5013,0x03}, +{0x5014,0x18}, +{0x5015,0x02}, +{0x5016,0x70}, +{0x5017,0x20}, +{0x5018,0x00}, +{0x5019,0x66}, +{0x501a,0x02}, +{0x501b,0xe8}, +{0x501c,0x02}, +{0x501d,0x66}, +{0x501e,0x1e}, +{0x501f,0x00}, +{0x5020,0x66}, +{0x506e,0x46}, +{0x5064,0x08}, +{0x5065,0x10}, +{0x5066,0x18}, +{0x5067,0x08}, +{0x506c,0x08}, +{0x506d,0x10}, +{0x506f,0xa6}, +{0x5068,0x08}, +{0x5069,0x10}, +{0x506a,0x06}, +{0x506b,0x10}, +{0x5084,0x0c}, +{0x5085,0x36}, +{0x5005,0x80}, + + //AEC +{0x3a0f,0x38}, +{0x3a10,0x30}, +{0x3a11,0x70}, +{0x3a1b,0x38}, +{0x3a1e,0x30}, +{0x3a1f,0x20}, + +{0x5060,0x69}, +{0x5061,0x7d}, +{0x5062,0x7d}, +{0x5063,0x69}, +{0x3004,0x20}, + +{0x3a19,0x38}, +{0x4009,0x0c}, + +{0x506e,0x00}, +{0x5064,0x08}, +{0x5065,0x10}, +{0x5066,0x12}, +{0x5067,0x02}, +{0x506c,0x08}, +{0x506d,0x10}, +{0x506e,0x46}, +{0x506f,0x1f}, + + //AEC and AGC +{0x3503,0x00}, //00 on;03 off + //AWB +{0x3406,0x00}, // 00 on;01 off + +//night mode +//50hz +{0x3a00,0x3c},//;78 off;7c on +{0x3a05,0x30},//50hz flag +{0x3a14,0x05}, +{0x3a15,0xc6}, +//60hz +//60 3a00 7c;78 off;7c on +//60 3a05 b0;60hz flag +//60 3a02 02 +//60 3a03 e3 + + {0x0100, 0x01}, {0x0000, 0x00} }; @@ -439,7 +657,11 @@ static struct reginfo sensor_720p[]= /* 1600X1200 UXGA */ static struct reginfo sensor_uxga[] = { - {0x3800, 0x00}, + {0x0100, 0x00}, + + {0x3406, 0x01}, + + {0x3800, 0x00}, {0x3801, 0x00}, {0x3802, 0x00}, {0x3803, 0x00}, @@ -484,6 +706,10 @@ static struct reginfo sensor_uxga[] = {0x5002, 0x00}, {0x3005, 0x24}, {0x3004, 0x20}, + + //wqs add + {0x0100, 0x01}, //software sleep : Sensor vsync singal may not output if haven't sleep the sensor when transfer the array, + {0x0000, 0x00} }; @@ -500,6 +726,7 @@ static struct reginfo sensor_xga[] = /* 800X600 SVGA*/ static struct reginfo sensor_svga[] = { +#if 0 {0x0100, 0x00}, //software sleep : Sensor vsync singal may not output if haven't sleep the sensor when transfer the array, {0x3800, 0x00}, {0x3801, 0x00}, @@ -548,6 +775,69 @@ static struct reginfo sensor_svga[] = {0x3004, 0x20}, {0x0100, 0x01}, //software wake {0x0000, 0x00} +#else + +{0x0100, 0x00}, //software sleep : Sensor vsync singal may not output if haven't sleep the sensor when transfer the array, + +// {0x3406, 0x01}, //wqs + +{0x3800,0x00}, +{0x3801,0x00}, +{0x3802,0x00}, +{0x3803,0x00}, +{0x3804,0x06}, +{0x3805,0x5f}, +{0x3806,0x04}, +{0x3807,0xb7}, +{0x3808,0x03}, //;800 +{0x3809,0x20}, +{0x380a,0x02}, //600 +{0x380b,0x58}, +{0x3811,0x08}, +{0x3813,0x02}, +{0x3814,0x31}, +{0x3815,0x31}, + +{0x3820,0x81}, +{0x3821,0x01}, +{0x5002,0x00}, +{0x4608,0x00}, +{0x4609,0x80}, + +{0x3623,0x00}, +{0x3634,0x76}, +{0x3701,0x44}, +{0x3702,0x18}, +{0x3703,0x24}, +{0x3704,0x24}, +{0x3705,0x0c}, +{0x370a,0x52}, + + //Frame rate +{0x3003,0x80}, +{0x3004,0x20}, +{0x3005,0x18}, +{0x3006,0x0d}, + +{0x380c,0x05}, //dummy pixels(default=1300) +{0x380d,0x14}, +{0x380e,0x02}, //dummy lines(default=616) +{0x380f,0xe3}, + //banding +{0x3a02,0x02}, +{0x3a03,0xe3}, +{0x3a08,0x00}, +{0x3a09,0x5c}, //50hz +{0x3a0a,0x00}, +{0x3a0b,0x4d}, //60hz +{0x3a0d,0x06}, //60hz step +{0x3a0e,0x07}, //50hz step +{0x3a14,0x02}, +{0x3a15,0xa3}, + + {0x0100, 0x01}, //software wake + {0x0000, 0x00} +#endif }; /* 640X480 VGA */ @@ -1694,7 +1984,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val) if (qctrl) sensor->info_priv.flash = qctrl->default_value; #endif - + msleep(800); SENSOR_DG("\n%s..%s.. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),((val == 0)?__FUNCTION__:"sensor_reinit"),icd->user_width,icd->user_height); sensor->info_priv.funmodule_state |= SENSOR_INIT_IS_OK; return 0; @@ -1723,7 +2013,7 @@ static int sensor_deactivate(struct i2c_client *client) sensor_task_lock(client, 0); } sensor_ioctrl(icd, Sensor_PowerDown, 1); - msleep(100); + msleep(10); /* ddl@rock-chips.com : sensor config init width , because next open sensor quickly(soc_camera_open -> Try to configure with default parameters) */ icd->user_width = SENSOR_INIT_WIDTH; @@ -1987,6 +2277,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_DO_WHITE_BALANCE); sensor_set_whiteBalance(icd, qctrl,sensor->info_priv.whiteBalance); } + msleep(600); sensor->info_priv.snap2preview = true; } else if (sensor_fmt_videochk(sd,mf) == true) { /* ddl@rock-chips.com : Video */ qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_EFFECT); -- 2.34.1