camera: update gc2035 and sp2518 driver, 2035 fix some module may output error
authorddl <ddl@rock-chips.com>
Fri, 8 Mar 2013 09:58:48 +0000 (17:58 +0800)
committerddl <ddl@rock-chips.com>
Fri, 8 Mar 2013 09:59:05 +0000 (17:59 +0800)
drivers/media/video/gc2035.c [changed mode: 0644->0755]
drivers/media/video/sp2518.c

old mode 100644 (file)
new mode 100755 (executable)
index 8bbf543..68bd092
@@ -46,14 +46,14 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define SENSOR_NAME RK29_CAM_SENSOR_GC2035\r
 #define SENSOR_V4L2_IDENT  V4L2_IDENT_GC2035\r
 #define SENSOR_ID 0x2035\r
-#define SENSOR_MIN_WIDTH    640\r
-#define SENSOR_MIN_HEIGHT   480\r
+#define SENSOR_MIN_WIDTH    800\r
+#define SENSOR_MIN_HEIGHT   600\r
 #define SENSOR_MAX_WIDTH    1600\r
 #define SENSOR_MAX_HEIGHT   1200\r
-#define SENSOR_INIT_WIDTH      640                     /* Sensor pixel size for sensor_init_data array */\r
-#define SENSOR_INIT_HEIGHT  480\r
-#define SENSOR_INIT_WINSEQADR sensor_vga\r
-#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_UYVY8_2X8\r
+#define SENSOR_INIT_WIDTH        800                   /* Sensor pixel size for sensor_init_data array */\r
+#define SENSOR_INIT_HEIGHT  600\r
+#define SENSOR_INIT_WINSEQADR sensor_svga\r
+#define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8\r
 \r
 #define CONFIG_SENSOR_WhiteBalance     1\r
 #define CONFIG_SENSOR_Brightness       0\r
@@ -68,7 +68,7 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define CONFIG_SENSOR_Mirror        0\r
 #define CONFIG_SENSOR_Flip          0\r
 \r
-#define CONFIG_SENSOR_I2C_SPEED     250000       /* Hz */\r
+#define CONFIG_SENSOR_I2C_SPEED     100000       /* Hz */\r
 /* Sensor write register continues by preempt_disable/preempt_enable for current process not be scheduled */\r
 #define CONFIG_SENSOR_I2C_NOSCHED   0\r
 #define CONFIG_SENSOR_I2C_RDWRCHK   0\r
@@ -109,1314 +109,687 @@ static enum hrtimer_restart flash_off_func(struct hrtimer *timer);
 \r
 static struct  flash_timer flash_off_timer;\r
 //for user defined if user want to customize the series , zyc\r
-#ifdef CONFIG_GC2035_USER_DEFINED_SERIES\r
-#include "gc2035_user_series.c"\r
-#else\r
+\r
 /* init 352X288 SVGA */\r
 static struct reginfo sensor_init_data[] ={\r
-{0xfe,0x80},\r
-{0xfe,0x80},\r
-{0xfe,0x80},\r
-{0xfe,0x80},\r
-{0xfc,0x06},\r
-{0xf9,0xfe}, //[0] pll enable\r
-{0xfa,0x00},\r
-{0xf6,0x00},\r
-{0xf7,0x17}, //pll enable\r
-{0xf8,0x00},\r
-{0xfe,0x00},\r
-{0x82,0x00},\r
-{0xb3,0x60},\r
-{0xb4,0x40},\r
-{0xb5,0x60},\r
-{0x03,0x05},\r
-{0x04,0x2e},\r
-\r
-//measure window\r
-{0xfe,0x00},\r
-{0xec,0x04},\r
-{0xed,0x04},\r
-{0xee,0x60},\r
-{0xef,0x90},\r
-\r
-\r
-\r
-{0x0a,0x00}, //row start\r
-{0x0c,0x00}, //col start\r
-\r
-{0x0d,0x04},\r
-{0x0e,0xc0},\r
-{0x0f,0x06}, //Window setting\r
-{0x10,0x58},// \r
-\r
-{0x17,0x14}, //[0]mirror [1]flip\r
-{0x18,0x0a}, //sdark 4 row in even frame??\r
-{0x19,0x0a}, //AD pipe number\r
-\r
-{0x1a,0x01}, //CISCTL mode4\r
-{0x1b,0x48},\r
-{0x1e,0x88}, //analog mode1 [7] tx-high en\r
-{0x1f,0x0f}, //analog mode2\r
-\r
-{0x20,0x05}, //[0]adclk mode  [1]rowclk_MODE [2]rsthigh_en\r
-{0x21,0x0f}, //[3]txlow_en\r
-{0x22,0xf0}, //[3:0]vref\r
-{0x23,0xc3}, //f3//ADC_r\r
-{0x24,0x16}, //pad drive\r
-\r
-//==============================aec\r
-//AEC\r
-{0xfe,0x01},\r
-{0x09,0x00},\r
-\r
-{0x11,0x10},\r
-{0x47,0x30},\r
-{0x0b,0x90},\r
-{0x13,0x85}, //0x75 0x80\r
-{0x1f,0xc0},//addd\r
-{0x20,0x56},//add  0x60\r
-{0xfe,0x00},\r
-{0xf7,0x17}, //pll enable\r
-{0xf8,0x00},\r
-{0x05,0x01},\r
-{0x06,0x18},\r
-{0x07,0x00},\r
-{0x08,0x48},\r
-{0xfe,0x01},\r
-{0x27,0x00},\r
-{0x28,0x6a},\r
-{0x29,0x03},\r
-{0x2a,0x50},//8fps\r
-{0x2b,0x04},\r
-{0x2c,0xf8},\r
-{0x2d,0x06},\r
-{0x2e,0xa0},//6fps\r
-{0x3e,0x00},//0x40                   \r
-{0xfe,0x00},           \r
-{0xb6,0x03}, //AEC enable\r
-{0xfe,0x00},\r
-\r
-///////BLK\r
-\r
-{0x3f,0x00}, //prc close???\r
-{0x40,0x77}, // a7 77\r
-{0x42,0x7f},\r
-{0x43,0x2b},//0x30 \r
-\r
-{0x5c,0x08},\r
-//{0x6c  3a //manual_offset ,real B channel\r
-//{0x6d  3a//manual_offset ,real B channel\r
-//{0x6e  36//manual_offset ,real R channel\r
-//{0x6f  36//manual_offset ,real R channel\r
-{0x5e,0x1f},//0x20\r
-{0x5f,0x1f},//0x20\r
-{0x60,0x20},\r
-{0x61,0x20},\r
-{0x62,0x20},\r
-{0x63,0x20},\r
-{0x64,0x20},\r
-{0x65,0x20},\r
-{0x66,0x20},\r
-{0x67,0x20},\r
-{0x68,0x20},\r
-{0x69,0x20},\r
-\r
-/////crop// \r
-{0x90,0x01},  //crop enable\r
-{0x95,0x04},  //1600x1200\r
-{0x96,0xb0},\r
-{0x97,0x06},\r
-{0x98,0x40},\r
-\r
-{0xfe,0x03},\r
-{0x42,0x80}, \r
-{0x43,0x06}, //output buf width //buf widthÕâÒ»¿éµÄÅäÖû¹ÐèÒª¸ãÇå³þ\r
-{0x41,0x00}, // delay\r
-{0x40,0x00}, //fifo half full trig\r
-{0x17,0x01}, //wid mipi²¿·ÖµÄ·ÖƵÊÇΪʲôv£¿\r
-{0xfe,0x00},\r
+       {0xfe , 0x80},\r
+       {0xfe , 0x80},\r
+       {0xfe , 0x80},  \r
+       {0xfc , 0x06},\r
+       {0xf2 , 0x00},\r
+       {0xf3 , 0x00},\r
+       {0xf4 , 0x00},\r
+       {0xf5 , 0x00},\r
+       {0xf9 , 0xfe}, //[0] pll enable\r
+       {0xfa , 0x00},\r
+       {0xf6 , 0x00},\r
+       {0xf7 , 0x15}, //pll enable\r
+\r
+       {0xf8 , 0x85},\r
+       {0xfe , 0x00},\r
+       {0x82 , 0x00},\r
+       {0xb3 , 0x60},\r
+       {0xb4 , 0x40},\r
+       {0xb5 , 0x60},\r
 \r
-{0x80,0xff},//block enable 0xff\r
-{0x81,0x26},//38  //skin_Y 8c_debug\r
-\r
-{0x03,0x05},\r
-{0x04,0x2e}, \r
-{0x84,0x00}, //output put foramat\r
-{0x86,0x03}, //sync plority\r
-{0x87,0x80}, //middle gamma on\r
-{0x8b,0xbc},//debug modeÐèÒª¸ãÇå³þÒ»ÏÂ\r
-{0xa7,0x80},//B_channel_gain\r
-{0xa8,0x80},//B_channel_gain\r
-{0xb0,0x80}, //globle gain\r
-{0xc0,0x40},\r
-\r
-#if 0\r
-//lsc,\r
-{0xfe,0x01},\r
-{0xc2,0x3a},\r
-{0xc3,0x27},\r
-{0xc4,0x21},\r
-{0xc8,0x2a},\r
-{0xc9,0x2a},\r
-{0xca,0x1b},\r
-{0xbc,0x4d},\r
-{0xbd,0x2c},\r
-{0xbe,0x28},\r
-{0xb6,0x5a},\r
-{0xb7,0x4e},\r
-{0xb8,0x2a},\r
-{0xc5,0x00},\r
-{0xc6,0x00},\r
-{0xc7,0x06},\r
-{0xcb,0x00},\r
-{0xcc,0x1e},\r
-{0xcd,0x00},\r
-{0xbf,0x08},\r
-{0xc0,0x00},\r
-{0xc1,0x05},\r
-{0xb9,0x07},\r
-{0xba,0x22},\r
-{0xbb,0x06},\r
-{0xaa,0x0b},\r
-{0xab,0x07},\r
-{0xac,0x04},\r
-{0xad,0x0f},\r
-{0xae,0x00},\r
-{0xaf,0x09},\r
-{0xb0,0x17},\r
-{0xb1,0x06},\r
-{0xb2,0x04},\r
-{0xb3,0x14},\r
-{0xb4,0x01},\r
-{0xb5,0x00},\r
-{0xd0,0x17},\r
-{0xd2,0x22},\r
-{0xd3,0x33},\r
-{0xd8,0x41},\r
-{0xda,0x0d},\r
-{0xdb,0x0b},\r
-{0xdc,0x29},\r
-{0xde,0x00},\r
-{0xdf,0x15},\r
-{0xd4,0x09},\r
-{0xd6,0x1e},\r
-{0xd7,0x3a},\r
-{0xa4,0x30},\r
-{0xa5,0x00},\r
-{0xa6,0x60},\r
-{0xa7,0x12},\r
-{0xa8,0x44},\r
-{0xa9,0x74},\r
-{0xa1,0x80},\r
-{0xa2,0x80},\r
-\r
-{0xfe,0x02},\r
-{0xa4,0x00},\r
-{0xfe,0x00},\r
+       {0x03 , 0x02},\r
+       {0x04 , 0x80},\r
 \r
-{0xfe,0x02},\r
-{0xc0,0x01},\r
-{0xc1,0x40},  //Green_cc\r
-{0xc2,0xfc},\r
-{0xc3,0x05},\r
-{0xc4,0xec},\r
-{0xc5,0x42},\r
-{0xc6,0xf8},\r
-{0xc7,0x46},\r
-{0xc8,0xfd},\r
-{0xc9,0xfd},\r
-{0xca,0xfd},\r
-{0xcb,0x46},\r
-{0xcc,0xfd},\r
-{0xcd,0x46},\r
-{0xce,0xfd},\r
-{0xcf,0xfd},\r
-{0xe3,0xfd},\r
-{0xe4,0x46},\r
-{0xe5,0xfd},\r
-{0xfe,0x00},\r
-//awb\r
-{0xfe,0x01},\r
-{0x4f,0x00}, \r
-{0x4d,0x10}, ////////////////10\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x20},  ///////////////20\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x30}, //////////////////30\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},   \r
-{0x4e,0x04},  //d50\r
-{0x4e,0x02},  // d65\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x40},  //////////////////////40\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x08},  //cwf\r
-{0x4e,0x08},  // cwf \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x50}, //////////////////50\r
-{0x4e,0x00},  \r
-{0x4e,0x00},\r
-{0x4e,0x00},  \r
-{0x4e,0x10},  // tl84 \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x60}, /////////////////60\r
-{0x4e,0x00},    \r
-{0x4e,0x00},      \r
-{0x4e,0x00},  \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x70}, ///////////////////70\r
-{0x4e,0x00},  \r
-{0x4e,0x00},  \r
-{0x4e,0x20},  // a \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x80}, /////////////////////80\r
-{0x4e,0x40}, //H\r
-{0x4e,0x40},  // h\r
-{0x4e,0x20},  //A\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x90}, //////////////////////90\r
-{0x4e,0x00},  // h\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0xa0}, /////////////////a0\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0xb0}, //////////////////////////////////b0\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0xc0}, //////////////////////////////////c0\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4e,0x00}, \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0xd0}, ////////////////////////////d0\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4d,0xe0}, /////////////////////////////////e0\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4e,0x00}, \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0xf0}, /////////////////////////////////f0\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4e,0x00}, \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4f,0x01},\r
-#endif\r
-//lsc,\r
-#if 1\r
-////ba-wang///\r
-{0xfe,0x01},\r
-{0xc2,0x10},//0x1f\r
-{0xc3,0x04},//0x07\r
-{0xc4,0x01},//0x03\r
-{0xc8,0x08},//10\r
-{0xc9,0x04},//0x0a\r
-{0xca,0x02},//0x08\r
-{0xbc,0x16},//0x4a\r
-{0xbd,0x10},//0x1c\r
-{0xbe,0x10},//0x1a\r
-{0xb6,0x10},//0x30\r
-{0xb7,0x08},//0x1c\r
-{0xb8,0x06},//0x15\r
-{0xc5,0x00},\r
-{0xc6,0x00},\r
-{0xc7,0x00},\r
-{0xcb,0x00},\r
-{0xcc,0x00},\r
-{0xcd,0x00},\r
-{0xbf,0x04},//0x0c\r
-{0xc0,0x00},//0x04\r
-{0xc1,0x00},\r
-{0xb9,0x00},\r
-{0xba,0x00},\r
-{0xbb,0x00},\r
-{0xaa,0x00},\r
-{0xab,0x00},\r
-{0xac,0x00},\r
-{0xad,0x00},\r
-{0xae,0x00},\r
-{0xaf,0x00},\r
-{0xb0,0x00},\r
-{0xb1,0x00},\r
-{0xb2,0x00},\r
-{0xb3,0x00},\r
-{0xb4,0x00},\r
-{0xb5,0x00},\r
-{0xd0,0x01},\r
-{0xd2,0x00},\r
-{0xd3,0x00},\r
-{0xd8,0x00},\r
-{0xda,0x00},\r
-{0xdb,0x00},\r
-{0xdc,0x00},\r
-{0xde,0x00},//0x07\r
-{0xdf,0x00},\r
-{0xd4,0x00},\r
-{0xd6,0x00},\r
-{0xd7,0x00},\r
-{0xa4,0x00},\r
-{0xa5,0x00},\r
-{0xa6,0x04},\r
-{0xa7,0x00},\r
-{0xa8,0x00},\r
-{0xa9,0x00},\r
-{0xa1,0x80},\r
-{0xa2,0x80},\r
-/*************\r
-////ba-wang///\r
-{0xfe,0x01},\r
-{0xc2,0x30},//0x44\r
-{0xc3,0x2e},\r
-{0xc4,0x2a},\r
-{0xc8,0x35},\r
-{0xc9,0x2e},\r
-{0xca,0x24},\r
-{0xbc,0x48},//5e\r
-{0xbd,0x45},\r
-{0xbe,0x43},\r
-{0xb6,0x5f},\r
-{0xb7,0x3e},\r
-{0xb8,0x2b},\r
-{0xc5,0x00},\r
-{0xc6,0x00},\r
-{0xc7,0x00},\r
-{0xcb,0x00},\r
-{0xcc,0x00},\r
-{0xcd,0x00},\r
-{0xbf,0x04},//0a\r
-{0xc0,0x09},\r
-{0xc1,0x08},\r
-{0xb9,0x0a},\r
-{0xba,0x07},\r
-{0xbb,0x12},\r
-{0xaa,0x08},// q1 red 19\r
-{0xab,0x00},//0x03\r
-{0xac,0x01},\r
-{0xad,0x06},//0d\r
-{0xae,0x03},//07\r
-{0xaf,0x00},\r
-{0xb0,0x02},//0x05\r
-{0xb1,0x04},//09\r
-{0xb2,0x00},\r
-{0xb3,0x08},//13\r
-{0xb4,0x06},//0c\r
-{0xb5,0x00},\r
-{0xd0,0x20},//54\r
-{0xd2,0x00},\r
-{0xd3,0x00},\r
-{0xd8,0x2f},\r
-{0xda,0x00},\r
-{0xdb,0x00},\r
-{0xdc,0x00},\r
-{0xde,0x07},\r
-{0xdf,0x00},\r
-{0xd4,0x29},\r
-{0xd6,0x00},\r
-{0xd7,0x02},\r
-{0xa4,0x00},\r
-{0xa5,0x00},\r
-{0xa6,0x00},\r
-{0xa7,0x00},\r
-{0xa8,0x44},\r
-{0xa9,0x40},\r
-{0xa1,0x80},\r
-{0xa2,0x80},\r
-**************/\r
-{0xfe,0x02},\r
-{0xa4,0x00},\r
-{0xfe,0x00},\r
-\r
-{0xfe,0x02},\r
-{0xc0,0x00},   //0x01\r
-{0xc1,0x3c},  //0x40 Green_cc\r
-{0xc2,0xfc},\r
-{0xc3,0xfd},//0x05\r
-{0xc4,0x00},//0xec\r
-{0xc5,0x42},//0x42\r
-{0xc6,0x00},//0xf8\r
-\r
-{0xc7,0x3c},\r
-{0xc8,0xfc},\r
-{0xc9,0xfd},\r
-{0xca,0x00},\r
-{0xcb,0x42},\r
-{0xcc,0x00},\r
-\r
-{0xcd,0x3c},\r
-{0xce,0xfc},\r
-{0xcf,0xfd},\r
-{0xe3,0x00},\r
-{0xe4,0x42},\r
-{0xe5,0x00},\r
-\r
-/***\r
-{0xc7,0x46},\r
-{0xc8,0xfd},\r
-{0xc9,0xfd},\r
-{0xca,0xfd},\r
-{0xcb,0x46},\r
-{0xcc,0xfd},\r
-{0xcd,0x46},\r
-{0xce,0xfd},\r
-{0xcf,0xfd},\r
-{0xe3,0xfd},\r
-{0xe4,0x46},\r
-{0xe5,0xfd},\r
-***/\r
+       //////////measure window  ///////////\r
+       {0xfe , 0x00},\r
+       {0xec , 0x06},//04 \r
+       {0xed , 0x06},//04 \r
+       {0xee , 0x62},//60 \r
+       {0xef , 0x92},//90 \r
 \r
-{0xfe,0x00},\r
-//awb\r
-{0xfe,0x01},\r
-{0x4f,0x00}, \r
-{0x4d,0x10}, ////////////////10\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x20},  ///////////////20\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x30}, //////////////////30\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x04},  // office\r
-{0x4e,0x00},   \r
-{0x4e,0x02},  // d65\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x40},  //////////////////////40\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},  // cwf    \r
-{0x4e,0x08},  // cwf \r
-{0x4e,0x04},  // d50\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x50}, //////////////////50\r
-{0x4e,0x00},  \r
-{0x4e,0x00},\r
-{0x4e,0x00},  \r
-{0x4e,0x10},  // tl84 \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x60}, /////////////////60\r
-{0x4e,0x00},    \r
-{0x4e,0x00},      \r
-{0x4e,0x00},  \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x70}, ///////////////////70\r
-{0x4e,0x00},  \r
-{0x4e,0x00},  \r
-{0x4e,0x20},  // a \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x80}, /////////////////////80\r
-{0x4e,0x00}, \r
-{0x4e,0x40},  // h\r
-{0x4e,0x00}, \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0x90}, //////////////////////90\r
-{0x4e,0x00},  // h\r
-{0x4e,0x40},  // h\r
-{0x4e,0x40},  // h \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0xa0}, /////////////////a0\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0xb0}, //////////////////////////////////b0\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0xc0}, //////////////////////////////////c0\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4e,0x00}, \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0xd0}, ////////////////////////////d0\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4d,0xe0}, /////////////////////////////////e0\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4e,0x00}, \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4d,0xf0}, /////////////////////////////////f0\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00}, \r
-{0x4e,0x00}, \r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4e,0x00},\r
-{0x4f,0x01},\r
-#endif\r
-{0xfe,0x01},\r
-{0x50,0xc8},\r
-{0x52,0x40},\r
-{0x54,0x60},\r
-{0x56,0x06},\r
-{0x57,0x20}, //pre adjust\r
-{0x58,0x01}, \r
-{0x5c,0xf0},\r
-{0x5d,0x40},\r
-{0x5b,0x02}, //AWB_gain_delta\r
-{0x61,0xaa},//R/G stand\r
-{0x62,0xaa},//R/G stand\r
-{0x71,0x00},\r
-{0x74,0x10},  //AWB_C_max\r
-{0x77,0x08},  //AWB_p2_x\r
-{0x78,0xfd}, //AWB_p2_y\r
-{0x86,0x30},\r
-{0x87,0x00},\r
-{0x88,0x06},//04\r
-{0x8a,0xc0},//awb move mode\r
-{0x89,0x75},\r
-{0x84,0x08},  //auto_window\r
-{0x8b,0x00},  //awb compare luma\r
-{0x8d,0x70}, //awb gain limit R \r
-{0x8e,0x70},//G\r
-{0x8f,0xf4},//B\r
-{0x5e,0xa4},\r
-{0x5f,0x60},\r
-{0x92,0x58},\r
-{0xfe,0x00},\r
-{0x82,0x02},//awb_en\r
+       ///////////analog/////////////\r
+       {0x0a , 0x00}, //row start\r
+       {0x0c , 0x00}, //col start\r
+       {0x0d , 0x04},\r
+       {0x0e , 0xc0},\r
+       {0x0f , 0x06}, //Window setting\r
+       {0x10 , 0x58}, \r
+       {0x17 , 0x14}, //[0]mirror [1]flip\r
 \r
-//{0xfe ,0xec}, luma_value\r
 \r
-{0xfe,0x01},\r
-{0x9c,0x02}, //add abs slope\r
-{0x21,0xbf},\r
-{0xfe,0x02},\r
-{0xa5,0x60}, //lsc_th //40\r
-{0xa2,0xc0}, //lsc_dec_slope 0xa0\r
-{0xa3,0x30}, //when total gain is bigger than the value, enter dark light mode  0x20 added\r
-{0xa4,0x04},//add \r
-{0xa6,0x50}, //dd_th\r
-{0xa7,0x80}, //ot_th   30\r
-{0xab,0x31}, //[0]b_dn_effect_dark_inc_or_dec\r
-{0x88,0x15}, //[5:0]b_base\r
-{0xa9,0x6c}, //[7:4] ASDE_DN_b_slope_high  0x6c 0x6f\r
-\r
-{0xb0,0x88},  //6edge effect slope 0x66 0x88 0x99\r
-\r
-{0xb3,0xa0}, //saturation dec slope  //0x70   0x40\r
-{0xb4,0x32},//0x32 0x42\r
-{0x8c,0xf6}, //[2]b_in_dark_inc\r
-{0x89,0x03}, //dn_c_weight 0x03\r
-\r
-{0xde,0xb6},  //b6[7]asde_autogray [3:0]auto_gray_value  0xb9\r
-{0x38,0x09},  //0aasde_autogray_slope 0x08 0x05 0x06 0x0a\r
-{0x39,0x80},  //50asde_autogray_threshold  0x50     0x30\r
+       {0x18 , 0x0e}, //sdark 4 row in even frame??\r
+       {0x19 , 0x0c}, //AD pipe number\r
 \r
-{0xfe,0x00},\r
-{0x81,0x26},\r
-{0x87,0xb0}, //[5:4]first_dn_en first_dd_en  enable 0x80\r
-{0xfe,0x02},\r
-{0x83,0x00},//[6]green_bks_auto [5]gobal_green_bks\r
-{0x84,0x45},//RB offset\r
-{0xd1,0x40},  //saturation_cb  0x3a\r
-{0xd2,0x3a},  //saturation_Cr  0x38\r
-{0xdc,0x30},\r
-{0xdd,0xb8},  //edge_sa_g,b\r
-{0xfe,0x00},\r
+       /*\r
+       ///  Ã«´Ì ÏÖÏó\r
+       {0x18 , 0x0a}, //sdark 4 row in even frame??\r
+       {0x19 , 0x0a}, //AD pipe number\r
+       */\r
+       \r
+       {0x1a , 0x01}, //CISCTL mode4\r
+       {0x1b , 0x8b},\r
+       {0x1e , 0x88}, //analog mode1 [7] tx-high en [5:3]COL_bias\r
+       {0x1f , 0x08}, //[3] tx-low en//\r
+       {0x20 , 0x05}, //[0]adclk mode , 0x[1]rowclk_MODE [2]rsthigh_en\r
+       {0x21 , 0x0f}, //[6:4]rsg\r
+       {0x22 , 0xf0}, //[3:0]vref\r
+       {0x23 , 0xc3}, //f3//ADC_r\r
+       {0x24 , 0x17}, //pad drive  16\r
+\r
+       //AEC\r
+       {0xfe , 0x01},\r
+       {0x11 , 0x20},//AEC_out_slope , 0x\r
+       {0x1f , 0xc0},//max_post_gain\r
+       {0x20 , 0x60},//max_pre_gain\r
+       {0x47 , 0x30},//AEC_outdoor_th\r
+       {0x0b , 0x10},//\r
+       {0x13 , 0x75},//y_target\r
+       {0xfe , 0x00},\r
 \r
-/***\r
-{0x16,0x18},// 7\r
-{0x17,0x1c},\r
-{0x18,0x22},\r
-{0x19,0x2a},\r
-{0x1a,0x37},\r
-{0x1b,0x44},\r
-{0x1c,0x4d},\r
-{0x1d,0x67},\r
-{0x1e,0x79},\r
-{0x1f,0x8c},\r
-{0x20,0x9a},\r
-{0x21,0xa8},\r
-{0x22,0xbd},\r
-{0x23,0xca},\r
-{0x24,0xd5},\r
-{0x25,0xdf},\r
-{0x26,0xea},\r
-{0x27,0xf3},\r
-{0x28,0xfa},\r
-{0x29,0xfd},\r
-*****/\r
-//gmma-curve4-low strech\r
-{0xfe,0x02},\r
-{0x15,0x0f},\r
-{0x16,0x15},\r
-{0x17,0x1a},\r
-{0x18,0x20},\r
-{0x19,0x2a},\r
-{0x1a,0x32},\r
-{0x1b,0x38},\r
-{0x1c,0x40},\r
-{0x1d,0x4d},\r
-{0x1e,0x59},\r
-{0x1f,0x66},\r
-{0x20,0x70},\r
-{0x21,0x7b},\r
-{0x22,0x8f},\r
-{0x23,0xa2},\r
-{0x24,0xb0},\r
-{0x25,0xbb},\r
-{0x26,0xcf},\r
-{0x27,0xdf},\r
-{0x28,0xef},\r
-{0x29,0xfd},\r
-{0xfe,0x02},\r
-{0x15,0x0c},  \r
-{0x16,0x12},  \r
-{0x17,0x17},  \r
-{0x18,0x1c},  \r
-{0x19,0x24},  \r
-{0x1a,0x2c},  \r
-{0x1b,0x34},  \r
-{0x1c,0x3c},  \r
-{0x1d,0x4d},\r
-{0x1e,0x59},\r
-{0x1f,0x66},\r
-{0x20,0x70},\r
-{0x21,0x7b},\r
-{0x22,0x8f},\r
-{0x23,0xa2},\r
-{0x24,0xb0},\r
-{0x25,0xbb},\r
-{0x26,0xcf},\r
-{0x27,0xdf},\r
-{0x28,0xef},\r
-{0x29,0xfd},\r
-{0xfe,0x02},  \r
-{0x15,0x15},  \r
-{0x16,0x24},  \r
-{0x17,0x2a},  \r
-{0x18,0x32},  \r
-{0x19,0x3d},  \r
-{0x1a,0x48},  \r
-{0x1b,0x50},  \r
-{0x1c,0x57},  \r
-{0x1d,0x64},  \r
-{0x1e,0x6d},  \r
-{0x1f,0x78},  \r
-{0x20,0x80},  \r
-{0x21,0x89},  \r
-{0x22,0x94},  \r
-{0x23,0xa3},  \r
-{0x24,0xaf},  \r
-{0x25,0xbc},  \r
-{0x26,0xce},  \r
-{0x27,0xdf},  \r
-{0x28,0xee},  \r
-{0x29,0xff},  \r
-#if 0\r
-////Gamma  curve4+curve6   \r
-{0xfe,0x02},  \r
-{0x15,0x0f},  \r
-{0x16,0x16},  \r
-{0x17,0x1f},  \r
-{0x18,0x27},  \r
-{0x19,0x2c},  \r
-{0x1a,0x34},  \r
-{0x1b,0x3b},  \r
-{0x1c,0x43},  \r
-{0x1d,0x4f},  \r
-{0x1e,0x5a},  \r
-{0x1f,0x64},  \r
-{0x20,0x6e},  \r
-{0x21,0x74},  \r
-{0x22,0x8d},  \r
-{0x23,0xa5},  \r
-{0x24,0xb8},  \r
-{0x25,0xca},  \r
-{0x26,0xe0},  \r
-{0x27,0xed},  \r
-{0x28,0xf7},  \r
-{0x29,0xfd},  \r
-\r
-/*******\r
-gamma-curve6\r
-0xfe,0x02}, \r
-0x15,0x06}, \r
-0x16,0x0a}, \r
-0x17,0x0d}, \r
-0x18,0x10}, \r
-0x19,0x14}, \r
-0x1a,0x1e}, \r
-0x1b,0x28}, \r
-0x1c,0x31}, \r
-0x1d,0x44}, \r
-0x1e,0x50}, \r
-0x1f,0x5f}, \r
-0x20,0x6b}, \r
-0x21,0x79}, \r
-0x22,0x8f}, \r
-0x23,0xa5}, \r
-0x24,0xb8}, \r
-0x25,0xca}, \r
-0x26,0xe0}, \r
-0x27,0xed}, \r
-0x28,0xf7}, \r
-0x29,0xfd}, \r
-/*****\r
-//gamma-new\r
-{0xfe,0x02},\r
-{0x15,0x14},\r
-{0x16,0x28},\r
-{0x17,0x48},\r
-{0x18,0x60},\r
-{0x19,0x7c},\r
-{0x1a,0x90},\r
-{0x1b,0xa2},\r
-{0x1c,0xb2},\r
-{0x1d,0xc0},\r
-{0x1e,0xce},\r
-{0x1f,0xda},\r
-{0x20,0xe4},\r
-{0x21,0xec},\r
-{0x22,0xf4},\r
-{0x23,0xca},\r
-{0x24,0xd5},\r
-{0x25,0xfa},\r
-{0x26,0xfb},\r
-{0x27,0xfd},\r
-{0x28,0xff},\r
-{0x29,0xff},\r
-\r
-       {0x24,0xd5},\r
-       {0x25,0xdf},\r
-       {0x26,0xea},\r
-       {0x27,0xf3},\r
-       {0x28,0xfa},\r
-       {0x29,0xfd},\r
-\r
-\r
-{0x16,0x18},// 7\r
-{0x17,0x1c},\r
-{0x18,0x22},\r
-{0x19,0x2a},\r
-{0x1a,0x37},\r
-{0x1b,0x44},\r
-{0x1c,0x4d},\r
-{0x1d,0x67},\r
-{0x1e,0x79},\r
-{0x1f,0x8c},\r
-{0x20,0x9a},\r
-{0x21,0xa8},\r
-{0x22,0xbd},\r
-{0x23,0xca},\r
-{0x24,0xd5},\r
-{0x25,0xdf},\r
-{0x26,0xea},\r
-{0x27,0xf3},\r
-{0x28,0xfa},\r
-{0x29,0xfd},\r
-\r
-\r
-//rgb-gamma\r
-{0x15,0x0a},\r
-{0x16,0x0c},\r
-{0x17,0x0b},\r
-{0x18,0x10},\r
-{0x19,0x13},\r
-{0x1a,0x21},\r
-{0x1b,0x2b},\r
-{0x1c,0x33},\r
-{0x1d,0x43},\r
-{0x1e,0x50},\r
-{0x1f,0x5f},\r
-{0x20,0x6b},\r
-{0x21,0x7a},\r
-{0x22,0x8e},\r
-{0x23,0xa4},\r
-{0x24,0xb8},\r
-{0x25,0xc8},\r
-{0x26,0xdf},\r
-{0x27,0xed},\r
-{0x28,0xf8},\r
-{0x29,0xff},\r
-****************/\r
-#endif\r
-//y-gamma\r
-{0x2b,0x00},\r
-{0x2c,0x04},\r
-{0x2d,0x09},\r
-{0x2e,0x18},\r
-{0x2f,0x27},\r
-{0x30,0x37},\r
-{0x31,0x49},\r
-{0x32,0x5c},\r
-{0x33,0x7e},\r
-{0x34,0xa0},\r
-{0x35,0xc0},\r
-{0x36,0xe0},\r
-{0x37,0xff},\r
-{0xfe,0x00},\r
 \r
-// a-lsc\r
-{0xfe,0x01},\r
-{0xa0,0x03},//0f\r
-{0xe8,0x51},\r
-{0xea,0x42},\r
-{0xe6,0x71},\r
-{0xe4,0x80},\r
-{0xe9,0x1f},\r
-{0x4c,0x13},\r
-{0xeb,0x1e},\r
-{0x4d,0x13},\r
-{0xe7,0x20},\r
-{0x4b,0x15},\r
-{0xe5,0x1c},\r
-{0x4a,0x15},\r
-{0xe0,0x20},\r
-{0xe1,0x20},\r
-{0xe2,0x20},\r
-{0xe3,0x20},\r
-{0xd1,0x74},\r
-{0x4e,0x0e},\r
-{0xd9,0x91},\r
-{0x4f,0x27},\r
-{0xdd,0x78},\r
-{0xce,0x31},\r
-{0xd5,0x71},\r
-{0xcf,0x39},\r
-{0xa4,0x00},\r
-{0xa5,0x00},\r
-{0xa6,0x00},\r
-{0xa7,0x00},\r
-{0xa8,0x66},\r
-{0xa9,0x66},\r
-{0xa1,0x80},\r
-{0xa2,0x80},\r
-{0xfe,0x00},\r
+       {0x05 , 0x01},//hb\r
+       {0x06 , 0x11},\r
+       {0x07 , 0x00},//vb\r
+       {0x08 , 0x50},\r
+       {0xfe , 0x01},\r
+       {0x27 , 0x00},//step\r
+       {0x28 , 0xa0},\r
+       {0x29 , 0x05},//level1\r
+       {0x2a , 0x00},\r
+       {0x2b , 0x05},//level2\r
+       {0x2c , 0x00},\r
+       {0x2d , 0x06},//6e8//level3\r
+       {0x2e , 0xe0},\r
+       {0x2f , 0x0a},//level4\r
+       {0x30 , 0x00},\r
+       {0x3e , 0x40},\r
+       {0xfe , 0x00},\r
+       {0xfe , 0x00},  //0x , 0x , 0x , 0x , 0x \r
+       {0xb6 , 0x03}, //AEC enable\r
+       {0xfe , 0x00},\r
 \r
-{0x82,0xfe},\r
-//sleep  400\r
-{0xf2,0x70},\r
-{0xf3,0xff},\r
-{0xf4,0x00},\r
-{0xf5,0x30},\r
-{0xfe,0x01},\r
-{0x0b,0x90},\r
-{0x87,0x00},//0x10\r
-{0xfe,0x00},\r
+       /////////BLK//////\r
+       {0x3f , 0x00}, //prc close\r
+       {0x40 , 0x77},//\r
+       {0x42 , 0x7f},\r
+       {0x43 , 0x30},\r
+       {0x5c , 0x08},\r
+       {0x5e , 0x20},\r
+       {0x5f , 0x20},\r
+       {0x60 , 0x20},\r
+       {0x61 , 0x20},\r
+       {0x62 , 0x20},\r
+       {0x63 , 0x20},\r
+       {0x64 , 0x20},\r
+       {0x65 , 0x20},\r
+\r
+       ///block////////////\r
+       {0x80 , 0xff},\r
+       {0x81 , 0x26},//38 , 0x//skin_Y 8c_debug\r
+       {0x87 , 0x90}, //[7]middle gamma \r
+       {0x84 , 0x00}, //output put foramat\r
+       {0x86 , 0x07}, //02 //sync plority \r
+       {0x8b , 0xbc},\r
+       {0xb0 , 0x80}, //globle gain\r
+       {0xc0 , 0x40},//Yuv bypass\r
+\r
+       //////lsc/////////////\r
+       {0xfe , 0x01},\r
+       {0xc2 , 0x38},\r
+       {0xc3 , 0x25},\r
+       {0xc4 , 0x21},\r
+       {0xc8 , 0x19},\r
+       {0xc9 , 0x12},\r
+       {0xca , 0x0e},\r
+       {0xbc , 0x43},\r
+       {0xbd , 0x18},\r
+       {0xbe , 0x1b},\r
+       {0xb6 , 0x40},\r
+       {0xb7 , 0x2e},\r
+       {0xb8 , 0x26},\r
+       {0xc5 , 0x05},\r
+       {0xc6 , 0x03},\r
+       {0xc7 , 0x04},\r
+       {0xcb , 0x00},\r
+       {0xcc , 0x00},\r
+       {0xcd , 0x00},\r
+       {0xbf , 0x14},\r
+       {0xc0 , 0x22},\r
+       {0xc1 , 0x1b},\r
+       {0xb9 , 0x00},\r
+       {0xba , 0x05},\r
+       {0xbb , 0x05},\r
+       {0xaa , 0x35},\r
+       {0xab , 0x33},\r
+       {0xac , 0x33},\r
+       {0xad , 0x25},\r
+       {0xae , 0x22},\r
+       {0xaf , 0x27},\r
+       {0xb0 , 0x1d},\r
+       {0xb1 , 0x20},\r
+       {0xb2 , 0x22},\r
+       {0xb3 , 0x14},\r
+       {0xb4 , 0x15},\r
+       {0xb5 , 0x16},\r
+       {0xd0 , 0x00},\r
+       {0xd2 , 0x07},\r
+       {0xd3 , 0x08},\r
+       {0xd8 , 0x00},\r
+       {0xda , 0x13},\r
+       {0xdb , 0x17},\r
+       {0xdc , 0x00},\r
+       {0xde , 0x0a},\r
+       {0xdf , 0x08},\r
+       {0xd4 , 0x00},\r
+       {0xd6 , 0x00},\r
+       {0xd7 , 0x0c},\r
+       {0xa4 , 0x00},\r
+       {0xa5 , 0x00},\r
+       {0xa6 , 0x00},\r
+       {0xa7 , 0x00},\r
+       {0xa8 , 0x00},\r
+       {0xa9 , 0x00},\r
+       {0xa1 , 0x80},\r
+       {0xa2 , 0x80},\r
+\r
+       //////////cc//////////////\r
+       {0xfe , 0x02},\r
+       {0xc0 , 0x01},\r
+       {0xc1 , 0x40}, //Green_cc for d\r
+       {0xc2 , 0xfc},\r
+       {0xc3 , 0x05},\r
+       {0xc4 , 0xec},\r
+       {0xc5 , 0x42},\r
+       {0xc6 , 0xf8},\r
+       {0xc7 , 0x40},//for cwf \r
+       {0xc8 , 0xf8},\r
+       {0xc9 , 0x06},\r
+       {0xca , 0xfd},\r
+       {0xcb , 0x3e},\r
+       {0xcc , 0xf3},\r
+       {0xcd , 0x36},//for A\r
+       {0xce , 0xf6},\r
+       {0xcf , 0x04},\r
+       {0xe3 , 0x0c},\r
+       {0xe4 , 0x44},\r
+       {0xe5 , 0xe5},\r
+       {0xfe , 0x00},\r
 \r
-/////,0xup},date\r
-//ÈÈ?0x  },\r
-{0xfe,0x02},\r
-{0xa6,0x80}, //dd_th\r
-{0xa7,0x60}, //ot_th //0x80\r
-{0xa9,0x66}, //6f[7:4] ASDE_DN_b_slope_high 0x68\r
-{0xb0,0x88},  //edge effect slope 0x99\r
-{0x38,0x0b},  //asde_autogray_slope 0x08   0x0f  0x0a\r
-{0x39,0x50},  //asde_autogray_threshold  0x60\r
-{0xfe,0x00},\r
-{0x87,0xb0}, //[5:4]first_dn_en first_dd_en      0x90\r
+       ///////awb start ////////////////\r
+       //AWB clear\r
+       {0xfe , 0x01},\r
+       {0x4f , 0x00},\r
+       {0x4d , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0x10}, // 10\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0x20}, // 20\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0x30},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00}, // 30\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0x40}, // 40\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0x50}, // 50\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0x60}, // 60\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0x70}, // 70\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0x80}, // 80\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0x90}, // 90\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0xa0}, // a0\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0xb0}, // b0\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0xc0}, // c0\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4d , 0xd0}, // d0\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x00},\r
+       {0x4f , 0x01},\r
+       /////// awb value////////\r
+       {0xfe , 0x01},\r
+       {0x4f , 0x00},\r
+       {0x4d , 0x30},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x80},\r
+       {0x4e , 0x80},\r
+       {0x4e , 0x02},\r
+       {0x4e , 0x02},\r
+       {0x4d , 0x40},\r
+       {0x4e , 0x00},\r
+       {0x4e , 0x80},\r
+       {0x4e , 0x80},\r
+       {0x4e , 0x02},\r
+       {0x4e , 0x02},\r
+       {0x4e , 0x02},\r
+       {0x4d , 0x53},\r
+       {0x4e , 0x08},\r
+       {0x4e , 0x04},\r
+       {0x4d , 0x62},\r
+       {0x4e , 0x10},\r
+       {0x4d , 0x72},\r
+       {0x4e , 0x20},\r
+       {0x4f , 0x01},\r
+\r
+       /////awb////\r
+       {0xfe , 0x01},\r
+       {0x50 , 0x88},//c0//[6]green mode\r
+       {0x52 , 0x40},\r
+       {0x54 , 0x60},\r
+       {0x56 , 0x06},\r
+       {0x57 , 0x20}, //pre adjust\r
+       {0x58 , 0x01}, \r
+       {0x5b , 0x02}, //AWB_gain_delta\r
+       {0x61 , 0xaa},//R/G stand\r
+       {0x62 , 0xaa},//R/G stand\r
+       {0x71 , 0x00},\r
+       {0x74 , 0x10},  //0x//AWB_C_max\r
+       {0x77 , 0x08}, // 0x//AWB_p2_x\r
+       {0x78 , 0xfd}, //AWB_p2_y\r
+       {0x86 , 0x30},\r
+       {0x87 , 0x00},\r
+       {0x88 , 0x04},//06 , 0x//[1]dark mode\r
+       {0x8a , 0xc0},//awb move mode\r
+       {0x89 , 0x75},\r
+       {0x84 , 0x08},  //0x//auto_window\r
+       {0x8b , 0x00}, // 0x//awb compare luma\r
+       {0x8d , 0x70}, //awb gain limit R \r
+       {0x8e , 0x70},//G\r
+       {0x8f , 0xf4},//B\r
+       {0xfe , 0x00},\r
+       {0x82 , 0x02},//awb_en\r
+       /////////awb end /////////////\r
+       \r
+       ///==========asde\r
+       {0xfe , 0x01},\r
+       {0x21 , 0xbf},\r
+       {0xfe , 0x02},\r
+       {0xa4 , 0x00},//\r
+       {0xa5 , 0x40}, //lsc_th\r
+       {0xa2 , 0xa0}, //lsc_dec_slope\r
+       {0xa6 , 0x80}, //dd_th\r
+       {0xa7 , 0x80}, //ot_th\r
+       {0xab , 0x31}, //\r
+       {0xa9 , 0x6f}, //\r
+       {0xb0 , 0x99}, //0x//edge effect slope low\r
+       {0xb1 , 0x34},//edge effect slope low\r
+       {0xb3 , 0x80}, //saturation dec slope\r
+       {0xde , 0xb6},  //\r
+       {0x38 , 0x0f}, // \r
+       {0x39 , 0x60}, //\r
+       {0xfe , 0x00},\r
+       {0x81 , 0x26},\r
+       {0xfe , 0x02},\r
+       {0x83 , 0x00},//\r
+       {0x84 , 0x45},//\r
+       ////////////YCP//////////\r
+       {0xd1 , 0x38},//saturation_cb\r
+       {0xd2 , 0x38},//saturation_Cr\r
+       {0xd3 , 0x40},//contrast ?\r
+       {0xd4 , 0x80},//contrast center \r
+       {0xd5 , 0x00},//luma_offset \r
+       {0xdc , 0x30},\r
+       {0xdd , 0xb8},//edge_sa_g,b\r
+       {0xfe , 0x00},\r
+       ///////dndd///////////\r
+       {0xfe , 0x02},\r
+       {0x88 , 0x15},//dn_b_base\r
+       {0x8c , 0xf6}, //[2]b_in_dark_inc\r
+       {0x89 , 0x03}, //dn_c_weight\r
+       ////////EE ///////////\r
+       {0xfe , 0x02},\r
+       {0x90 , 0x6c},// EEINTP mode1\r
+       {0x97 , 0x45},// edge effect\r
+       ////==============RGB Gamma \r
+       {0xfe , 0x02},\r
+       {0x15 , 0x0a},\r
+       {0x16 , 0x12},\r
+       {0x17 , 0x19},\r
+       {0x18 , 0x1f},\r
+       {0x19 , 0x2c},\r
+       {0x1a , 0x38},\r
+       {0x1b , 0x42},\r
+       {0x1c , 0x4e},\r
+       {0x1d , 0x63},\r
+       {0x1e , 0x76},\r
+       {0x1f , 0x87},\r
+       {0x20 , 0x96},\r
+       {0x21 , 0xa2},\r
+       {0x22 , 0xb8},\r
+       {0x23 , 0xca},\r
+       {0x24 , 0xd8},\r
+       {0x25 , 0xe3},\r
+       {0x26 , 0xf0},\r
+       {0x27 , 0xf8},\r
+       {0x28 , 0xfd},\r
+       {0x29 , 0xff},\r
+\r
+       ///=================y gamma\r
+       {0xfe , 0x02},\r
+       {0x2b , 0x00},\r
+       {0x2c , 0x04},\r
+       {0x2d , 0x09},\r
+       {0x2e , 0x18},\r
+       {0x2f , 0x27},\r
+       {0x30 , 0x37},\r
+       {0x31 , 0x49},\r
+       {0x32 , 0x5c},\r
+       {0x33 , 0x7e},\r
+       {0x34 , 0xa0},\r
+       {0x35 , 0xc0},\r
+       {0x36 , 0xe0},\r
+       {0x37 , 0xff},\r
+       /////1600x1200size// \r
+       {0xfe , 0x00},//\r
+       {0x90 , 0x01}, //0x//crop enable\r
+       {0x95 , 0x04},  //0x//1600x1200\r
+       {0x96 , 0xb0},\r
+       {0x97 , 0x06},\r
+       {0x98 , 0x40},\r
 \r
-{0xfe,0x00},\r
-{0x90,0x01},\r
-{0x95,0x01},\r
-{0x96,0xe4},\r
-{0x97,0x02},\r
-{0x98,0x82},\r
-{0xc8,0x14},\r
-{0xf7,0x0D},\r
-{0xf8,0x83},\r
-{0xfa,0x00},//pll=4\r
-{0x05,0x00},\r
-{0x06,0xc4},\r
-{0x07,0x00},\r
-{0x08,0xae},  \r
-{0xfe,0x01},\r
-{0x27,0x00},\r
-{0x28,0xe5},\r
-{0x29,0x05},\r
-{0x2a,0x5e},//18fps\r
-{0x2b,0x07},\r
-{0x2c,0x28},//12.5fps\r
-{0x2d,0x0a},\r
-{0x2e,0xbc},//8fps\r
-{0x3e,0x00},//0x40 0x00\r
-{0xfe,0x03},\r
-{0x42,0x04}, \r
-{0x43,0x05}, //output buf width\r
-{0x41,0x02}, // delay\r
-{0x40,0x40}, //fifo half full trig\r
-{0x17,0x00}, //widv is 0\r
-{0xfe,0x00},\r
-{0xc8,0x55}, \r
+       {0xfe , 0x03},\r
+       {0x42 , 0x40}, \r
+       {0x43 , 0x06}, //output buf width\r
+       {0x41 , 0x02}, // Pclk_polarity\r
+       {0x40 , 0x40},  //00  \r
+       {0x17 , 0x00}, //widv \r
+       {0xfe , 0x00},\r
+       ////output DVP/////\r
+       {0xfe , 0x00},\r
+       {0xb6 , 0x03},\r
+       {0xf7 , 0x15},\r
+\r
+       {0xc8 , 0x00},//close scaler\r
+       {0x99 , 0x22},// 1/2 subsample\r
+       {0x9a , 0x06},\r
+       {0x9b , 0x00},\r
+       {0x9c , 0x00},\r
+       {0x9d , 0x00},\r
+       {0x9e , 0x00},\r
+       {0x9f , 0x00},\r
+       {0xa0 , 0x00},  \r
+       {0xa1 , 0x00},\r
+       {0xa2  ,0x00},\r
+       \r
+       {0x90 , 0x01},  //crop enable\r
+       {0x94 , 0x02},\r
+       {0x95 , 0x02},\r
+       {0x96 , 0x58},\r
+       {0x97 , 0x03},\r
+       {0x98 , 0x20},\r
+       {0xfe , 0x00},\r
+       {0x82 , 0xfe},  // fe\r
+       {0xf2 , 0x70}, \r
+       {0xf3 , 0xff},\r
+       {0xf4 , 0x00},\r
+       {0xf5 , 0x30},\r
+       \r
+         #if 0   \r
+        /////////  re zao///\r
+       {0xfe,0x00},\r
+       {0x22,0xd0},\r
+       {0xfe,0x01},\r
+       {0x21,0xff},\r
+       {0xfe,0x02},  \r
+       {0x8a,0x33},\r
+       {0x8c,0x76},\r
+       {0x8d,0x85},\r
+       {0xa6,0xf0},    \r
+       {0xae,0x9f},\r
+       {0xa2,0x90},\r
+       {0xa5,0x40},  \r
+       {0xa7,0x30},\r
+       {0xb0,0x88},\r
+       {0x38,0x0b},\r
+       {0x39,0x30},\r
+       {0xfe,0x00},  \r
+       {0x87,0xb0},\r
+\r
+       //// small  RGB gamma////\r
+       {0xfe , 0x02},\r
+       {0x15 , 0x0b},\r
+       {0x16 , 0x0e},\r
+       {0x17 , 0x10},\r
+       {0x18 , 0x12},\r
+       {0x19 , 0x19},\r
+       {0x1a , 0x21},\r
+       {0x1b , 0x29},\r
+       {0x1c , 0x31},\r
+       {0x1d , 0x41},\r
+       {0x1e , 0x50},\r
+       {0x1f , 0x5f},\r
+       {0x20 , 0x6d},\r
+       {0x21 , 0x79},\r
+       {0x22 , 0x91},\r
+       {0x23 , 0xa5},\r
+       {0x24 , 0xb9},\r
+       {0x25 , 0xc9},\r
+       {0x26 , 0xe1},\r
+       {0x27 , 0xee},\r
+       {0x28 , 0xf7},\r
+       {0x29 , 0xff},\r
+       \r
+       ////dark sun/////\r
+       {0xfe , 0x02},\r
+       {0x40 , 0x06},\r
+       {0x41 , 0x23},\r
+       {0x42 , 0x3f},\r
+       {0x43 , 0x06},\r
+       {0x44 , 0x00},\r
+       {0x45 , 0x00},\r
+       {0x46 , 0x14},\r
+       {0x47 , 0x09},\r
\r
+  #endif\r
 \r
-{0x00,0x00}, \r
+       {0x00,0x00}, \r
 };\r
        \r
 \r
@@ -1427,38 +800,26 @@ static struct reginfo sensor_uxga[] =
  \r
  \r
        {0xfe , 0x00},\r
-       {0x0a , 0x00}, //row start\r
-       {0x0c , 0x00}, //col start\r
-\r
-       {0x0d , 0x04},\r
-       {0x0e , 0xc0},\r
-       {0x0f , 0x06}, //Window setting\r
-       {0x10 , 0x58},// \r
-\r
-\r
-\r
-\r
-\r
-       {0x90 , 0x01},  //crop enable\r
+       {0xc8 , 0x00},\r
+       {0xf7 , 0x17},\r
+\r
+       {0x99 , 0x11}, // disable sambsample\r
+       {0x9a , 0x06},\r
+       {0x9b , 0x00},\r
+       {0x9c , 0x00},\r
+       {0x9d , 0x00},\r
+       {0x9e , 0x00},\r
+       {0x9f , 0x00},\r
+       {0xa0 , 0x00},  \r
+       {0xa1 , 0x00},\r
+       {0xa2 , 0x00},\r
+               \r
+       {0x90 , 0x01},\r
        {0x95 , 0x04},\r
-       {0x96 , 0xb0},\r
+       {0x96 , 0xb0},  \r
        {0x97 , 0x06},\r
        {0x98 , 0x40},\r
-       {0x99 , 0x11},\r
-       {0xc8 , 0x00},\r
\r
-       {0xfa , 0x11},\r
-\r
-\r
-       {0xfe , 0x03},\r
-       {0x42 , 0x80}, \r
-       {0x43 , 0x06}, //output buf width\r
-       {0x41 , 0x00}, // delay\r
-       {0x40 , 0x00}, //fifo half full trig\r
-       {0x17 , 0x01}, //widv \r
-       {0xfe , 0x00},\r
-       {0xc8 , 0x00},\r
-\r
+                \r
        {0x00 , 0x00}, \r
 \r
 \r
@@ -1470,14 +831,35 @@ static struct reginfo sensor_uxga[] =
 static struct reginfo sensor_sxga[] =\r
 {\r
        \r
-       {0x0, 0x0},\r
+       {0x00,0x00}, \r
 };\r
 \r
 /* 800X600 SVGA*/\r
 static struct reginfo sensor_svga[] =\r
 {      \r
+       {0xfe , 0x00},\r
+       {0xb6 , 0x03},\r
+       {0xf7 , 0x15},\r
+\r
+       {0xc8 , 0x00},//close scaler\r
+       {0x99 , 0x22},// 1/2 subsample\r
+       {0x9a , 0x06},\r
+       {0x9b , 0x00},\r
+       {0x9c , 0x00},\r
+       {0x9d , 0x00},\r
+       {0x9e , 0x00},\r
+       {0x9f , 0x00},\r
+       {0xa0 , 0x00},  \r
+       {0xa1 , 0x00},\r
+       {0xa2 , 0x00},\r
        \r
-       {0x0, 0x0},\r
+       {0x90 , 0x01},  //crop enable\r
+       {0x94 , 0x02},\r
+       {0x95 , 0x02},\r
+       {0x96 , 0x58},\r
+       {0x97 , 0x03},\r
+       {0x98 , 0x20},\r
+       {0x00,0x00}, \r
 };\r
        \r
        \r
@@ -1485,50 +867,15 @@ static struct reginfo sensor_svga[] =
 /* 640X480 VGA */\r
 static struct reginfo sensor_vga[] =\r
 {\r
-       {0xfe , 0x00},\r
-\r
-       {0x0a , 0x00}, //row start\r
-       {0x0c , 0x00}, //col start\r
-\r
-       {0x0d , 0x04},\r
-       {0x0e , 0xc0},\r
-       {0x0f , 0x06}, //Window setting\r
-       {0x10 , 0x58},// \r
-\r
-\r
-\r
-\r
        \r
-       {0x90 , 0x01},\r
-       {0x95 , 0x01},\r
-       {0x96 , 0xe0},\r
-       {0x97 , 0x02},\r
-       {0x98 , 0x80},\r
-       {0xc8 , 0x15},\r
-\r
-\r
-\r
-       {0xfa , 0x00}, \r
-\r
-\r
-       {0xfe , 0x03},\r
-       {0x42 , 0x04}, \r
-       {0x43 , 0x05}, //output buf width\r
-       {0x41 , 0x02}, // delay\r
-       {0x40 , 0x40}, //fifo half full trig\r
-       {0x17 , 0x00}, //widv is 0\r
 \r
-       {0xfe , 0x00},\r
-       {0xc8 , 0x55}, \r
-       {0xb6 , 0x03},//aec on\r
        {0x00 , 0x00},\r
-\r
 };\r
 \r
 /* 352X288 CIF */\r
 static struct reginfo sensor_cif[] =\r
 {\r
-    {0x0, 0x0},\r
+       {0x00,0x00}, \r
 };\r
 \r
 /* 320*240 QVGA */\r
@@ -1536,76 +883,80 @@ static  struct reginfo sensor_qvga[] =
 {\r
     \r
 \r
-    {0x0, 0x0},\r
+       {0x00,0x00}, \r
 };\r
 \r
 /* 176X144 QCIF*/\r
 static struct reginfo sensor_qcif[] =\r
 {\r
        \r
-    {0x0, 0x0},\r
+       {0x00,0x00}, \r
 };\r
-#endif\r
 \r
 static  struct reginfo sensor_ClrFmt_YUYV[]=\r
 {\r
    \r
-         {0x0, 0x0},\r
+       {0x00,0x00}, \r
 };\r
 \r
 static  struct reginfo sensor_ClrFmt_UYVY[]=\r
 {\r
-           {0x0, 0x0},\r
+       {0x00,0x00}, \r
 };\r
 \r
 #if CONFIG_SENSOR_WhiteBalance\r
 static  struct reginfo sensor_WhiteB_Auto[]=\r
 {\r
-                       {0xb3, 0x61},\r
-                       {0xb4, 0x40},\r
-                       {0xb5, 0x61},\r
-                       {0x82, 0xfe},\r
-                     {0x0, 0x0},\r
+       {0xfe, 0x00},\r
+       {0xb3, 0x61},\r
+       {0xb4, 0x40},\r
+       {0xb5, 0x61},\r
+       {0x82, 0xfe},\r
+       {0x00,0x00}, \r
 };\r
 /* Cloudy Colour Temperature : 6500K - 8000K  */\r
 static  struct reginfo sensor_WhiteB_Cloudy[]=\r
 {\r
-                       {0x82, 0xfc},\r
-                       {0xb3, 0x58},\r
-                       {0xb4, 0x40},\r
-                       {0xb5, 0x50},   \r
-                     {0x0, 0x0},\r
+       {0xfe, 0x00},\r
+       {0x82, 0xfc},\r
+       {0xb3, 0x58},\r
+       {0xb4, 0x40},\r
+       {0xb5, 0x50},   \r
+       {0x00,0x00}, \r
 };\r
 /* ClearDay Colour Temperature : 5000K - 6500K  */\r
 static  struct reginfo sensor_WhiteB_ClearDay[]=\r
 {\r
     //Sunny\r
-                       {0x82, 0xfc},\r
-                       {0xb3, 0x58},\r
-                       {0xb4, 0x40},\r
-                       {0xb5, 0x50},\r
-                     {0x0, 0x0},\r
+       {0xfe, 0x00},\r
+       {0x82, 0xfc},\r
+       {0xb3, 0x78},\r
+       {0xb4, 0x40},\r
+       {0xb5, 0x50},\r
+       {0x00,0x00}, \r
 };\r
 /* Office Colour Temperature : 3500K - 5000K  */\r
 static  struct reginfo sensor_WhiteB_TungstenLamp1[]=\r
 {\r
     //Office\r
-                       {0x82, 0xfc},\r
-                       {0xb3, 0x50},\r
-                       {0xb4, 0x40},\r
-                       {0xb5, 0xa8},\r
-                       {0x0, 0x0},\r
+       {0xfe, 0x00},\r
+       {0x82, 0xfc},\r
+       {0xb3, 0x50},\r
+       {0xb4, 0x40},\r
+       {0xb5, 0xa8},\r
+       {0x00,0x00}, \r
 \r
 };\r
 /* Home Colour Temperature : 2500K - 3500K  */\r
 static  struct reginfo sensor_WhiteB_TungstenLamp2[]=\r
 {\r
     //Home\r
-                       {0x82, 0xfc},\r
-                       {0xb3, 0xa0},\r
-                       {0xb4, 0x45},\r
-                       {0xb5, 0x40},\r
-                      {0x0, 0x0},\r
+       {0xfe, 0x00},\r
+       {0x82, 0xfc},\r
+       {0xb3, 0xa0},\r
+       {0xb4, 0x45},\r
+       {0xb5, 0x40},\r
+       {0x00, 0x00}, \r
 };\r
 static struct reginfo *sensor_WhiteBalanceSeqe[] = {sensor_WhiteB_Auto, sensor_WhiteB_TungstenLamp1,sensor_WhiteB_TungstenLamp2,\r
     sensor_WhiteB_ClearDay, sensor_WhiteB_Cloudy,NULL,\r
@@ -1618,7 +969,7 @@ static  struct reginfo sensor_Brightness0[]=
     // Brightness -2\r
   \r
        {0xfe, 0x01},\r
-       {0x13, 0x40},\r
+       {0x13, 0x70},\r
        {0xfe, 0x02},\r
        {0xd5, 0xe0},\r
        {0x00, 0x00},\r
@@ -1629,7 +980,7 @@ static  struct reginfo sensor_Brightness1[]=
     // Brightness -1\r
  \r
        {0xfe, 0x01},\r
-       {0x13, 0x48},\r
+       {0x13, 0x78},\r
        {0xfe, 0x02},\r
        {0xd5, 0xf0},\r
        {0x00, 0x00}\r
@@ -1640,7 +991,7 @@ static  struct reginfo sensor_Brightness2[]=
     //  Brightness 0\r
 \r
        {0xfe, 0x01},\r
-       {0x13, 0x58},\r
+       {0x13, 0x80},\r
        {0xfe, 0x02},\r
        {0xd5, 0x00},\r
        {0x00, 0x00}\r
@@ -1650,7 +1001,7 @@ static  struct reginfo sensor_Brightness3[]=
 {\r
     // Brightness +1\r
        {0xfe, 0x01},\r
-       {0x13, 0x60},\r
+       {0x13, 0x88},\r
        {0xfe, 0x02},\r
        {0xd5, 0x10},\r
        {0x00, 0x00}\r
@@ -1660,7 +1011,7 @@ static  struct reginfo sensor_Brightness4[]=
 {\r
     //  Brightness +2\r
        {0xfe, 0x01},\r
-       {0x13, 0x68},\r
+       {0x13, 0x90},\r
        {0xfe, 0x02},\r
        {0xd5, 0x20},\r
        {0x00, 0x00}\r
@@ -1670,7 +1021,7 @@ static  struct reginfo sensor_Brightness5[]=
 {\r
     //  Brightness +3\r
        {0xfe, 0x01},\r
-       {0x13, 0x78},\r
+       {0x13, 0x98},\r
        {0xfe, 0x02},\r
        {0xd5, 0x30},\r
 \r
@@ -1886,23 +1237,18 @@ static struct reginfo *sensor_FlipSeqe[] = {sensor_FlipOff, sensor_FlipOn,NULL,}
 static  struct reginfo sensor_SceneAuto[] =\r
 {\r
 {0xfe,0x01},\r
-\r
 {0x3e,0x40},   \r
 {0xfe,0x00},\r
 \r
-{0x00, 0x00}\r
+{0x00,0x00}\r
 };\r
 \r
 static  struct reginfo sensor_SceneNight[] =\r
 {\r
-\r
-\r
-\r
 {0xfe,0x01},\r
-\r
 {0x3e,0x60},   \r
 {0xfe,0x00},\r
-{0x00, 0x00}\r
+{0x00,0x00}\r
 \r
 };\r
 static struct reginfo *sensor_SceneSeqe[] = {sensor_SceneAuto, sensor_SceneNight,NULL,};\r
@@ -2164,10 +1510,8 @@ static const struct sensor_datafmt *sensor_find_datafmt(
 }\r
 \r
 static const struct sensor_datafmt sensor_colour_fmts[] = {\r
-       {V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},\r
-    {V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG},   \r
-    \r
-    \r
+    {V4L2_MBUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_JPEG},\r
+    {V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG}    \r
 };\r
 \r
 typedef struct sensor_info_priv_s\r
@@ -2391,10 +1735,9 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
 \r
     SENSOR_DG("%s %s  cmd(%d) on(%d)\n",SENSOR_NAME_STRING(),__FUNCTION__,cmd,on);\r
        switch (cmd)\r
-       {       \r
+       {\r
                case Sensor_PowerDown:\r
                {\r
-          // honghaishen_test\r
                        if (icl->powerdown) {\r
                                ret = icl->powerdown(icd->pdev, on);\r
                                if (ret == RK29_CAM_IO_SUCCESS) {\r
@@ -2408,9 +1751,7 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
                                        goto sensor_power_end;\r
                                }\r
                        }\r
\r
                        break;\r
-                       \r
                }\r
                case Sensor_Flash:\r
                {\r
@@ -2491,6 +1832,10 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
     }\r
 \r
     ret = sensor_write_array(client, sensor_init_data);\r
+\r
+\r
+    mdelay(300);\r
+\r
        \r
     if (ret != 0)\r
     {\r
@@ -2698,6 +2043,7 @@ static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefm
                SENSOR_DG("%s %dx%d is video format\n", __FUNCTION__, mf->width, mf->height);\r
        return ret;\r
 }\r
+static  unsigned   int shutter_h,shutter_l;\r
 static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)\r
 {\r
     int ret1;\r
@@ -2709,19 +2055,12 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
        struct soc_camera_device *icd = client->dev.platform_data;\r
     struct reginfo *winseqe_set_addr=NULL;\r
     int ret=0, set_w,set_h;\r
-\r
-\r
-       /////////////////  \r
 #if  1\r
 char value;\r
 unsigned   int pid=0,shutter,temp_reg;\r
 \r
 #endif\r
 \r
-//////////////////\r
-\r
-\r
-\r
        fmt = sensor_find_datafmt(mf->code, sensor_colour_fmts,\r
                                   ARRAY_SIZE(sensor_colour_fmts));\r
        if (!fmt) {\r
@@ -2822,42 +2161,35 @@ unsigned   int pid=0,shutter,temp_reg;
             }\r
         }\r
         #endif\r
+\r
+       if ((winseqe_set_addr == sensor_svga)||(winseqe_set_addr == sensor_vga) )\r
+       {\r
+       sensor_write(client, 0xb6, 0x00);  // AEC ON\r
+       sensor_write(client, 0x03, shutter_h);\r
+       sensor_write(client, 0x04, shutter_l);\r
+       msleep(50);\r
+       printk("set preview for rewrite 0x03");\r
+       \r
+       } \r
         ret |= sensor_write_array(client, winseqe_set_addr);\r
-               msleep(200);\r
 #if 1\r
-               if (winseqe_set_addr == sensor_uxga) { \r
-\r
-\r
+               if (winseqe_set_addr == sensor_uxga) \r
+       { \r
                                sensor_write(client, 0xfe, 0x00);\r
-                               sensor_write(client, 0xb6, 0x02);\r
-\r
-\r
+                               sensor_write(client, 0xb6, 0x02);  // AEC OFF\r
                                sensor_read(client, 0x03, &value);\r
+                               shutter_h=value;\r
                                pid |= (value << 8);\r
                               sensor_read(client, 0x04, &value);\r
+                                shutter_l=value;\r
                                pid |= (value & 0xff);\r
                                shutter=pid;\r
-\r
-\r
-                               temp_reg= shutter /2;   // 2\r
-\r
+                               temp_reg= shutter /2;\r
                                if(temp_reg < 1) temp_reg = 1;\r
-\r
-\r
                                sensor_write(client, 0x03, ((temp_reg>>8)&0xff));\r
-                               sensor_write(client, 0x04, (temp_reg&0xff));\r
-\r
-\r
-\r
+                              sensor_write(client, 0x04, (temp_reg&0xff));\r
         }\r
-               \r
-\r
-               if ((winseqe_set_addr == sensor_svga)||(winseqe_set_addr == sensor_vga) ){\r
-                       mdelay(50);//200\r
-                       sensor_write(client, 0xB6, 0x03);\r
-                       mdelay(300);\r
-        } \r
-#endif   //james\r
+#endif   \r
 \r
         if (ret != 0) {\r
             SENSOR_TR("%s set format capability failed\n", SENSOR_NAME_STRING());\r
@@ -2893,6 +2225,7 @@ unsigned   int pid=0,shutter,temp_reg;
                        sensor_set_effect(icd, qctrl,sensor->info_priv.effect);\r
                        qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_DO_WHITE_BALANCE);\r
                        sensor_set_whiteBalance(icd, qctrl,sensor->info_priv.whiteBalance);\r
+            msleep(600);\r
                        sensor->info_priv.video2preview = false;\r
                        sensor->info_priv.snap2preview = false;\r
                }\r
@@ -2906,8 +2239,7 @@ unsigned   int pid=0,shutter,temp_reg;
 \r
        mf->width = set_w;\r
     mf->height = set_h;\r
-       msleep(100);\r
-\r
+     msleep(100);  //james added\r
 sensor_s_fmt_end:\r
     return ret;\r
 }\r
@@ -3693,7 +3025,6 @@ static int sensor_video_probe(struct soc_camera_device *icd,
     /* soft reset */\r
 \r
     /* check if it is an sensor sensor */\r
-       #if 0    // honghaishen_test\r
     ret = sensor_read(client, 0xf0, &value);\r
     if (ret != 0) {\r
         SENSOR_TR("read chip id high byte failed\n");\r
@@ -3719,8 +3050,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
         ret = -ENODEV;\r
         goto sensor_video_probe_err;\r
     }\r
-#endif\r
-sensor->model = SENSOR_V4L2_IDENT; \r
+\r
     return 0;\r
 \r
 sensor_video_probe_err:\r
@@ -3933,3 +3263,5 @@ MODULE_AUTHOR("ddl <kernel@rock-chips>");
 MODULE_LICENSE("GPL");\r
 \r
 \r
+\r
+\r
index 09a103ece714c42870ee849b461940059a421338..bd290d9ab5f5d23e4d05f02a800a3d89ffa8dc16 100755 (executable)
@@ -1,13 +1,17 @@
 
 /*
-o* Driver for MT9M001 CMOS Image Sensor from Micron
+ * Driver for SP2518 CMOS Image Sensor from Superpix
  *
  * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
- */
+*
+*  History                                                Author                Data
+*  First Version                                        yuanjianping       2012-09-20
+*  Set P0:0x14 = 0x40                             zengchaohui       2012-09-20
+*/
 
 #include <linux/videodev2.h>
 #include <linux/slab.h>
@@ -47,13 +51,13 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define SENSOR_V4L2_IDENT V4L2_IDENT_SP2518
 #define SENSOR_ID 0x53
 #define SENSOR_ID_REG  0x02
-#define SENSOR_MIN_WIDTH    640
-#define SENSOR_MIN_HEIGHT   480
+#define SENSOR_MIN_WIDTH    176//640
+#define SENSOR_MIN_HEIGHT   144//480
 #define SENSOR_MAX_WIDTH    1600
 #define SENSOR_MAX_HEIGHT   1200
 #define SENSOR_INIT_WIDTH        800                   /* Sensor pixel size for sensor_init_data array */
-#define SENSOR_INIT_HEIGHT  600
-#define SENSOR_INIT_WINSEQADR sensor_vga
+#define SENSOR_INIT_HEIGHT    600
+#define SENSOR_INIT_WINSEQADR sensor_svga
 #define SENSOR_INIT_PIXFMT V4L2_MBUS_FMT_YUYV8_2X8
 
 #define CONFIG_SENSOR_WhiteBalance     1
@@ -96,14 +100,19 @@ module_param(debug, int, S_IRUGO|S_IWUSR);
 #define SENSOR_INIT_IS_OK    (0x01<<28)
 
 //AE
-#define  SP2518_P0_0xf7  0x78///0x80//78
-#define  SP2518_P0_0xf8  0x6e///0x74//6e
-#define  SP2518_P0_0xf9  0x74///0x80//74
-#define  SP2518_P0_0xfa  0x6a///0x74//6a
+#define  SP2518_P0_0xf7  0x80//78
+
+#define  SP2518_P0_0xf8  0x74//6e
+
+#define  SP2518_P0_0xf9  0x80//74
+
+#define  SP2518_P0_0xfa  0x74//6a
 
 //HEQ
-#define  SP2518_P0_0xdd  0x7c  //0x80 modify by sp_yjp,20120814
-#define  SP2518_P0_0xde  0x90  //0x95 modify by sp_yjp,20120814
+
+#define  SP2518_P0_0xdd  0x80
+
+#define  SP2518_P0_0xde  0x95
 
 //auto lum
 #define SP2518_NORMAL_Y0ffset            0x10  //0x0f   modify by sp_yjp,20120813
@@ -122,7 +131,6 @@ struct reginfo
 /* init 640X480 VGA */
 static struct reginfo sensor_init_data[] =
 {
-       #if 1
        {0xfd,0x00},
        {0x1b,0x1a},//maximum drv ability //0x02 modify by sp_yjp,20120809
        {0x0e,0x01},
@@ -131,7 +139,7 @@ static struct reginfo sensor_init_data[] =
        {0x10,0x2e},
        {0x11,0x00},
        {0x12,0x4f},
-       {0x14,0x20},
+       {0x14,0x40},// 0x20 zch 20120920
        {0x16,0x02},
        {0x17,0x10},
        {0x1a,0x1f},
@@ -141,7 +149,7 @@ static struct reginfo sensor_init_data[] =
        {0x25,0x10},
        {0x26,0x25},
        {0x27,0x6d},
-       {0x2c,0x31},//Ronlus remove balck dot0x45},
+       {0x2c,0x23},//31 Ronlus remove balck dot0x45},
        {0x2d,0x75},
        {0x2e,0x38},//sxga 0x18
 
@@ -192,44 +200,7 @@ static struct reginfo sensor_init_data[] =
        {0x95,0x38},
        {0x9c,0x6c},
        {0x9d,0x38},    
-
-
        #if 0
-       ///SP2518 UXGA 24MEclk 3±¶Æµ 1·ÖƵ 50Hz fix 11fps
-       {0xfd , 0x00},
-       {0x03 , 0x03},
-       {0x04 , 0xa8},
-       {0x05 , 0x00},
-       {0x06 , 0x6d},
-       {0x07 , 0x00},
-       {0x08 , 0x6d},
-       {0x09 , 0x00},
-       {0x0a , 0xe4},
-       {0x2f , 0x00},
-       {0x30 , 0x08},
-       {0xf0 , 0x9c},
-       {0xf1 , 0x00},
-       {0xfd , 0x01},
-       {0x90 , 0x09},
-       {0x92 , 0x01},
-       {0x98 , 0x9c},
-       {0x99 , 0x00},
-       {0x9a , 0x01},
-       {0x9b , 0x00},
-       ///Status
-       {0xfd , 0x01},
-       {0xce , 0x7c},
-       {0xcf , 0x05},
-       {0xd0 , 0x7c},
-       {0xd1 , 0x05},
-       {0xd7 , 0x98},
-       {0xd8 , 0x00},
-       {0xd9 , 0x9c},
-       {0xda , 0x00},
-       {0xfd , 0x00},
-       #endif
-
-       #if 1
        ///SP2518 UXGA 24MEclk 3±¶Æµ 1·ÖƵ 50Hz fix 10fps
        {0xfd , 0x00},
        {0x03 , 0x03},
@@ -257,83 +228,47 @@ static struct reginfo sensor_init_data[] =
        {0xcf , 0x05},
        {0xd0 , 0xaa},
        {0xd1 , 0x05},
-       {0xd7 , 0x8d},
-       {0xd8 , 0x00},
-       {0xd9 , 0x91},
-       {0xda , 0x00},
-       {0xfd , 0x00},
-       #endif
-       
-       
-       #if 0
-       /// UXGA 24MEclk 3±¶Æµ 1·ÖƵ 50Hz fix 9fps
-       {0xfd , 0x00},
-       {0x03 , 0x03},
-       {0x04 , 0x42},
-       {0x05 , 0x00},
-       {0x06 , 0xf0},
-       {0x07 , 0x00},
-       {0x08 , 0xf0},
-       {0x09 , 0x01},
-       {0x0a , 0x71},
-       {0x2f , 0x00},
-       {0x30 , 0x08},
-       {0xf0 , 0x8b},
-       {0xf1 , 0x00},
-       {0xfd , 0x01},
-       {0x90 , 0x0b},
-       {0x92 , 0x01},
-       {0x98 , 0x8b},
-       {0x99 , 0x00},
-       {0x9a , 0x01},
-       {0x9b , 0x00},
-       ///Status  
-       {0xfd , 0x01},
-       {0xce , 0xf9},
-       {0xcf , 0x05},
-       {0xd0 , 0xf9},
-       {0xd1 , 0x05},
-       {0xd7 , 0x87},
+       {0xd7 , 0x93},//8d
        {0xd8 , 0x00},
-       {0xd9 , 0x8b},
+       {0xd9 , 0x97},//91
        {0xda , 0x00},
        {0xfd , 0x00},
        #endif
        
-       #if 0
-       /*24*3pll 8~13fps 50hz*/
-       {0xfd , 0x00},
-       {0x03 , 0x03},
-       {0x04 , 0xf6},
-       {0x05 , 0x00},
-       {0x06 , 0x00},
-       {0x07 , 0x00},
-       {0x08 , 0x00},
-       {0x09 , 0x00},
-       {0x0a , 0x8b},
-       ///////////////////SP2518_write_cmos_sensor(0x2f , 0x00},       modify by sp_yjp,20120809
-       {0x30 , 0x08},  //0x08 modify by sp_yjp,20120809
-       {0xf0 , 0xa9},
-       {0xf1 , 0x00},
-       {0xfd , 0x01},
-       {0x90 , 0x0c},
-       {0x92 , 0x01},
-       {0x98 , 0xa9},
-       {0x99 , 0x00},
-       {0x9a , 0x01},
-       {0x9b , 0x00},
-       
-       //Status
-       {0xfd , 0x01},
-       {0xce , 0xec},
-       {0xcf , 0x07},
-       {0xd0 , 0xec},
-       {0xd1 , 0x07},
-       {0xd7 , 0xa5},
-       {0xd8 , 0x00},
-       {0xd9 , 0xa9},
-       {0xda , 0x00},
-       {0xfd , 0x00},
+       #if 1
+       /*24*3pll 13-13fps 50hz*/
+               
+       {0xfd,0x00},
+       {0x03,0x03},
+       {0x04,0xf6},
+       {0x05,0x00},
+       {0x06,0x00},
+       {0x07,0x00},
+       {0x08,0x00},
+       {0x09,0x00},
+       {0x0a,0x8b},
+       {0x2f,0x00},
+       {0x30,0x08},
+       {0xf0,0xa9},
+       {0xf1,0x00},
+       {0xfd,0x01},
+       {0x90,0x07},
+       {0x92,0x01},
+       {0x98,0xa9},
+       {0x99,0x00},
+       {0x9a,0x01},
+       {0x9b,0x00},
+       {0xfd,0x01},
+       {0xce,0x9f},
+       {0xcf,0x04},
+       {0xd0,0x9f},
+       {0xd1,0x04},
+       {0xd7,0xa5},
+       {0xd8,0x00},
+       {0xd9,0xa9},
+       {0xda,0x00},
+       {0xfd,0x00},
+
        #endif
 
        {0xfd,0x01},
@@ -441,6 +376,11 @@ static struct reginfo sensor_init_data[] =
        {0x1a,0x80},
        {0x1b,0x80},
        {0x43,0x80},
+        //outdoor
+        {0x00,0xd4},
+        {0x01,0xb0},
+        {0x02,0x90},
+        {0x03,0x78},
        //d65
        {0x35,0xd6},//d6;b0
        {0x36,0xf0},//f0;d1;e9
@@ -495,14 +435,14 @@ static struct reginfo sensor_init_data[] =
        {0xc0,0xb0},
        {0xc1,0xf0},
        
-       {0xd3,0x68},    //0x77 modify by sp_yjp,20120814
-       {0xd4,0x68},    //0x77 modify by sp_yjp,20120814
-       {0xd6,0x68},    //0x77 modify by sp_yjp,20120814
-       {0xd7,0x68},    //0x77 modify by sp_yjp,20120814
-       {0xd8,0x68},    //0x77 modify by sp_yjp,20120814
-       {0xd9,0x68},    //0x77 modify by sp_yjp,20120814
-       {0xda,0x68},    //0x77 modify by sp_yjp,20120814
-       {0xdb,0x68},    //0x77 modify by sp_yjp,20120814
+        {0xd3,0x77},
+        {0xd4,0x77},
+        {0xd6,0x77},
+        {0xd7,0x77},
+        {0xd8,0x77},
+        {0xd9,0x77},
+        {0xda,0x77},
+        {0xdb,0x77},
        //uv_dif
        {0xfd,0x00},
        {0xf3,0x03},
@@ -551,6 +491,51 @@ static struct reginfo sensor_init_data[] =
        {0x88,0xEF},//f1
        {0x89,0xF7},//f9
        {0x8a,0xFF},//ff
+ /*//¹â°ß¹ý¶ÈºÃ
+ //gamma1
+       {0xfd,0x00},
+       {0x8b,0x00},
+       {0x8c,0x14},
+       {0x8d,0x24},
+       {0x8e,0x3A},
+       {0x8f,0x59},
+       {0x90,0x70},
+       {0x91,0x85},
+       {0x92,0x96},
+       {0x93,0xA6},
+       {0x94,0xB3},
+       {0x95,0xBE},
+       {0x96,0xC9},
+       {0x97,0xD2},
+       {0x98,0xDB},
+       {0x99,0xE3},
+       {0x9a,0xEB},
+       {0x9b,0xF2},
+       {0xfd,0x01},
+       {0x8d,0xF9},
+       {0x8e,0xFF},
+       //gamma2   
+       {0xfd,0x00},
+       {0x78,0x00},
+       {0x79,0x14},
+       {0x7a,0x24},
+       {0x7b,0x3A},
+       {0x7c,0x59},
+       {0x7d,0x70},
+       {0x7e,0x85},
+       {0x7f,0x96},
+       {0x80,0xA6},
+       {0x81,0xB3},
+       {0x82,0xBE},
+       {0x83,0xC9},
+       {0x84,0xD2},
+       {0x85,0xDB},
+       {0x86,0xE3},
+       {0x87,0xEB},
+       {0x88,0xF2},
+       {0x89,0xF9},
+       {0x8a,0xFF},    
+*/
        //gamma_ae  
        {0xfd,0x01},
        {0x96,0x46},
@@ -614,12 +599,13 @@ static struct reginfo sensor_init_data[] =
        
        {0x35,0x40},//3        
        
-       {0x1b,0x02},
+       {0x1b,0x1a},
        {0xe7,0x03},
        {0xe7,0x00},
 
        //SP2518_config_window(WINDOW_SIZE_VGA}
-       #if 1
+       #if 1   //
+       /*
        {0xfd,0x00},
        {0x4b,0x00},
        {0x4c,0x00},
@@ -640,18 +626,36 @@ static struct reginfo sensor_init_data[] =
        {0x0c,0x02},    //640
        {0x0d,0x80},
        {0x0e,0x01},
-       {0xfd,0x00},    
-       #else   
        {0xfd,0x00},
-       {0x4b,0x00},
-       {0x4c,0x00},
+       */
+       #else    //uxga
+       {0xfd,0x00},    
        {0x47,0x00},
        {0x48,0x00},
+       {0x49,0x04},
+       {0x4a,0xb0},
+       
+       {0x4b,0x00},
+       {0x4c,0x00},    
        {0x4d,0x06},
-       {0x4e,0x40},
+       {0x4e,0x40},    
+
+       {0xfd,0x01},
+       {0x0e,0x00},
+       {0xfd,0x00},
+       #endif
+       //SVGA
+       {0xfd,0x00},    
+
+       {0x47,0x00},
+       {0x48,0x00},
        {0x49,0x04},
        {0x4a,0xb0},
        
+       {0x4b,0x00},
+       {0x4c,0x00},    
+       {0x4d,0x06},
+       {0x4e,0x40},    
        {0xfd,0x01},
        {0x06,0x00},
        {0x07,0x40},
@@ -661,12 +665,11 @@ static struct reginfo sensor_init_data[] =
        {0x0b,0x58},
        {0x0c,0x03},    //800
        {0x0d,0x20},
-       
        {0x0e,0x01},
-       #endif
-       #endif
+       {0xfd,0x00},
 
-       {0x5d,0x0e},    
+       
+       {0x5d,0x0e},    //vsync delay
        {0xff,0xff}//The end flag
 };
 
@@ -687,9 +690,7 @@ static struct reginfo sensor_uxga[] =
 
        {0xfd,0x01},
        {0x0e,0x00},
-       {0xfd,0x00},
-       {0xfd,0x00},
-       
+       {0xfd,0x00},    
        {0xff,0xff}//The end flag
 };
 
@@ -697,6 +698,7 @@ static struct reginfo sensor_uxga[] =
 /* 1280X1024 SXGA */
 static struct reginfo sensor_sxga[] =
 {
+#if 0
        {0xfd,0x00},    
        {0x47,0x00},
        {0x48,0x50},
@@ -711,12 +713,13 @@ static struct reginfo sensor_sxga[] =
        {0xfd,0x01},
        {0x0e,0x00},
        {0xfd,0x00},
+#endif 
        {0xff,0xff}
 };
 
 /* 800X600 SVGA*/
 static struct reginfo sensor_svga[] =
-{      
+{
        {0xfd,0x00},    
 
        {0x47,0x00},
@@ -739,13 +742,13 @@ static struct reginfo sensor_svga[] =
        {0x0d,0x20},
        {0x0e,0x01},
        {0xfd,0x00},
-       
        {0xff,0xff}//The end flag
 };
 
 /* 640X480 VGA */
 static struct reginfo sensor_vga[] =
 {
+#if 0
        {0xfd,0x00},
                
        {0x47,0x00},
@@ -769,7 +772,7 @@ static struct reginfo sensor_vga[] =
        {0x0d,0x80},
        {0x0e,0x01},
        {0xfd,0x00},    
-       
+#endif 
        {0xff,0xff}//The end flag
 
 
@@ -779,13 +782,13 @@ static struct reginfo sensor_vga[] =
 /* 352X288 CIF */
 static struct reginfo sensor_cif[] =
 {
-    {0x00, 0x00},
-    //{0xff,0xff}
+       {0xfd, 0x00},{0xff,0xff}
 };
 
 /* 320*240 QVGA */
 static  struct reginfo sensor_qvga[] =
 {
+#if 0
        {0xfd,0x00},
                
        {0x47,0x00},
@@ -811,24 +814,27 @@ static  struct reginfo sensor_qvga[] =
        
        {0x0e,0x01},
        {0xfd,0x00},    
-
+#endif
        {0xff,0xff}//The end flag
 };
 
 /* 176X144 QCIF*/
 static struct reginfo sensor_qcif[] =
 {
-    {0x00, 0x00}//,{0xff,0xff}
+    //{0xfd, 0x00},
+    {0xff,0xff}
 };
 
 static  struct reginfo sensor_ClrFmt_YUYV[]=
 {
-    {0xfd, 0x00},{0xff,0xff}
+    //{0xfd, 0x00},
+    {0xff,0xff}
 };
 
 static  struct reginfo sensor_ClrFmt_UYVY[]=
 {
-    {0xfd, 0x00},{0xff,0xff}
+    //{0xfd, 0x00},
+    {0xff,0xff}
 };
 
 ///=========SP2518-modify by sp_yjp,20120529=================
@@ -919,7 +925,6 @@ static  struct reginfo sensor_Brightness2[]=
 {
        {0xfd, 0x00},
        {0xdc, 0x00},
-       {0xfd, 0x00},
        {0xff, 0xff}
 };
 
@@ -1277,36 +1282,39 @@ static  struct reginfo sensor_SceneAuto[] =
        {0xb2,SP2518_NORMAL_Y0ffset},
        {0xb3,0x1f},
 
-       ///SP2518 UXGA 24MEclk 3PLL 50Hz fix 10fps
-       {0xfd , 0x00},
-       {0x03 , 0x03},
-       {0x04 , 0x66},
-       {0x05 , 0x00},
-       {0x06 , 0x8b},
-       {0x07 , 0x00},
-       {0x08 , 0x8b},
-       {0x09 , 0x01},
-       {0x0a , 0x3b},
-       {0xf0 , 0x91},
-       {0xf1 , 0x00},
-       {0xfd , 0x01},
-       {0x90 , 0x0a},
-       {0x92 , 0x01},
-       {0x98 , 0x91},
-       {0x99 , 0x00},
-       {0x9a , 0x01},
-       {0x9b , 0x00},
-       ///Status 
-       {0xfd , 0x01},
-       {0xce , 0xaa},
-       {0xcf , 0x05},
-       {0xd0 , 0xaa},
-       {0xd1 , 0x05},
-       {0xd7 , 0x8d},
-       {0xd8 , 0x00},
-       {0xd9 , 0x91},
-       {0xda , 0x00},
-       {0xfd , 0x00},
+       //SP2518 UXGA 24MEclk 3PLL 50Hz fix13fps
+               
+       {0xfd,0x00},
+       {0x03,0x03},
+       {0x04,0xf6},
+       {0x05,0x00},
+       {0x06,0x00},
+       {0x07,0x00},
+       {0x08,0x00},
+       {0x09,0x00},
+       {0x0a,0x8b},
+       {0x2f,0x00},
+       {0x30,0x08},
+       {0xf0,0xa9},
+       {0xf1,0x00},
+       {0xfd,0x01},
+       {0x90,0x07},
+       {0x92,0x01},
+       {0x98,0xa9},
+       {0x99,0x00},
+       {0x9a,0x01},
+       {0x9b,0x00},
+       {0xfd,0x01},
+       {0xce,0x9f},
+       {0xcf,0x04},
+       {0xd0,0x9f},
+       {0xd1,0x04},
+       {0xd7,0xa5},
+       {0xd8,0x00},
+       {0xd9,0xa9},
+       {0xda,0x00},
+       {0xfd,0x00},
+
        #endif
        
        {0xfd, 0x00},
@@ -1345,9 +1353,9 @@ static  struct reginfo sensor_SceneNight[] =
        {0xcf , 0x05},
        {0xd0 , 0x50},
        {0xd1 , 0x05},
-       {0xd7 , 0x51},
+       {0xd7 , 0x57},//51
        {0xd8 , 0x00},
-       {0xd9 , 0x55},
+       {0xd9 , 0x5b},//55
        {0xda , 0x00},
        #endif
         
@@ -1783,11 +1791,13 @@ static int sensor_read(struct i2c_client *client, u8 reg, u8 *val)
 }
 
 /* write a array of registers  */
+#if 1
 static int sensor_write_array(struct i2c_client *client, struct reginfo *regarray)
 {
     int err;
     int i = 0;
 
+    //for(i=0; i < sizeof(sensor_init_data) / 2;i++)
        while((regarray[i].reg != 0xff) || (regarray[i].val != 0xff))
     {
         err = sensor_write(client, regarray[i].reg, regarray[i].val);
@@ -1801,28 +1811,51 @@ static int sensor_write_array(struct i2c_client *client, struct reginfo *regarra
     
     return 0;
 }
-#if CONFIG_SENSOR_I2C_RDWRCHK
-static int sensor_check_array(struct i2c_client *client, struct reginfo *regarray)
+#else
+static int sensor_write_array(struct i2c_client *client, struct reginfo *regarray)
 {
-    int ret;
+    int err;
     int i = 0;
-
-    u8 value;
-
-    while((regarray[i].reg != 0xff) || (regarray[i].val != 0xff))
+       u8 val_read;
+    while (regarray[i].reg != 0)
     {
-        ret = sensor_read(client,regarray[i].reg,&value);
-        if(ret !=0)
-        {
-            SENSOR_TR("read value failed\n");
-
-        }
-        if(regarray[i].val != value)
+        err = sensor_write(client, regarray[i].reg, regarray[i].val);
+        if (err != 0)
         {
-            SENSOR_DG("%s reg[0x%x] check err,writte :0x%x  read:0x%x\n",__FUNCTION__,regarray[i].reg,regarray[i].val,value);
+            SENSOR_TR("%s..write failed current i = %d\n", SENSOR_NAME_STRING(),i);
+            return err;
         }
-
+               err = sensor_read(client, regarray[i].reg, &val_read);
+               SENSOR_TR("%s..reg[0x%x]=0x%x,0x%x\n", SENSOR_NAME_STRING(),regarray[i].reg, val_read, regarray[i].val);
+        i++;
     }
+    return 0;
+}
+#endif
+
+#if CONFIG_SENSOR_I2C_RDWRCHK
+static int sensor_check_array(struct i2c_client *client, struct reginfo *regarray)
+{
+  int ret;
+  int i = 0;
+  
+  u8 value;
+  
+  SENSOR_DG("%s >>>>>>>>>>>>>>>>>>>>>>\n",__FUNCTION__);
+  for(i=0;i<sizeof(sensor_init_data) / 2;i++)
+       {
+     ret = sensor_read(client,regarray[i].reg,&value);
+        if(ret !=0)
+        {
+         SENSOR_TR("read value failed\n");
+
+        }
+        if(regarray[i].val != value)
+        {
+         SENSOR_DG("%s reg[0x%x] check err,writte :0x%x  read:0x%x\n",__FUNCTION__,regarray[i].reg,regarray[i].val,value);
+        }
+        
+  }
   
        
   return 0;
@@ -1842,9 +1875,10 @@ static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd
                                ret = icl->powerdown(icd->pdev, on);
                                if (ret == RK29_CAM_IO_SUCCESS) {
                                        if (on == 0) {
-                                               mdelay(2);
+                                               mdelay(20);    // 2 modify by sp_yjp,20120831
                                                if (icl->reset)
                                                        icl->reset(icd->pdev);
+                                               mdelay(50);    // add by sp_yjp,20120831
                                        }
                                } else if (ret == RK29_CAM_EIO_REQUESTFAIL) {
                                        ret = -ENODEV;
@@ -2008,8 +2042,7 @@ static int sensor_deactivate(struct i2c_client *client)
 }
 static  struct reginfo sensor_power_down_sequence[]=
 {
-    {0xfd,0x00},
-    {0xff,0xff}
+    {0xfd,0x00},{0xff,0xff}
 };
 static int sensor_suspend(struct soc_camera_device *icd, pm_message_t pm_msg)
 {
@@ -2162,43 +2195,53 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
     set_w = mf->width;
     set_h = mf->height;
 
-       if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
+       if (((set_w <= 176) && (set_h <= 144)) && (sensor_qcif[0].reg!=0xff))
        {
                winseqe_set_addr = sensor_qcif;
         set_w = 176;
         set_h = 144;
        }
-       else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
+       else if (((set_w <= 320) && (set_h <= 240)) && (sensor_qvga[0].reg!=0xff))
     {
         winseqe_set_addr = sensor_qvga;
         set_w = 320;
         set_h = 240;
     }
-    else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
+    else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=0xff))
     {
         winseqe_set_addr = sensor_cif;
         set_w = 352;
         set_h = 288;
     }
-    else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
+    else if (((set_w <= 640) && (set_h <= 480)) && (sensor_vga[0].reg!=0xff))
     {
         winseqe_set_addr = sensor_vga;
-        set_w = 640-16;
-        set_h = 480-16;
+        set_w = 640;
+        set_h = 480;
     }
-    else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg)
+    else if (((set_w <= 800) && (set_h <= 600)))
     {
-        winseqe_set_addr = sensor_svga;
-        set_w = 800;
-        set_h = 600;
+        if (sensor_svga[0].reg!=0xff) {
+            winseqe_set_addr = sensor_svga;
+            set_w = 800-16;
+            set_h = 600-12;
+        } else if (sensor_vga[0].reg!=0xff) {
+            winseqe_set_addr = sensor_vga;
+            set_w = 640-16;
+            set_h = 480-12;
+        } else if (sensor_uxga[0].reg!=0xff) {
+            winseqe_set_addr = sensor_uxga;
+            set_w = 1600-16;
+            set_h = 1200-12;
+        }
     }
-    else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg)
+    else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=0xff))
     {
         winseqe_set_addr = sensor_sxga;
         set_w = 1280;
         set_h = 1024;
     }
-    else if (((set_w <= 1600) && (set_h <= 1200)) && sensor_uxga[0].reg)
+    else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=0xff))
     {
         winseqe_set_addr = sensor_uxga;
         set_w = 1600;
@@ -2211,7 +2254,12 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
         set_h = SENSOR_INIT_HEIGHT;            
                SENSOR_TR("\n %s..%s Format is Invalidate. pix->width = %d.. pix->height = %d\n",SENSOR_NAME_STRING(),__FUNCTION__,mf->width,mf->height);
     }
+    printk("%s(%d): %dx%d -> %dx%d\n",__FUNCTION__,__LINE__, mf->width,mf->height,set_w,set_h);
 
+    printk("win: %p %p %p %p %p %p\n",winseqe_set_addr,sensor->info_priv.winseqe_cur_addr,
+        sensor_uxga,sensor_svga,sensor_vga,sensor_sxga);
+
+    
     if ((int)winseqe_set_addr  != sensor->info_priv.winseqe_cur_addr) {
         #if CONFIG_SENSOR_Flash
         if (sensor_fmt_capturechk(sd,mf) == true) {      /* ddl@rock-chips.com : Capture */
@@ -2304,40 +2352,54 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
     else if (mf->width < SENSOR_MIN_WIDTH)
         mf->width = SENSOR_MIN_WIDTH;
 
+
+    if ((mf->width == 320) && (mf->height == 240)) {
+        printk("%s(%d): qvga ERROR\n",__FUNCTION__,__LINE__);
+        return -1;
+    }
     set_w = mf->width;
     set_h = mf->height;
 
-       if (((set_w <= 176) && (set_h <= 144)) && sensor_qcif[0].reg)
+       if (((set_w <= 176) && (set_h <= 144)) && (sensor_qcif[0].reg!=0xff))
        {
         set_w = 176;
         set_h = 144;
        }
-       else if (((set_w <= 320) && (set_h <= 240)) && sensor_qvga[0].reg)
+       else if (((set_w == 320) && (set_h == 240)))// && (sensor_qvga[0].reg!=0xff))
     {
         set_w = 320;
         set_h = 240;
+        ret = -1;
     }
-    else if (((set_w <= 352) && (set_h<= 288)) && sensor_cif[0].reg)
+    else if (((set_w <= 352) && (set_h<= 288)) && (sensor_cif[0].reg!=0xff))
     {
         set_w = 352;
         set_h = 288;
     }
-    else if (((set_w <= 640) && (set_h <= 480)) && sensor_vga[0].reg)
+    else if (((set_w <= 640) && (set_h <= 480)) && (sensor_vga[0].reg!=0xff))
     {
         set_w = 640;
         set_h = 480;
     }
-    else if (((set_w <= 800) && (set_h <= 600)) && sensor_svga[0].reg)
+    else if (((set_w <= 800) && (set_h <= 600)))
     {
-        set_w = 800;
-        set_h = 600;
+        if (sensor_svga[0].reg!=0xff) {
+            set_w = 800-16;
+            set_h = 600-12;
+        } else if (sensor_vga[0].reg!=0xff) {
+            set_w = 640-16;
+            set_h = 480-12;
+        } else if (sensor_uxga[0].reg!=0xff) {
+            set_w = 1600-16;
+            set_h = 1200-12;
+        }
     }
-    else if (((set_w <= 1280) && (set_h <= 1024)) && sensor_sxga[0].reg)
+    else if (((set_w <= 1280) && (set_h <= 1024)) && (sensor_sxga[0].reg!=0xff))
     {
         set_w = 1280;
         set_h = 1024;
     }
-    else if (((set_w <= 1600) && (set_h <= 1200)) && sensor_uxga[0].reg)
+    else if (((set_w <= 1600) && (set_h <= 1200)) && (sensor_uxga[0].reg!=0xff))
     {
         set_w = 1600;
         set_h = 1200;
@@ -3068,9 +3130,10 @@ static int sensor_video_probe(struct soc_camera_device *icd,
                ret = -ENODEV;
                goto sensor_video_probe_err;
        }
-       msleep(100);
+       msleep(10);
 
     /* check if it is an sensor sensor */
+    ////////ret = sensor_read(client, 0x00, &pid);
        ret = sensor_read(client, SENSOR_ID_REG, &pid);
     if (ret != 0) {
         SENSOR_TR("%s read chip id high byte failed\n",SENSOR_NAME_STRING());
@@ -3079,7 +3142,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
     }
 
     SENSOR_DG("\n %s  pid = 0x%x\n", SENSOR_NAME_STRING(), pid);
-
+#if 1
     if (pid == SENSOR_ID) {
         sensor->model = SENSOR_V4L2_IDENT;
     } else {
@@ -3087,6 +3150,10 @@ static int sensor_video_probe(struct soc_camera_device *icd,
         ret = -ENODEV;
         goto sensor_video_probe_err;
     }
+#else
+       sensor->model = SENSOR_V4L2_IDENT;
+
+#endif
     return 0;
 
 sensor_video_probe_err:
@@ -3275,7 +3342,12 @@ static struct i2c_driver sensor_i2c_driver = {
 
 static int __init sensor_mod_init(void)
 {
+    printk("\n*****************%s..%s.. \n",__FUNCTION__,SENSOR_NAME_STRING());
+#ifdef CONFIG_SOC_CAMERA_FCAM
+    return 0;
+#else
     return i2c_add_driver(&sensor_i2c_driver);
+#endif
 }
 
 static void __exit sensor_mod_exit(void)
@@ -3289,5 +3361,29 @@ module_exit(sensor_mod_exit);
 MODULE_DESCRIPTION(SENSOR_NAME_STRING(Camera sensor driver));
 MODULE_AUTHOR("ddl <kernel@rock-chips>");
 MODULE_LICENSE("GPL");
+/*
+struct cam_sensor_info cam_sensor_info_SP2518={
+    "SP2518",
+    1,
+    1,
+    0x30>>1,
+    0,
+    SENSOR_ID_REG, 
+    SENSOR_ID,
+    0xff,
+    0xff,
+
+    &sensor_ops,
+    &sensor_subdev_ops,
+    sensor_deactivate,
+    sensor_read,
+    sensor_write,
+    0,
+    sensor_video_probe,
+};
+
+EXPORT_SYMBOL_GPL(cam_sensor_info_SP2518);
+*/
+