camera hi253驱动

/*
 * The code contained herein is licensed under the GNU General Public
 * License. You may obtain a copy of the GNU General Public License
 * Version 2 or later at the following locations:
 *
 * http://www.opensource.org/licenses/gpl-license.html
 * http://www.gnu.org/copyleft/gpl.html
 */
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/ctype.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/i2c.h>
#include <linux/regulator/consumer.h>
#include <mach/hardware.h>
#include <media/v4l2-int-device.h>
#include "mxc_v4l2_capture.h"

#define HI253_VOLTAGE_ANALOG               2800000
#define HI253_VOLTAGE_DIGITAL_CORE         1500000
#define HI253_VOLTAGE_DIGITAL_IO           1800000
#define HI253_VOLTAGE_DIGITAL_GPO	         2800000

/* Check these values! */
#define MIN_FPS 15
#define MAX_FPS 30
#define DEFAULT_FPS 30

#define HI253_XCLK_MIN 6000000
#define HI253_XCLK_MAX 48000000
#define REG_TERM 0xff	/* terminating list entry for reg */
#define VAL_TERM 0xff	/* terminating list entry for val */

enum hi253_mode {
	hi253_mode_MIN = 0,
	hi253_mode_VGA_640_480 = 0,
	hi253_mode_QVGA_320_240 = 1,
	hi253_mode_XGA_1024_768 = 2,
	hi253_mode_QXGA_1600_1200 = 3,
	hi253_mode_NTSC_720_480 = 4,
	hi253_mode_PAL_720_576 = 5,
	hi253_mode_MAX = 5
};

enum hi253_frame_rate {
	hi253_15_fps,
	hi253_30_fps
};

struct reg_value {
	u16 u16RegAddr;
	u8 u8Val;
	u8 u8Mask;
	u32 u32Delay_ms;
};

struct sensor_reg {
	u16 reg;
	u8 val;
};

struct hi253_mode_info {
	enum hi253_mode mode;
	u32 width;
	u32 height;
	/*struct reg_value *init_data_ptr;*/
	struct sensor_reg *init_data_ptr;
	u32 init_data_size;
};



/*!
 * Maintains the information on the current state of the sesor.
 */
struct sensor {
	const struct hi253_platform_data *platform_data;
	struct v4l2_int_device *v4l2_int_device;
	struct i2c_client *i2c_client;
	struct v4l2_pix_format pix;
	struct v4l2_captureparm streamcap;
	bool on;

	/* control settings */
	int brightness;
	int hue;
	int contrast;
	int saturation;
	int red;
	int green;
	int blue;
	int ae_mode;

	u32 mclk;
	int csi;
} hi253_data;


static struct sensor_reg hi253_setting_15fps_QXGA_1600_1200[] = {
	/*
	 * Only support 7.5fps for QXGA to workaround screen tearing issue
	 * for 15fps when capturing still image.
	 */
	 {0x01, 0xf9},  //sleep on                         
	{0x08, 0x0f},  //Hi-Z on                         
	{0x01, 0xf8},   //sleep off                      
                                                       
	{0x03, 0x00},  // Dummy 750us START              
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},  // Dummy 750us END                
                                                       
	{0x0e, 0x03},  //PLL On                          
	{0x0e, 0x70},  //PLLx2                           
                                                       
	{0x03, 0x00},  // Dummy 750us START              
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},  // Dummy 750us END                
                                                       
	{0x0e, 0x00},  //PLL off                         
	{0x01, 0xf1},  //sleep on                        
	{0x08, 0x00},  //Hi-Z off                        
                                                       
	{0x01, 0xf3},                                    
	{0x01, 0xf1},                                    
                                                       
	                                                     
	{0x03, 0x20},  //page 20                         
	{0x10, 0x9c},  //ae off                          
                                                       
                                                       
	{0x03, 0x22},  //page 22                         
	{0x10, 0xe9},  //awb off                         
                                                       
                                                       
	                                                     
	                                                     
	{0x03, 0x00},                                    
	{0x10, 0x00},  // Sub1/2_Preview2 Mode_H binning 
	{0x11, 0x91},                                    
	{0x12, 0x22}, //21                               
                                                       
	{0x0b, 0xaa},  // ESD Check Register             
	{0x0c, 0xaa},  // ESD Check Register             
	{0x0d, 0xaa},  // ESD Check Register             
                                                       
	{0x20, 0x00},  // Windowing start point Y        
	{0x21, 0x04},                                    
	{0x22, 0x00},  // Windowing start point X        
	{0x23, 0x07},                                    
                                                       
	{0x24, 0x04},                                    
	{0x25, 0xb0},                                    
	{0x26, 0x06},                                    
	{0x27, 0x40},  // WINROW END                     
                                                       
	{0x40, 0x01},  //Hblank 408                      
	{0x41, 0x68},                                    
	{0x42, 0x00},  //Vblank 20                       
	{0x43, 0x14},                                    
                                                       
	{0x45, 0x04},                                    
	{0x46, 0x18},                                    
	{0x47, 0xd8},                                    
                                                       
                                                       
	{0x80, 0x2e},                                    
	{0x81, 0x7e},                                    
	{0x82, 0x90},                                    
	{0x83, 0x00},                                    
	{0x84, 0x0c},                                    
	{0x85, 0x00},                                    
	{0x90, 0x14},  //BLC_TIME_TH_ON                  
	{0x91, 0x14},  //BLC_TIME_TH_OFF                 
	{0x92, 0x98},  //BLC_AG_TH_ON                    
	{0x93, 0x90},  //BLC_AG_TH_OFF                   
	{0x94, 0x75},                                    
	{0x95, 0x70},                                    
	{0x96, 0xdc},                                    
	{0x97, 0xfe},                                    
	{0x98, 0x38},                                    
                                                       
                                                       
	{0x99, 0x43},                                    
	{0x9a, 0x43},                                    
	{0x9b, 0x43},                                    
	{0x9c, 0x43},                                    
                                                       
                                                       
	{0xa0, 0x00},                                    
	{0xa2, 0x00},                                    
	{0xa4, 0x00},                                    
	{0xa6, 0x00},                                    
                                                       
                                                       
	{0xa8, 0x43},                                    
	{0xaa, 0x43},                                    
	{0xac, 0x43},                                    
	{0xae, 0x43},                                    
                                                       
                                                       
	{0x03, 0x02},                                    
	{0x12, 0x03},                                    
	{0x13, 0x03},                                    
	{0x16, 0x00},                                    
	{0x17, 0x8C},                                    
	{0x18, 0x4c},  //Double_AG off                   
	{0x19, 0x00},                                    
	{0x1a, 0x39},  //ADC400->560                     
	{0x1c, 0x09},                                    
	{0x1d, 0x40},                                    
	{0x1e, 0x30},                                    
	{0x1f, 0x10},                                    
                                                       
	{0x20, 0x77},                                    
	{0x21, 0xde},                                    
	{0x22, 0xa7},                                    
	{0x23, 0x30},  //CLAMP                           
	{0x27, 0x3c},                                    
	{0x2b, 0x80},                                    
	{0x2e, 0x11},                                    
	{0x2f, 0xa1},                                    
	{0x30, 0x05},  //For Hi-253 never no change 0x05 
                                                       
	{0x50, 0x20},                                    
	{0x52, 0x01},                                    
	{0x55, 0x1c},                                    
	{0x56, 0x11},                                    
	{0x5d, 0xa2},                                    
	{0x5e, 0x5a},                                    
                                                       
	{0x60, 0x87},                                    
	{0x61, 0x99},                                    
	{0x62, 0x88},                                    
	{0x63, 0x97},                                    
	{0x64, 0x88},                                    
	{0x65, 0x97},                                    
                                                       
	{0x67, 0x0c},                                    
	{0x68, 0x0c},                                    
	{0x69, 0x0c},                                    
                                                       
	{0x72, 0x89},                                    
	{0x73, 0x96},                                    
	{0x74, 0x89},                                    
	{0x75, 0x96},                                    
	{0x76, 0x89},                                    
	{0x77, 0x96},                                    
                                                       
	{0x7c, 0x85},                                    
	{0x7d, 0xaf},                                    
	{0x80, 0x01},                                    
	{0x81, 0x7f},                                    
	{0x82, 0x13},                                    
                                                       
	{0x83, 0x24},                                    
	{0x84, 0x7d},                                    
	{0x85, 0x81},                                    
	{0x86, 0x7d},                                    
	{0x87, 0x81},                                    
                                                       
	{0x92, 0x48},                                    
	{0x93, 0x54},                                    
	{0x94, 0x7d},                                    
	{0x95, 0x81},                                    
	{0x96, 0x7d},                                    
	{0x97, 0x81},                                    
                                                       
	{0xa0, 0x02},                                    
	{0xa1, 0x7b},                                    
	{0xa2, 0x02},                                    
	{0xa3, 0x7b},                                    
	{0xa4, 0x7b},                                    
	{0xa5, 0x02},                                    
	{0xa6, 0x7b},                                    
	{0xa7, 0x02},                                    
                                                       
	{0xa8, 0x85},                                    
	{0xa9, 0x8c},                                    
	{0xaa, 0x85},                                    
	{0xab, 0x8c},                                    
	{0xac, 0x10},                                    
	{0xad, 0x16},                                    
	{0xae, 0x10},                                    
	{0xaf, 0x16},                                    
                                                       
	{0xb0, 0x99},                                    
	{0xb1, 0xa3},                                    
	{0xb2, 0xa4},                                    
	{0xb3, 0xae},                                    
	{0xb4, 0x9b},                                    
	{0xb5, 0xa2},                                    
	{0xb6, 0xa6},                                    
	{0xb7, 0xac},                                    
	{0xb8, 0x9b},                                    
	{0xb9, 0x9f},                                    
	{0xba, 0xa6},                                    
	{0xbb, 0xaa},                                    
	{0xbc, 0x9b},                                    
	{0xbd, 0x9f},                                    
	{0xbe, 0xa6},                                    
	{0xbf, 0xaa},                                    
                                                       
	{0xc4, 0x2c},                                    
	{0xc5, 0x43},                                    
	{0xc6, 0x63},                                    
	{0xc7, 0x79},                                    
                                                       
	{0xc8, 0x2d},                                    
	{0xc9, 0x42},                                    
	{0xca, 0x2d},                                    
	{0xcb, 0x42},                                    
	{0xcc, 0x64},                                    
	{0xcd, 0x78},                                    
	{0xce, 0x64},                                    
	{0xcf, 0x78},                                    
                                                       
	{0xd0, 0x0a},                                    
	{0xd1, 0x09},                                    
	{0xd4, 0x14},  //DCDC_TIME_TH_ON                 
	{0xd5, 0x14},  //DCDC_TIME_TH_OFF                
	{0xd6, 0x98},  //DCDC_AG_TH_ON                   
	{0xd7, 0x90},  //DCDC_AG_TH_OFF                  
	{0xe0, 0xc4},                                    
	{0xe1, 0xc4},                                    
	{0xe2, 0xc4},                                    
	{0xe3, 0xc4},                                    
	{0xe4, 0x00},                                    
	{0xe8, 0x80},                                    
	{0xe9, 0x40},                                    
	{0xea, 0x7f},                                    
                                                       
                                                       
	{0x03, 0x03},                                    
	{0x10, 0x10},                                    
                                                       
                                                       
	{0x03, 0x10},                                    
	{0x10, 0x01},  // CrYCbY // For Demoset 0x03     
	{0x12, 0x30},                                    
	{0x13, 0x0a},  // contrast on                    
	{0x20, 0x00},                                    
                                                       
	{0x30, 0x00},                                    
	{0x31, 0x00},                                    
	{0x32, 0x00},                                    
	{0x33, 0x00},                                    
                                                       
	{0x34, 0x30},                                    
	{0x35, 0x00},                                    
	{0x36, 0x00},                                    
	{0x38, 0x00},                                    
	{0x3e, 0x58},                                    
	{0x3f, 0x00},                                    
                                                       
	{0x40, 0x80},  // YOFS                           
	{0x41, 0x10},  // DYOFS                          
	{0x48, 0x84},  // Contrast                       
	{0x50, 0x90},  // Contrast                       
                                                       
	{0x60, 0x6c}, //67                               
	{0x61, 0x70},  //7e //8e //88 //80               
	{0x62, 0x68},  //7e //8e //88 //80               
	{0x63, 0x50},  //Double_AG 50->30                
	{0x64, 0x41},                                    
                                                       
	{0x66, 0x42},                                    
	{0x67, 0x20},                                    
                                                       
	{0x6a, 0x80},  //8a                              
	{0x6b, 0x84},  //74                              
	{0x6c, 0x80},  //7e //7a                         
	{0x6d, 0x80},  //8e                              
          
                                                       
	{0x03, 0x11},                                    
	{0x10, 0x7f},                                    
	{0x11, 0x40},                                    
	{0x12, 0x0a},  /* Blue Max-Filter Delete*/       
	{0x13, 0xbb},                                    
                                                       
	{0x26, 0x31},  /* Double_AG 31->20*/             
	{0x27, 0x34},  /* Double_AG 34->22*/             
	{0x28, 0x0f},                                    
	{0x29, 0x10},                                    
	{0x2b, 0x30},                                    
	{0x2c, 0x32},                                    
                                                       
                                                       
	{0x30, 0x70},                                    
	{0x31, 0x10},                                    
	{0x32, 0x58},                                    
	{0x33, 0x09},                                    
	{0x34, 0x06},                                    
	{0x35, 0x03},                                    
                                                       
                                                       
	{0x36, 0x70},                                    
	{0x37, 0x18},                                    
	{0x38, 0x58},                                    
	{0x39, 0x09},                                    
	{0x3a, 0x06},                                    
	{0x3b, 0x03},                                    
                                                       
                                                       
	{0x3c, 0x80},                                    
	{0x3d, 0x18},                                    
	{0x3e, 0x83},  /*80*/                            
	{0x3f, 0x0c},                                    
	{0x40, 0x03},                                    
	{0x41, 0x06},                                    
                                                       
	{0x42, 0x80},                                    
	{0x43, 0x18},                                    
	{0x44, 0x83},  /*80*/                            
	{0x45, 0x12},                                    
	{0x46, 0x10},                                    
	{0x47, 0x10},                                    
                                                       
	{0x48, 0x90},                                    
	{0x49, 0x40},                                    
	{0x4a, 0x80},                                    
	{0x4b, 0x13},                                    
	{0x4c, 0x10},                                    
	{0x4d, 0x11},                                    
                                                       
	{0x4e, 0x80},                                    
	{0x4f, 0x30},                                    
	{0x50, 0x80},                                    
	{0x51, 0x13},                                    
	{0x52, 0x10},                                    
	{0x53, 0x13},                                    
                                                       
	{0x54, 0x11},                                    
	{0x55, 0x17},                                    
	{0x56, 0x20},                                    
	{0x57, 0x01},                                    
	{0x58, 0x00},                                    
	{0x59, 0x00},                                    
                                                       
	{0x5a, 0x1f},  /*18*/                            
	{0x5b, 0x00},                                    
	{0x5c, 0x00},                                    
                                                       
	{0x60, 0x3f},                                    
	{0x62, 0x60},                                    
	{0x70, 0x06},                                    
                                                       
                                                       
	{0x03, 0x12},                                    
	{0x20, 0x00},                                    
	{0x21, 0x00},                                    
                                                       
	{0x25, 0x00},                                    
                                                       
	{0x28, 0x00},                                    
	{0x29, 0x00},                                    
	{0x2a, 0x00},                                    
                                                       
	{0x30, 0x50},                                    
	{0x31, 0x18},                                    
	{0x32, 0x32},                                    
	{0x33, 0x40},                                    
	{0x34, 0x50},                                    
	{0x35, 0x70},                                    
	{0x36, 0xa0},                                    
                                                       
                                                       
	{0x40, 0xa0},                                    
	{0x41, 0x40},                                    
	{0x42, 0xa0},                                    
	{0x43, 0x90},                                    
	{0x44, 0x90},                                    
	{0x45, 0x80},                                    
                                                       
	                                                     
	{0x46, 0xb0},                                    
	{0x47, 0x55},                                    
	{0x48, 0xa0},                                    
	{0x49, 0x90},                                    
	{0x4a, 0x90},                                    
	{0x4b, 0x80},                                    
                                                       
                                                       
	{0x4c, 0xb0},                                    
	{0x4d, 0x40},                                    
	{0x4e, 0x90},                                    
	{0x4f, 0x90},                                    
	{0x50, 0xa0},                                    
	{0x51, 0x60},                                    
                                                       
	                                                     
	{0x52, 0xb0},                                    
	{0x53, 0x60},                                    
	{0x54, 0xc0},                                    
	{0x55, 0xc0},                                    
	{0x56, 0x80},                                    
	{0x57, 0x57},                                    
                                                       
                                                       
	{0x58, 0x90},                                    
	{0x59, 0x40},                                    
	{0x5a, 0xd0},                                    
	{0x5b, 0xd0},                                    
	{0x5c, 0xe0},                                    
	{0x5d, 0x80},                                    
                                                       
                                                       
	{0x5e, 0x88},                                    
	{0x5f, 0x40},                                    
	{0x60, 0xe0},                                    
	{0x61, 0xe0},                                    
	{0x62, 0xe0},                                    
	{0x63, 0x80},                                    
                                                       
	{0x70, 0x15},                                    
	{0x71, 0x01},  /*Don't Touch register*/          
                                                       
	{0x72, 0x18},                                    
	{0x73, 0x01},  /*Don't Touch register*/          
                                                       
	{0x74, 0x25},                                    
	{0x75, 0x15},                                    
                                                       
	{0x80, 0x20},                                    
	{0x81, 0x40},                                    
	{0x82, 0x65},                                    
	{0x85, 0x1a},                                    
	{0x88, 0x00},                                    
	{0x89, 0x00},                                    
	{0x90, 0x5d},  /*For Preview*/                   
                                                       
/*Dont Touch register*/                                
	{0xD0, 0x0c},                                    
	{0xD1, 0x80},                                    
	{0xD2, 0x67},                                    
	{0xD3, 0x00},                                    
	{0xD4, 0x00},                                    
	{0xD5, 0x02},                                    
	{0xD6, 0xff},                                    
	{0xD7, 0x18},                                    
                                                       
	{0x3b, 0x06},                                    
	{0x3c, 0x06},                                    
                                                       
	{0xc5, 0x00}, /*55->48*/                         
	{0xc6, 0x00}, /*48->40*/                         
                                                       
                                                       
	{0x03, 0x13},                                    
                                                       
	{0x10, 0xcb},                                    
	{0x11, 0x7b},                                    
	{0x12, 0x07},                                    
	{0x14, 0x00},                                    
                                                       
	{0x20, 0x15},                                    
	{0x21, 0x13},                                    
	{0x22, 0x33},                                    
	{0x23, 0x05},                                    
	{0x24, 0x09},                                    
                                                       
	{0x25, 0x0a},                                    
                                                       
	{0x26, 0x18},                                    
	{0x27, 0x30},                                    
	{0x29, 0x12},                                    
	{0x2a, 0x50},                                    
                                                       
                                                       
	{0x2b, 0x02},                                    
	{0x2c, 0x02},                                    
	{0x25, 0x06},                                    
	{0x2d, 0x0c},                                    
	{0x2e, 0x12},                                    
	{0x2f, 0x12},                                    
                                                       
                                                       
	{0x50, 0x10},                                    
	{0x51, 0x14},                                    
	{0x52, 0x12},                                    
	{0x53, 0x0c},                                    
	{0x54, 0x0f},                                    
	{0x55, 0x0c},                                    
                                                       
                                                       
	{0x56, 0x10},                                    
	{0x57, 0x13},                                    
	{0x58, 0x12},                                    
	{0x59, 0x0c},                                    
	{0x5a, 0x0f},                                    
	{0x5b, 0x0c},                                    
                                                       
                                                       
	{0x5c, 0x0a},                                    
	{0x5d, 0x0b},                                    
	{0x5e, 0x0a},                                    
	{0x5f, 0x08},                                    
	{0x60, 0x09},                                    
	{0x61, 0x08},                                    
                                                       
                                                       
	{0x62, 0x08},                                    
	{0x63, 0x08},                                    
	{0x64, 0x08},                                    
	{0x65, 0x06},                                    
	{0x66, 0x06},                                    
	{0x67, 0x06},                                    
                                                       
                                                       
	{0x68, 0x07},                                    
	{0x69, 0x07},                                    
	{0x6a, 0x07},                                    
	{0x6b, 0x05},                                    
	{0x6c, 0x05},                                    
	{0x6d, 0x05},                                    
                                                       
                                                       
	{0x6e, 0x07},                                    
	{0x6f, 0x07},                                    
	{0x70, 0x07},                                    
	{0x71, 0x05},                                    
	{0x72, 0x05},                                    
	{0x73, 0x05},                                    
                                                       
                                                       
	                                                     
	{0x80, 0xfd},                                    
	{0x81, 0x1f},                                    
	{0x82, 0x05},                                    
	{0x83, 0x31},                                    
                                                       
	{0x90, 0x05},                                    
	{0x91, 0x05},                                    
	{0x92, 0x33},                                    
	{0x93, 0x30},                                    
	{0x94, 0x03},                                    
	{0x95, 0x14},                                    
	{0x97, 0x20},                                    
	{0x99, 0x20},                                    
                                                       
	{0xa0, 0x01},                                    
	{0xa1, 0x02},                                    
	{0xa2, 0x01},                                    
	{0xa3, 0x02},                                    
	{0xa4, 0x05},                                    
	{0xa5, 0x05},                                    
	{0xa6, 0x07},                                    
	{0xa7, 0x08},                                    
	{0xa8, 0x07},                                    
	{0xa9, 0x08},                                    
	{0xaa, 0x07},                                    
	{0xab, 0x08},                                    
                                                       
                                                       
	{0xb0, 0x22},                                    
	{0xb1, 0x2a},                                    
	{0xb2, 0x28},                                    
	{0xb3, 0x22},                                    
	{0xb4, 0x2a},                                    
	{0xb5, 0x28},                                    
                                                       
                                                       
	{0xb6, 0x22},                                    
	{0xb7, 0x2a},                                    
	{0xb8, 0x28},                                    
	{0xb9, 0x22},                                    
	{0xba, 0x2a},                                    
	{0xbb, 0x28},                                    
                                                       
                                                       
	{0xbc, 0x25},                                    
	{0xbd, 0x2a},                                    
	{0xbe, 0x27},                                    
	{0xbf, 0x25},                                    
	{0xc0, 0x2a},                                    
	{0xc1, 0x27},                                    
                                                       
	                                                     
	{0xc2, 0x1e},                                    
	{0xc3, 0x24},                                    
	{0xc4, 0x20},                                    
	{0xc5, 0x1e},                                    
	{0xc6, 0x24},                                    
	{0xc7, 0x20},                                    
                                                       
	                                                     
	{0xc8, 0x18},                                    
	{0xc9, 0x20},                                    
	{0xca, 0x1e},                                    
	{0xcb, 0x18},                                    
	{0xcc, 0x20},                                    
	{0xcd, 0x1e},                                    
                                                       
                                                       
	{0xce, 0x18},                                    
	{0xcf, 0x20},                                    
	{0xd0, 0x1e},                                    
	{0xd1, 0x18},                                    
	{0xd2, 0x20},                                    
	{0xd3, 0x1e},                                    
                                                       
                                                       
	{0x03, 0x14},                                    
	{0x10, 0x11},                                    
                                                       
	{0x14, 0x80},  // GX                             
	{0x15, 0x80},  // GY                             
	{0x16, 0x80},  // RX                             
	{0x17, 0x80},  // RY                             
	{0x18, 0x80},  // BX                             
	{0x19, 0x80},  // BY                             
                                                       
	{0x20, 0x60},  //X 60 //a0                       
	{0x21, 0x80},  //Y                               
                                                       
	{0x22, 0x80},                                    
	{0x23, 0x80},                                    
	{0x24, 0x80},                                    
                                                       
	{0x30, 0xc8},                                    
	{0x31, 0x2b},                                    
	{0x32, 0x00},                                    
	{0x33, 0x00},                                    
	{0x34, 0x90},                                    
                                                       
	{0x40, 0x48},  //31                              
	{0x50, 0x34},  //23 //32                         
	{0x60, 0x29},  //                                
	{0x70, 0x34},  //23 //32                         
                                                       
                                                       
	{0x03, 0x15},                                    
	{0x10, 0x0f},                                    
                                                       
	                                                     
	                                                     
	{0x14, 0x42},  //CMCOFSGH_Day //4c               
	{0x15, 0x32},  //CMCOFSGM_CWF //3c               
	{0x16, 0x24},  //CMCOFSGL_A //2e                 
	{0x17, 0x2f},  //CMC SIGN                        
                                                       
                                                       
	{0x30, 0x8f},                                    
	{0x31, 0x59},                                    
	{0x32, 0x0a},                                    
	{0x33, 0x15},                                    
	{0x34, 0x5b},                                    
	{0x35, 0x06},                                    
	{0x36, 0x07},                                    
	{0x37, 0x40},                                    
	{0x38, 0x87},  //86                              
                                                       
	                                                     
	{0x40, 0x92},                                    
	{0x41, 0x1b},                                    
	{0x42, 0x89},                                    
	{0x43, 0x81},                                    
	{0x44, 0x00},                                    
	{0x45, 0x01},                                    
	{0x46, 0x89},                                    
	{0x47, 0x9e},                                    
	{0x48, 0x28},                                    
                                                 
                                            
                                                       
	{0x50, 0x02},                                    
	{0x51, 0x82},                                    
	{0x52, 0x00},                                    
	{0x53, 0x07},                                    
	{0x54, 0x11},                                    
	{0x55, 0x98},                                    
	{0x56, 0x00},                                    
	{0x57, 0x0b},                                    
	{0x58, 0x8b},                                    
                                                       
	{0x80, 0x03},                                    
	{0x85, 0x40},                                    
	{0x87, 0x02},                                    
	{0x88, 0x00},                                    
	{0x89, 0x00},                                    
	{0x8a, 0x00},                                    
                                                       
                                                       
	{0x03, 0x16},                                    
	{0x10, 0x31},                                    
	{0x18, 0x5e}, // Double_AG 5e->37                
	{0x19, 0x5d}, // Double_AG 5e->36                
	{0x1a, 0x0e},                                    
	{0x1b, 0x01},                                    
	{0x1c, 0xdc},                                    
	{0x1d, 0xfe},                                    
                                                       
                                                       
	{0x30, 0x00},                                    
	{0x31, 0x0a},                                    
	{0x32, 0x1f},                                    
	{0x33, 0x33},                                    
	{0x34, 0x53},                                    
	{0x35, 0x6c},                                    
	{0x36, 0x81},                                    
	{0x37, 0x94},                                    
	{0x38, 0xa4},                                    
	{0x39, 0xb3},                                    
	{0x3a, 0xc0},                                    
	{0x3b, 0xcb},                                    
	{0x3c, 0xd5},                                    
	{0x3d, 0xde},                                    
	{0x3e, 0xe6},                                    
	{0x3f, 0xee},                                    
	{0x40, 0xf5},                                    
	{0x41, 0xfc},                                    
	{0x42, 0xff},                                    
                                                       
	{0x50, 0x00},                                    
	{0x51, 0x09},                                    
	{0x52, 0x1f},                                    
	{0x53, 0x37},                                    
	{0x54, 0x5b},                                    
	{0x55, 0x76},                                    
	{0x56, 0x8d},                                    
	{0x57, 0xa1},                                    
	{0x58, 0xb2},                                    
	{0x59, 0xbe},                                    
	{0x5a, 0xc9},                                    
	{0x5b, 0xd2},                                    
	{0x5c, 0xdb},                                    
	{0x5d, 0xe3},                                    
	{0x5e, 0xeb},                                    
	{0x5f, 0xf0},                                    
	{0x60, 0xf5},                                    
	{0x61, 0xf7},                                    
	{0x62, 0xf8},                                    
                                                       
	{0x70, 0x00},                                    
	{0x71, 0x08},                                    
	{0x72, 0x17},                                    
	{0x73, 0x2f},                                    
	{0x74, 0x53},                                    
	{0x75, 0x6c},                                    
	{0x76, 0x81},                                    
	{0x77, 0x94},                                    
	{0x78, 0xa4},                                    
	{0x79, 0xb3},                                    
	{0x7a, 0xc0},                                    
	{0x7b, 0xcb},                                    
	{0x7c, 0xd5},                                    
	{0x7d, 0xde},                                    
	{0x7e, 0xe6},                                    
	{0x7f, 0xee},                                    
	{0x80, 0xf4},                                    
	{0x81, 0xfa},                                    
	{0x82, 0xff},                                    
                                                       
                                                       
	{0x03, 0x17},                                    
	{0x10, 0xf7},                                    
                                                       
	{0x03, 0x18},                                    
	{0x12, 0x20},                                    
	{0x10, 0x07},                                    
	{0x11, 0x00},                                    
	{0x20, 0x05},                                    
	{0x21, 0x20},                                    
	{0x22, 0x03},                                    
	{0x23, 0xd8},                                    
	{0x24, 0x00},                                    
	{0x25, 0x10},                                    
	{0x26, 0x00},                                    
	{0x27, 0x0c},                                    
	{0x28, 0x05},                                    
	{0x29, 0x10},                                    
	{0x2a, 0x03},                                    
	{0x2b, 0xcc},                                    
	{0x2c, 0x09},                                    
	{0x2d, 0xc1},                                    
	{0x2e, 0x09},                                    
	{0x2f, 0xc1},                                    
	{0x30, 0x41},                                    
                                                       
                                                       
	{0x03, 0x20},                                    
	{0x11, 0x1c},                                    
	{0x18, 0x30},                                    
	{0x1a, 0x08},                                    
	{0x20, 0x01},  //05_lowtemp Y Mean off           
	{0x21, 0x30},                                    
	{0x22, 0x10},                                    
	{0x23, 0x00},                                    
	{0x24, 0x00},  //Uniform Scene Off               
                                                       
	{0x28, 0xe7},                                    
	{0x29, 0x0d},  //20100305 ad->0d                 
	{0x2a, 0xff},                                    
	{0x2b, 0x04},  //f4->Adaptive off                
                                                       
	{0x2c, 0xc2},                                    
	{0x2d, 0xcf},   //ff->AE Speed option            
	{0x2e, 0x33},                                    
	{0x30, 0x78},  //f8                              
	{0x32, 0x03},                                    
	{0x33, 0x2e},                                    
	{0x34, 0x30},                                    
	{0x35, 0xd4},                                    
	{0x36, 0xfe},                                    
	{0x37, 0x32},                                    
	{0x38, 0x04},                                    
                                                       
	{0x39, 0x22},  //AE_escapeC10                    
	{0x3a, 0xde},  //AE_escapeC11                    
                                                       
	{0x3b, 0x22},  //AE_escapeC1                     
	{0x3c, 0xde},  //AE_escapeC2                     
                                                       
	{0x50, 0x45},                                    
	{0x51, 0x88},                                    
                                                       
	{0x56, 0x03},                                    
	{0x57, 0xf7},                                    
	{0x58, 0x14},                                    
	{0x59, 0x88},                                    
	{0x5a, 0x04}, 

	{0x60, 0x55},  // AEWGT1
	{0x61, 0x55},  // AEWGT2
	{0x62, 0x6a},  // AEWGT3
	{0x63, 0xa9},  // AEWGT4
	{0x64, 0x6a},  // AEWGT5
	{0x65, 0xa9},  // AEWGT6
	{0x66, 0x6a},  // AEWGT7
	{0x67, 0xa9},  // AEWGT8
	{0x68, 0x6b},  // AEWGT9
	{0x69, 0xe9},  // AEWGT10
	{0x6a, 0x6a},  // AEWGT11
	{0x6b, 0xa9},  // AEWGT12
	{0x6c, 0x6a},  // AEWGT13
	{0x6d, 0xa9},  // AEWGT14
	{0x6e, 0x55},  // AEWGT15
	{0x6f, 0x55},  // AEWGT16

	{0x70, 0x70},  //6e
	{0x71, 0x00},  //82(+8)->+0


	{0x76, 0x43}, 
	{0x77, 0xe2},  //04
	{0x78, 0x23},  //Yth1
	{0x79, 0x42},  //Yth2
	{0x7a, 0x23},  //23
	{0x7b, 0x22},  //22
	{0x7d, 0x23}, 

	{0x83, 0x01},  //EXP Normal 33.33 fps 
	{0x84, 0xb7},  
	{0x85, 0x74},  

	{0x86, 0x01},  //EXPMin 5859.38 fps
	{0x87, 0xf4},  

	{0x88, 0x05},  //EXP Max 10.00 fps 
	{0x89, 0xb8},  
	{0x8a, 0xd8},  

	{0x8B, 0x49},  //EXP100 
	{0x8C, 0x3e},  
	{0x8D, 0x3c},  //EXP120 
	{0x8E, 0x8c},  
	{0x9c, 0x17},  //EXP Limit 488.28 fps 
	{0x9d, 0x70},  
	{0x9e, 0x01},  //EXP Unit 
	{0x9f, 0xf4},  

	//AE_Middle Time option
	//{0xa0, 0x03}, 
	//{0xa1, 0xa9}, 
	//{0xa2, 0x80}, 

	{0xb0, 0x18}, 
	{0xb1, 0x14},  //ADC 400->560
	{0xb2, 0xa0},  //d0
	{0xb3, 0x18}, 
	{0xb4, 0x1a}, 
	{0xb5, 0x44}, 
	{0xb6, 0x2f}, 
	{0xb7, 0x28}, 
	{0xb8, 0x25}, 
	{0xb9, 0x22}, 
	{0xba, 0x21}, 
	{0xbb, 0x20}, 
	{0xbc, 0x1f}, 
	{0xbd, 0x1f}, 

	//AE_Adaptive Time option
	//{0xc0, 0x10}, 
	//{0xc1, 0x2b}, 
	//{0xc2, 0x2b}, 
	//{0xc3, 0x2b}, 
	//{0xc4, 0x08}, 

	{0xc8, 0x80}, 
	{0xc9, 0x40}, 

	/////// PAGE 22 START ///////
	{0x03, 0x22}, 
	{0x10, 0xfd}, 
	{0x11, 0x2e}, 
	{0x19, 0x01},  // Low On //
	{0x20, 0x30}, 
	{0x21, 0x80}, 
	{0x24, 0x01}, 
	//{0x25, 0x00},  //7f New Lock Cond & New light stable

	{0x30, 0x80}, 
	{0x31, 0x80}, 
	{0x38, 0x11}, 
	{0x39, 0x34}, 

	{0x40, 0xf4}, 
	{0x41, 0x55},  //44
	{0x42, 0x33},  //43

	{0x43, 0xf6}, 
	{0x44, 0x55},  //44
	{0x45, 0x44},  //33

	{0x46, 0x00}, 
	{0x50, 0xb2}, 
	{0x51, 0x81}, 
	{0x52, 0x98}, 

	{0x80, 0x40},  //3e
	{0x81, 0x20}, 
	{0x82, 0x3e}, 

	{0x83, 0x5e},  //5e
	{0x84, 0x1e},  //24
	{0x85, 0x5e},  //54 //56 //5a
	{0x86, 0x22},  //24 //22

	{0x87, 0x49}, 
	{0x88, 0x39}, 
	{0x89, 0x37},  //38
	{0x8a, 0x28},  //2a

	{0x8b, 0x41},  //47
	{0x8c, 0x39},  
	{0x8d, 0x34},  
	{0x8e, 0x28},  //2c

	{0x8f, 0x53},  //4e
	{0x90, 0x52},  //4d
	{0x91, 0x51},  //4c
	{0x92, 0x4e},  //4a
	{0x93, 0x4a},  //46
	{0x94, 0x45}, 
	{0x95, 0x3d}, 
	{0x96, 0x31}, 
	{0x97, 0x28}, 
	{0x98, 0x24}, 
	{0x99, 0x20}, 
	{0x9a, 0x20}, 

	{0x9b, 0x77}, 
	{0x9c, 0x77}, 
	{0x9d, 0x48}, 
	{0x9e, 0x38}, 
	{0x9f, 0x30}, 

	{0xa0, 0x60}, 
	{0xa1, 0x34}, 
	{0xa2, 0x6f}, 
	{0xa3, 0xff}, 

	{0xa4, 0x14},  //1500fps
	{0xa5, 0x2c},  // 700fps
	{0xa6, 0xcf}, 

	{0xad, 0x40}, 
	{0xae, 0x4a}, 

	{0xaf, 0x28},   // low temp Rgain
	{0xb0, 0x26},   // low temp Rgain

	{0xb1, 0x00},  //0x20 -> 0x00 0405 modify
	{0xb4, 0xea}, 
	{0xb8, 0xa0},  //a2: b-2, R+2  //b4 B-3, R+4 lowtemp
	{0xb9, 0x00}, 

	/////// PAGE 20 ///////
	{0x03, 0x20}, 
	{0x10, 0x8c}, 

	// PAGE 20
	{0x03, 0x20},  //page 20
	{0x10, 0x9c},  //ae off

	// PAGE 22
	{0x03, 0x22},  //page 22
	{0x10, 0xe9},  //awb off

	// PAGE 0
	{0x03, 0x00}, 
	{0x0e, 0x03},  //PLL On
	{0x0e, 0x73},  //PLLx2

	{0x03, 0x00},  // Dummy 750us
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	/* start 
	{0x03, 0x20},
	{0x03, 0x00},
	{0x20, 0x00}, 
	{0x21, 0x0a}, 
	{0x22, 0x00}, 
	{0x23, 0x0a}, 

	{0x40, 0x01}, //360
	{0x41, 0x68}, 
	{0x42, 0x00},
	{0x43, 0x14},

	{0x03, 0x10},
	{0x3f, 0x00},

	//Page12
	{0x03, 0x12},
	{0x20, 0x0f},
	{0x21, 0x0f},
	{0x90, 0x5d},

	//Page13
	{0x03, 0x13},
	{0x80, 0xfd},

	// 1600*1200	
	{0x03,0x00},
	{0x10,0x00},

	{0x03, 0x00}, 
	{0x12, 0x21},

	{0x03, 0x20}, 
	{0x86, 0x01},
	{0x87, 0xf4},
	
	{0x8b, 0x3a},
	{0x8c, 0x98},
	{0x8d, 0x30},
	{0x8e, 0xd4},

	{0x9c, 0x17},
	{0x9d, 0x70},
	{0x9e, 0x01},
	{0x9f, 0xf4},

	{0x03, 0x20}, 
	{0x03, 0x00}, 	
	end*/
	
	{0x03, 0x00},  // Page 0
	{0x01, 0xf8},  // Sleep Off 0xf8->0x50 for solve green line issue	
};

static struct sensor_reg  hi253_setting_15fps_XGA_1024_768[] = {       
	/*
	 * Only support 7.5fps for QXGA to workaround screen tearing issue
	 * for 15fps when capturing still image.
	 */
	{0x01, 0xf9},  //sleep on                         
	{0x08, 0x0f},  //Hi-Z on                         
	{0x01, 0xf8},   //sleep off                      
                                                       
	{0x03, 0x00},  // Dummy 750us START              
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},  // Dummy 750us END                
                                                       
	{0x0e, 0x03},  //PLL On                          
	{0x0e, 0x73},  //PLLx2                           
                                                       
	{0x03, 0x00},  // Dummy 750us START              
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},  // Dummy 750us END                
                                                       
	{0x0e, 0x00},  //PLL off                         
	{0x01, 0xf1},  //sleep on                        
	{0x08, 0x00},  //Hi-Z off                        
                                                       
	{0x01, 0xf3},                                    
	{0x01, 0xf1},                                    
                                                       
	                                                     
	{0x03, 0x20},  //page 20                         
	{0x10, 0x1c},  //ae off                          
                                                       
                                                       
	{0x03, 0x22},  //page 22                         
	{0x10, 0x69},  //awb off                         
                                                       
                                                       
	                                                     
	                                                     
	{0x03, 0x00},                                    
	{0x10, 0x11},  // Sub1/2_Preview2 Mode_H binning 
	{0x11, 0x91},                                    
	{0x12, 0x20}, //21                               
                                                       
	{0x0b, 0xaa},  // ESD Check Register             
	{0x0c, 0xaa},  // ESD Check Register             
	{0x0d, 0xaa},  // ESD Check Register             
                                                       
	{0x20, 0x00},  // Windowing start point Y        
	{0x21, 0x04},                                    
	{0x22, 0x00},  // Windowing start point X        
	{0x23, 0x07},                                    
                                                       
	{0x24, 0x04},                                    
	{0x25, 0xb0},                                    
	{0x26, 0x06},                                    
	{0x27, 0x40},  // WINROW END                     
                                                       
	{0x40, 0x01},  //Hblank 408                      
	{0x41, 0x68},                                    
	{0x42, 0x00},  //Vblank 20                       
	{0x43, 0x14},                                    
                                                       
	{0x45, 0x04},                                    
	{0x46, 0x18},                                    
	{0x47, 0xd8},                                    
                                                       
                                                       
	{0x80, 0x2e},                                    
	{0x81, 0x7e},                                    
	{0x82, 0x90},                                    
	{0x83, 0x00},                                    
	{0x84, 0x0c},                                    
	{0x85, 0x00},                                    
	{0x90, 0x14},  //BLC_TIME_TH_ON                  
	{0x91, 0x14},  //BLC_TIME_TH_OFF                 
	{0x92, 0x98},  //BLC_AG_TH_ON                    
	{0x93, 0x90},  //BLC_AG_TH_OFF                   
	{0x94, 0x75},                                    
	{0x95, 0x70},                                    
	{0x96, 0xdc},                                    
	{0x97, 0xfe},                                    
	{0x98, 0x38},                                    
                                                       
                                                       
	{0x99, 0x43},                                    
	{0x9a, 0x43},                                    
	{0x9b, 0x43},                                    
	{0x9c, 0x43},                                    
                                                       
                                                       
	{0xa0, 0x00},                                    
	{0xa2, 0x00},                                    
	{0xa4, 0x00},                                    
	{0xa6, 0x00},                                    
                                                       
                                                       
	{0xa8, 0x43},                                    
	{0xaa, 0x43},                                    
	{0xac, 0x43},                                    
	{0xae, 0x43},                                    
                                                       
                                                       
	{0x03, 0x02},                                    
	{0x12, 0x03},                                    
	{0x13, 0x03},                                    
	{0x16, 0x00},                                    
	{0x17, 0x8C},                                    
	{0x18, 0x4c},  //Double_AG off                   
	{0x19, 0x00},                                    
	{0x1a, 0x39},  //ADC400->560                     
	{0x1c, 0x09},                                    
	{0x1d, 0x40},                                    
	{0x1e, 0x30},                                    
	{0x1f, 0x10},                                    
                                                       
	{0x20, 0x77},                                    
	{0x21, 0xde},                                    
	{0x22, 0xa7},                                    
	{0x23, 0x30},  //CLAMP                           
	{0x27, 0x3c},                                    
	{0x2b, 0x80},                                    
	{0x2e, 0x11},                                    
	{0x2f, 0xa1},                                    
	{0x30, 0x05},  //For Hi-253 never no change 0x05 
                                                       
	{0x50, 0x20},                                    
	{0x52, 0x01},                                    
	{0x55, 0x1c},                                    
	{0x56, 0x11},                                    
	{0x5d, 0xa2},                                    
	{0x5e, 0x5a},                                    
                                                       
	{0x60, 0x87},                                    
	{0x61, 0x99},                                    
	{0x62, 0x88},                                    
	{0x63, 0x97},                                    
	{0x64, 0x88},                                    
	{0x65, 0x97},                                    
                                                       
	{0x67, 0x0c},                                    
	{0x68, 0x0c},                                    
	{0x69, 0x0c},                                    
                                                       
	{0x72, 0x89},                                    
	{0x73, 0x96},                                    
	{0x74, 0x89},                                    
	{0x75, 0x96},                                    
	{0x76, 0x89},                                    
	{0x77, 0x96},                                    
                                                       
	{0x7c, 0x85},                                    
	{0x7d, 0xaf},                                    
	{0x80, 0x01},                                    
	{0x81, 0x7f},                                    
	{0x82, 0x13},                                    
                                                       
	{0x83, 0x24},                                    
	{0x84, 0x7d},                                    
	{0x85, 0x81},                                    
	{0x86, 0x7d},                                    
	{0x87, 0x81},                                    
                                                       
	{0x92, 0x48},                                    
	{0x93, 0x54},                                    
	{0x94, 0x7d},                                    
	{0x95, 0x81},                                    
	{0x96, 0x7d},                                    
	{0x97, 0x81},                                    
                                                       
	{0xa0, 0x02},                                    
	{0xa1, 0x7b},                                    
	{0xa2, 0x02},                                    
	{0xa3, 0x7b},                                    
	{0xa4, 0x7b},                                    
	{0xa5, 0x02},                                    
	{0xa6, 0x7b},                                    
	{0xa7, 0x02},                                    
                                                       
	{0xa8, 0x85},                                    
	{0xa9, 0x8c},                                    
	{0xaa, 0x85},                                    
	{0xab, 0x8c},                                    
	{0xac, 0x10},                                    
	{0xad, 0x16},                                    
	{0xae, 0x10},                                    
	{0xaf, 0x16},                                    
                                                       
	{0xb0, 0x99},                                    
	{0xb1, 0xa3},                                    
	{0xb2, 0xa4},                                    
	{0xb3, 0xae},                                    
	{0xb4, 0x9b},                                    
	{0xb5, 0xa2},                                    
	{0xb6, 0xa6},                                    
	{0xb7, 0xac},                                    
	{0xb8, 0x9b},                                    
	{0xb9, 0x9f},                                    
	{0xba, 0xa6},                                    
	{0xbb, 0xaa},                                    
	{0xbc, 0x9b},                                    
	{0xbd, 0x9f},                                    
	{0xbe, 0xa6},                                    
	{0xbf, 0xaa},                                    
                                                       
	{0xc4, 0x2c},                                    
	{0xc5, 0x43},                                    
	{0xc6, 0x63},                                    
	{0xc7, 0x79},                                    
                                                       
	{0xc8, 0x2d},                                    
	{0xc9, 0x42},                                    
	{0xca, 0x2d},                                    
	{0xcb, 0x42},                                    
	{0xcc, 0x64},                                    
	{0xcd, 0x78},                                    
	{0xce, 0x64},                                    
	{0xcf, 0x78},                                    
                                                       
	{0xd0, 0x0a},                                    
	{0xd1, 0x09},                                    
	{0xd4, 0x14},  //DCDC_TIME_TH_ON                 
	{0xd5, 0x14},  //DCDC_TIME_TH_OFF                
	{0xd6, 0x98},  //DCDC_AG_TH_ON                   
	{0xd7, 0x90},  //DCDC_AG_TH_OFF                  
	{0xe0, 0xc4},                                    
	{0xe1, 0xc4},                                    
	{0xe2, 0xc4},                                    
	{0xe3, 0xc4},                                    
	{0xe4, 0x00},                                    
	{0xe8, 0x80},                                    
	{0xe9, 0x40},                                    
	{0xea, 0x7f},                                    
                                                       
                                                       
	{0x03, 0x03},                                    
	{0x10, 0x10},                                    
                                                       
                                                       
	{0x03, 0x10},                                    
	{0x10, 0x01},  // CrYCbY // For Demoset 0x03     
	{0x12, 0x30},                                    
	{0x13, 0x0a},  // contrast on                    
	{0x20, 0x00},                                    
                                                       
	{0x30, 0x00},                                    
	{0x31, 0x00},                                    
	{0x32, 0x00},                                    
	{0x33, 0x00},                                    
                                                       
	{0x34, 0x30},                                    
	{0x35, 0x00},                                    
	{0x36, 0x00},                                    
	{0x38, 0x00},                                    
	{0x3e, 0x58},                                    
	{0x3f, 0x00},                                    
                                                       
	{0x40, 0x80},  // YOFS                           
	{0x41, 0x10},  // DYOFS                          
	{0x48, 0x84},  // Contrast                       
	{0x50, 0x90},  // Contrast                       
                                                       
	{0x60, 0x6c}, //67                               
	{0x61, 0x70},  //7e //8e //88 //80               
	{0x62, 0x68},  //7e //8e //88 //80               
	{0x63, 0x50},  //Double_AG 50->30                
	{0x64, 0x41},                                    
                                                       
	{0x66, 0x42},                                    
	{0x67, 0x20},                                    
                                                       
	{0x6a, 0x80},  //8a                              
	{0x6b, 0x84},  //74                              
	{0x6c, 0x80},  //7e //7a                         
	{0x6d, 0x80},  //8e                              
          
                                                       
	{0x03, 0x11},                                    
	{0x10, 0x7f},                                    
	{0x11, 0x40},                                    
	{0x12, 0x0a},  /* Blue Max-Filter Delete*/       
	{0x13, 0xbb},                                    
                                                       
	{0x26, 0x31},  /* Double_AG 31->20*/             
	{0x27, 0x34},  /* Double_AG 34->22*/             
	{0x28, 0x0f},                                    
	{0x29, 0x10},                                    
	{0x2b, 0x30},                                    
	{0x2c, 0x32},                                    
                                                       
                                                       
	{0x30, 0x70},                                    
	{0x31, 0x10},                                    
	{0x32, 0x58},                                    
	{0x33, 0x09},                                    
	{0x34, 0x06},                                    
	{0x35, 0x03},                                    
                                                       
                                                       
	{0x36, 0x70},                                    
	{0x37, 0x18},                                    
	{0x38, 0x58},                                    
	{0x39, 0x09},                                    
	{0x3a, 0x06},                                    
	{0x3b, 0x03},                                    
                                                       
                                                       
	{0x3c, 0x80},                                    
	{0x3d, 0x18},                                    
	{0x3e, 0x83},  /*80*/                            
	{0x3f, 0x0c},                                    
	{0x40, 0x03},                                    
	{0x41, 0x06},                                    
                                                       
	{0x42, 0x80},                                    
	{0x43, 0x18},                                    
	{0x44, 0x83},  /*80*/                            
	{0x45, 0x12},                                    
	{0x46, 0x10},                                    
	{0x47, 0x10},                                    
                                                       
	{0x48, 0x90},                                    
	{0x49, 0x40},                                    
	{0x4a, 0x80},                                    
	{0x4b, 0x13},                                    
	{0x4c, 0x10},                                    
	{0x4d, 0x11},                                    
                                                       
	{0x4e, 0x80},                                    
	{0x4f, 0x30},                                    
	{0x50, 0x80},                                    
	{0x51, 0x13},                                    
	{0x52, 0x10},                                    
	{0x53, 0x13},                                    
                                                       
	{0x54, 0x11},                                    
	{0x55, 0x17},                                    
	{0x56, 0x20},                                    
	{0x57, 0x01},                                    
	{0x58, 0x00},                                    
	{0x59, 0x00},                                    
                                                       
	{0x5a, 0x1f},  /*18*/                            
	{0x5b, 0x00},                                    
	{0x5c, 0x00},                                    
                                                       
	{0x60, 0x3f},                                    
	{0x62, 0x60},                                    
	{0x70, 0x06},                                    
                                                       
                                                       
	{0x03, 0x12},                                    
	{0x20, 0x00},                                    
	{0x21, 0x00},                                    
                                                       
	{0x25, 0x00},                                    
                                                       
	{0x28, 0x00},                                    
	{0x29, 0x00},                                    
	{0x2a, 0x00},                                    
                                                       
	{0x30, 0x50},                                    
	{0x31, 0x18},                                    
	{0x32, 0x32},                                    
	{0x33, 0x40},                                    
	{0x34, 0x50},                                    
	{0x35, 0x70},                                    
	{0x36, 0xa0},                                    
                                                       
                                                       
	{0x40, 0xa0},                                    
	{0x41, 0x40},                                    
	{0x42, 0xa0},                                    
	{0x43, 0x90},                                    
	{0x44, 0x90},                                    
	{0x45, 0x80},                                    
                                                       
	                                                     
	{0x46, 0xb0},                                    
	{0x47, 0x55},                                    
	{0x48, 0xa0},                                    
	{0x49, 0x90},                                    
	{0x4a, 0x90},                                    
	{0x4b, 0x80},                                    
                                                       
                                                       
	{0x4c, 0xb0},                                    
	{0x4d, 0x40},                                    
	{0x4e, 0x90},                                    
	{0x4f, 0x90},                                    
	{0x50, 0xa0},                                    
	{0x51, 0x60},                                    
                                                       
	                                                     
	{0x52, 0xb0},                                    
	{0x53, 0x60},                                    
	{0x54, 0xc0},                                    
	{0x55, 0xc0},                                    
	{0x56, 0x80},                                    
	{0x57, 0x57},                                    
                                                       
                                                       
	{0x58, 0x90},                                    
	{0x59, 0x40},                                    
	{0x5a, 0xd0},                                    
	{0x5b, 0xd0},                                    
	{0x5c, 0xe0},                                    
	{0x5d, 0x80},                                    
                                                       
                                                       
	{0x5e, 0x88},                                    
	{0x5f, 0x40},                                    
	{0x60, 0xe0},                                    
	{0x61, 0xe0},                                    
	{0x62, 0xe0},                                    
	{0x63, 0x80},                                    
                                                       
	{0x70, 0x15},                                    
	{0x71, 0x01},  /*Don't Touch register*/          
                                                       
	{0x72, 0x18},                                    
	{0x73, 0x01},  /*Don't Touch register*/          
                                                       
	{0x74, 0x25},                                    
	{0x75, 0x15},                                    
                                                       
	{0x80, 0x20},                                    
	{0x81, 0x40},                                    
	{0x82, 0x65},                                    
	{0x85, 0x1a},                                    
	{0x88, 0x00},                                    
	{0x89, 0x00},                                    
	{0x90, 0x5d},  /*For Preview*/                   
                                                       
/*Dont Touch register*/                                
	{0xD0, 0x0c},                                    
	{0xD1, 0x80},                                    
	{0xD2, 0x67},                                    
	{0xD3, 0x00},                                    
	{0xD4, 0x00},                                    
	{0xD5, 0x02},                                    
	{0xD6, 0xff},                                    
	{0xD7, 0x18},                                    
                                                       
	{0x3b, 0x06},                                    
	{0x3c, 0x06},                                    
                                                       
	{0xc5, 0x00}, /*55->48*/                         
	{0xc6, 0x00}, /*48->40*/                         
                                                       
                                                       
	{0x03, 0x13},                                    
                                                       
	{0x10, 0xcb},                                    
	{0x11, 0x7b},                                    
	{0x12, 0x07},                                    
	{0x14, 0x00},                                    
                                                       
	{0x20, 0x15},                                    
	{0x21, 0x13},                                    
	{0x22, 0x33},                                    
	{0x23, 0x05},                                    
	{0x24, 0x09},                                    
                                                       
	{0x25, 0x0a},                                    
                                                       
	{0x26, 0x18},                                    
	{0x27, 0x30},                                    
	{0x29, 0x12},                                    
	{0x2a, 0x50},                                    
                                                       
                                                       
	{0x2b, 0x02},                                    
	{0x2c, 0x02},                                    
	{0x25, 0x06},                                    
	{0x2d, 0x0c},                                    
	{0x2e, 0x12},                                    
	{0x2f, 0x12},                                    
                                                       
                                                       
	{0x50, 0x10},                                    
	{0x51, 0x14},                                    
	{0x52, 0x12},                                    
	{0x53, 0x0c},                                    
	{0x54, 0x0f},                                    
	{0x55, 0x0c},                                    
                                                       
                                                       
	{0x56, 0x10},                                    
	{0x57, 0x13},                                    
	{0x58, 0x12},                                    
	{0x59, 0x0c},                                    
	{0x5a, 0x0f},                                    
	{0x5b, 0x0c},                                    
                                                       
                                                       
	{0x5c, 0x0a},                                    
	{0x5d, 0x0b},                                    
	{0x5e, 0x0a},                                    
	{0x5f, 0x08},                                    
	{0x60, 0x09},                                    
	{0x61, 0x08},                                    
                                                       
                                                       
	{0x62, 0x08},                                    
	{0x63, 0x08},                                    
	{0x64, 0x08},                                    
	{0x65, 0x06},                                    
	{0x66, 0x06},                                    
	{0x67, 0x06},                                    
                                                       
                                                       
	{0x68, 0x07},                                    
	{0x69, 0x07},                                    
	{0x6a, 0x07},                                    
	{0x6b, 0x05},                                    
	{0x6c, 0x05},                                    
	{0x6d, 0x05},                                    
                                                       
                                                       
	{0x6e, 0x07},                                    
	{0x6f, 0x07},                                    
	{0x70, 0x07},                                    
	{0x71, 0x05},                                    
	{0x72, 0x05},                                    
	{0x73, 0x05},                                    
                                                       
                                                       
	                                                     
	{0x80, 0xfd},                                    
	{0x81, 0x1f},                                    
	{0x82, 0x05},                                    
	{0x83, 0x31},                                    
                                                       
	{0x90, 0x05},                                    
	{0x91, 0x05},                                    
	{0x92, 0x33},                                    
	{0x93, 0x30},                                    
	{0x94, 0x03},                                    
	{0x95, 0x14},                                    
	{0x97, 0x20},                                    
	{0x99, 0x20},                                    
                                                       
	{0xa0, 0x01},                                    
	{0xa1, 0x02},                                    
	{0xa2, 0x01},                                    
	{0xa3, 0x02},                                    
	{0xa4, 0x05},                                    
	{0xa5, 0x05},                                    
	{0xa6, 0x07},                                    
	{0xa7, 0x08},                                    
	{0xa8, 0x07},                                    
	{0xa9, 0x08},                                    
	{0xaa, 0x07},                                    
	{0xab, 0x08},                                    
                                                       
                                                       
	{0xb0, 0x22},                                    
	{0xb1, 0x2a},                                    
	{0xb2, 0x28},                                    
	{0xb3, 0x22},                                    
	{0xb4, 0x2a},                                    
	{0xb5, 0x28},                                    
                                                       
                                                       
	{0xb6, 0x22},                                    
	{0xb7, 0x2a},                                    
	{0xb8, 0x28},                                    
	{0xb9, 0x22},                                    
	{0xba, 0x2a},                                    
	{0xbb, 0x28},                                    
                                                       
                                                       
	{0xbc, 0x25},                                    
	{0xbd, 0x2a},                                    
	{0xbe, 0x27},                                    
	{0xbf, 0x25},                                    
	{0xc0, 0x2a},                                    
	{0xc1, 0x27},                                    
                                                       
	                                                     
	{0xc2, 0x1e},                                    
	{0xc3, 0x24},                                    
	{0xc4, 0x20},                                    
	{0xc5, 0x1e},                                    
	{0xc6, 0x24},                                    
	{0xc7, 0x20},                                    
                                                       
	                                                     
	{0xc8, 0x18},                                    
	{0xc9, 0x20},                                    
	{0xca, 0x1e},                                    
	{0xcb, 0x18},                                    
	{0xcc, 0x20},                                    
	{0xcd, 0x1e},                                    
                                                       
                                                       
	{0xce, 0x18},                                    
	{0xcf, 0x20},                                    
	{0xd0, 0x1e},                                    
	{0xd1, 0x18},                                    
	{0xd2, 0x20},                                    
	{0xd3, 0x1e},                                    
                                                       
                                                       
	{0x03, 0x14},                                    
	{0x10, 0x11},                                    
                                                       
	{0x14, 0x80},  // GX                             
	{0x15, 0x80},  // GY                             
	{0x16, 0x80},  // RX                             
	{0x17, 0x80},  // RY                             
	{0x18, 0x80},  // BX                             
	{0x19, 0x80},  // BY                             
                                                       
	{0x20, 0x60},  //X 60 //a0                       
	{0x21, 0x80},  //Y                               
                                                       
	{0x22, 0x80},                                    
	{0x23, 0x80},                                    
	{0x24, 0x80},                                    
                                                       
	{0x30, 0xc8},                                    
	{0x31, 0x2b},                                    
	{0x32, 0x00},                                    
	{0x33, 0x00},                                    
	{0x34, 0x90},                                    
                                                       
	{0x40, 0x48},  //31                              
	{0x50, 0x34},  //23 //32                         
	{0x60, 0x29},  //                                
	{0x70, 0x34},  //23 //32                         
                                                       
                                                       
	{0x03, 0x15},                                    
	{0x10, 0x0f},                                    
                                                       
	                                                     
	                                                     
	{0x14, 0x42},  //CMCOFSGH_Day //4c               
	{0x15, 0x32},  //CMCOFSGM_CWF //3c               
	{0x16, 0x24},  //CMCOFSGL_A //2e                 
	{0x17, 0x2f},  //CMC SIGN                        
                                                       
                                                       
	{0x30, 0x8f},                                    
	{0x31, 0x59},                                    
	{0x32, 0x0a},                                    
	{0x33, 0x15},                                    
	{0x34, 0x5b},                                    
	{0x35, 0x06},                                    
	{0x36, 0x07},                                    
	{0x37, 0x40},                                    
	{0x38, 0x87},  //86                              
                                                       
	                                                     
	{0x40, 0x92},                                    
	{0x41, 0x1b},                                    
	{0x42, 0x89},                                    
	{0x43, 0x81},                                    
	{0x44, 0x00},                                    
	{0x45, 0x01},                                    
	{0x46, 0x89},                                    
	{0x47, 0x9e},                                    
	{0x48, 0x28},                                    
              
                                                       
	{0x50, 0x02},                                    
	{0x51, 0x82},                                    
	{0x52, 0x00},                                    
	{0x53, 0x07},                                    
	{0x54, 0x11},                                    
	{0x55, 0x98},                                    
	{0x56, 0x00},                                    
	{0x57, 0x0b},                                    
	{0x58, 0x8b},                                    
                                                       
	{0x80, 0x03},                                    
	{0x85, 0x40},                                    
	{0x87, 0x02},                                    
	{0x88, 0x00},                                    
	{0x89, 0x00},                                    
	{0x8a, 0x00},                                    
                                                       
                                                       
	{0x03, 0x16},                                    
	{0x10, 0x31},                                    
	{0x18, 0x5e}, // Double_AG 5e->37                
	{0x19, 0x5d}, // Double_AG 5e->36                
	{0x1a, 0x0e},                                    
	{0x1b, 0x01},                                    
	{0x1c, 0xdc},                                    
	{0x1d, 0xfe},                                    
                                                       
                                                       
	{0x30, 0x00},                                    
	{0x31, 0x0a},                                    
	{0x32, 0x1f},                                    
	{0x33, 0x33},                                    
	{0x34, 0x53},                                    
	{0x35, 0x6c},                                    
	{0x36, 0x81},                                    
	{0x37, 0x94},                                    
	{0x38, 0xa4},                                    
	{0x39, 0xb3},                                    
	{0x3a, 0xc0},                                    
	{0x3b, 0xcb},                                    
	{0x3c, 0xd5},                                    
	{0x3d, 0xde},                                    
	{0x3e, 0xe6},                                    
	{0x3f, 0xee},                                    
	{0x40, 0xf5},                                    
	{0x41, 0xfc},                                    
	{0x42, 0xff},                                    
                                                       
	{0x50, 0x00},                                    
	{0x51, 0x09},                                    
	{0x52, 0x1f},                                    
	{0x53, 0x37},                                    
	{0x54, 0x5b},                                    
	{0x55, 0x76},                                    
	{0x56, 0x8d},                                    
	{0x57, 0xa1},                                    
	{0x58, 0xb2},                                    
	{0x59, 0xbe},                                    
	{0x5a, 0xc9},                                    
	{0x5b, 0xd2},                                    
	{0x5c, 0xdb},                                    
	{0x5d, 0xe3},                                    
	{0x5e, 0xeb},                                    
	{0x5f, 0xf0},                                    
	{0x60, 0xf5},                                    
	{0x61, 0xf7},                                    
	{0x62, 0xf8},                                    
                                                       
	{0x70, 0x00},                                    
	{0x71, 0x08},                                    
	{0x72, 0x17},                                    
	{0x73, 0x2f},                                    
	{0x74, 0x53},                                    
	{0x75, 0x6c},                                    
	{0x76, 0x81},                                    
	{0x77, 0x94},                                    
	{0x78, 0xa4},                                    
	{0x79, 0xb3},                                    
	{0x7a, 0xc0},                                    
	{0x7b, 0xcb},                                    
	{0x7c, 0xd5},                                    
	{0x7d, 0xde},                                    
	{0x7e, 0xe6},                                    
	{0x7f, 0xee},                                    
	{0x80, 0xf4},                                    
	{0x81, 0xfa},                                    
	{0x82, 0xff},                                    
                                                       
                                                       
	{0x03, 0x17},                                    
	{0x10, 0xf7},                                    
                                                       
	{0x03, 0x18},                                    
	{0x12, 0x20},                                    
	{0x10, 0x07},                                    
	{0x11, 0x00},                                    
	{0x20, 0x05},                                    
	{0x21, 0x20},                                    
	{0x22, 0x03},                                    
	{0x23, 0xd8},                                    
	{0x24, 0x00},                                    
	{0x25, 0x10},                                    
	{0x26, 0x00},                                    
	{0x27, 0x0c},                                    
	{0x28, 0x05},                                    
	{0x29, 0x10},                                    
	{0x2a, 0x03},                                    
	{0x2b, 0xcc},                                    
	{0x2c, 0x09},                                    
	{0x2d, 0xc1},                                    
	{0x2e, 0x09},                                    
	{0x2f, 0xc1},                                    
	{0x30, 0x41},                                    
                                                       
                                                       
	{0x03, 0x20},                                    
	{0x11, 0x1c},                                    
	{0x18, 0x30},                                    
	{0x1a, 0x08},                                    
	{0x20, 0x01},  //05_lowtemp Y Mean off           
	{0x21, 0x30},                                    
	{0x22, 0x10},                                    
	{0x23, 0x00},                                    
	{0x24, 0x00},  //Uniform Scene Off               
                                                       
	{0x28, 0xe7},                                    
	{0x29, 0x0d},  //20100305 ad->0d                 
	{0x2a, 0xff},                                    
	{0x2b, 0x04},  //f4->Adaptive off                
                                                       
	{0x2c, 0xc2},                                    
	{0x2d, 0xcf},   //ff->AE Speed option            
	{0x2e, 0x33},                                    
	{0x30, 0x78},  //f8                              
	{0x32, 0x03},                                    
	{0x33, 0x2e},                                    
	{0x34, 0x30},                                    
	{0x35, 0xd4},                                    
	{0x36, 0xfe},                                    
	{0x37, 0x32},                                    
	{0x38, 0x04},                                    
                                                       
	{0x39, 0x22},  //AE_escapeC10                    
	{0x3a, 0xde},  //AE_escapeC11                    
                                                       
	{0x3b, 0x22},  //AE_escapeC1                     
	{0x3c, 0xde},  //AE_escapeC2                     
                                                       
	{0x50, 0x45},                                    
	{0x51, 0x88},                                    
                                                       
	{0x56, 0x03},                                    
	{0x57, 0xf7},                                    
	{0x58, 0x14},                                    
	{0x59, 0x88},                                    
	{0x5a, 0x04}, 

	{0x60, 0x55},  // AEWGT1
	{0x61, 0x55},  // AEWGT2
	{0x62, 0x6a},  // AEWGT3
	{0x63, 0xa9},  // AEWGT4
	{0x64, 0x6a},  // AEWGT5
	{0x65, 0xa9},  // AEWGT6
	{0x66, 0x6a},  // AEWGT7
	{0x67, 0xa9},  // AEWGT8
	{0x68, 0x6b},  // AEWGT9
	{0x69, 0xe9},  // AEWGT10
	{0x6a, 0x6a},  // AEWGT11
	{0x6b, 0xa9},  // AEWGT12
	{0x6c, 0x6a},  // AEWGT13
	{0x6d, 0xa9},  // AEWGT14
	{0x6e, 0x55},  // AEWGT15
	{0x6f, 0x55},  // AEWGT16

	{0x70, 0x70},  //6e
	{0x71, 0x00},  //82(+8)->+0


	{0x76, 0x43}, 
	{0x77, 0xe2},  //04
	{0x78, 0x23},  //Yth1
	{0x79, 0x42},  //Yth2
	{0x7a, 0x23},  //23
	{0x7b, 0x22},  //22
	{0x7d, 0x23}, 

	{0x83, 0x01},  //EXP Normal 33.33 fps 
	{0x84, 0xb7},  
	{0x85, 0x74},  

	{0x86, 0x01},  //EXPMin 5859.38 fps
	{0x87, 0xf4},  

	{0x88, 0x05},  //EXP Max 10.00 fps 
	{0x89, 0xb8},  
	{0x8a, 0xd8},  

	{0x8B, 0x49},  //EXP100 
	{0x8C, 0x3e},  
	{0x8D, 0x3c},  //EXP120 
	{0x8E, 0x8c},  
	{0x9c, 0x17},  //EXP Limit 488.28 fps 
	{0x9d, 0x70},  
	{0x9e, 0x01},  //EXP Unit 
	{0x9f, 0xf4},  

	//AE_Middle Time option
	//{0xa0, 0x03}, 
	//{0xa1, 0xa9}, 
	//{0xa2, 0x80}, 

	{0xb0, 0x18}, 
	{0xb1, 0x14},  //ADC 400->560
	{0xb2, 0xa0},  //d0
	{0xb3, 0x18}, 
	{0xb4, 0x1a}, 
	{0xb5, 0x44}, 
	{0xb6, 0x2f}, 
	{0xb7, 0x28}, 
	{0xb8, 0x25}, 
	{0xb9, 0x22}, 
	{0xba, 0x21}, 
	{0xbb, 0x20}, 
	{0xbc, 0x1f}, 
	{0xbd, 0x1f}, 

	//AE_Adaptive Time option
	//{0xc0, 0x10}, 
	//{0xc1, 0x2b}, 
	//{0xc2, 0x2b}, 
	//{0xc3, 0x2b}, 
	//{0xc4, 0x08}, 

	{0xc8, 0x80}, 
	{0xc9, 0x40}, 

	/////// PAGE 22 START ///////
	{0x03, 0x22}, 
	{0x10, 0xfd}, 
	{0x11, 0x2e}, 
	{0x19, 0x01},  // Low On //
	{0x20, 0x30}, 
	{0x21, 0x80}, 
	{0x24, 0x01}, 
	//{0x25, 0x00},  //7f New Lock Cond & New light stable

	{0x30, 0x80}, 
	{0x31, 0x80}, 
	{0x38, 0x11}, 
	{0x39, 0x34}, 

	{0x40, 0xf4}, 
	{0x41, 0x55},  //44
	{0x42, 0x33},  //43

	{0x43, 0xf6}, 
	{0x44, 0x55},  //44
	{0x45, 0x44},  //33

	{0x46, 0x00}, 
	{0x50, 0xb2}, 
	{0x51, 0x81}, 
	{0x52, 0x98}, 

	{0x80, 0x40},  //3e
	{0x81, 0x20}, 
	{0x82, 0x3e}, 

	{0x83, 0x5e},  //5e
	{0x84, 0x1e},  //24
	{0x85, 0x5e},  //54 //56 //5a
	{0x86, 0x22},  //24 //22

	{0x87, 0x49}, 
	{0x88, 0x39}, 
	{0x89, 0x37},  //38
	{0x8a, 0x28},  //2a

	{0x8b, 0x41},  //47
	{0x8c, 0x39},  
	{0x8d, 0x34},  
	{0x8e, 0x28},  //2c

	{0x8f, 0x53},  //4e
	{0x90, 0x52},  //4d
	{0x91, 0x51},  //4c
	{0x92, 0x4e},  //4a
	{0x93, 0x4a},  //46
	{0x94, 0x45}, 
	{0x95, 0x3d}, 
	{0x96, 0x31}, 
	{0x97, 0x28}, 
	{0x98, 0x24}, 
	{0x99, 0x20}, 
	{0x9a, 0x20}, 

	{0x9b, 0x77}, 
	{0x9c, 0x77}, 
	{0x9d, 0x48}, 
	{0x9e, 0x38}, 
	{0x9f, 0x30}, 

	{0xa0, 0x60}, 
	{0xa1, 0x34}, 
	{0xa2, 0x6f}, 
	{0xa3, 0xff}, 

	{0xa4, 0x14},  //1500fps
	{0xa5, 0x2c},  // 700fps
	{0xa6, 0xcf}, 

	{0xad, 0x40}, 
	{0xae, 0x4a}, 

	{0xaf, 0x28},   // low temp Rgain
	{0xb0, 0x26},   // low temp Rgain

	{0xb1, 0x00},  //0x20 -> 0x00 0405 modify
	{0xb4, 0xea}, 
	{0xb8, 0xa0},  //a2: b-2, R+2  //b4 B-3, R+4 lowtemp
	{0xb9, 0x00}, 

	/////// PAGE 20 ///////
	{0x03, 0x20}, 
	{0x10, 0x8c}, 

	// PAGE 20
	{0x03, 0x20},  //page 20
	{0x10, 0x9c},  //ae off

	// PAGE 22
	{0x03, 0x22},  //page 22
	{0x10, 0xe9},  //awb off

	// PAGE 0
	{0x03, 0x00}, 
	{0x0e, 0x03},  //PLL On
	{0x0e, 0x73},  //PLLx2

	{0x03, 0x00},  // Dummy 750us
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 

	/*1024*768  add by joe*/
	{0x03, 0x00},
	{0x10, 0x00},

	{0x03, 0x18},
	{0x12, 0x20},
	{0x10, 0x07},
	{0x11, 0x00},
	{0x20, 0x05},
	{0x21, 0x20},
	{0x22, 0x03},
	{0x23, 0xd8},
	{0x24, 0x00},
	{0x25, 0x90},
	{0x26, 0x00},
	{0x27, 0x6c},
	{0x28, 0x04},
	{0x29, 0x90},
	{0x2a, 0x03},
	{0x2b, 0x6c},
	{0x2c, 0x09},
	{0x2d, 0xc1},
	{0x2e, 0x09},
	{0x2f, 0xc1},
	{0x30, 0x56},


	{0x03, 0x00}, // Page 0
	{0x01, 0xf8}, // Sleep Off 0xf8->0x50 for solve green line issue

};                                                                    

static struct sensor_reg hi253_setting_30fps_XGA_1024_768[] = {
	{0x0, 0x0}
};

static struct sensor_reg hi253_setting_15fps_VGA_640_480[] = {
	/*
	 * Only support 7.5fps for QXGA to workaround screen tearing issue
	 * for 15fps when capturing still image.
	 */
	 {0x01, 0xf9},  //sleep on                         
	{0x08, 0x0f},  //Hi-Z on                         
	{0x01, 0xf8},   //sleep off                      
                                                       
	{0x03, 0x00},  // Dummy 750us START              
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},  // Dummy 750us END                
                                                       
	{0x0e, 0x03},  //PLL On                          
	{0x0e, 0x73},  //PLLx2                           
                                                       
	{0x03, 0x00},  // Dummy 750us START              
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},  // Dummy 750us END                
                                                       
	{0x0e, 0x00},  //PLL off                         
	{0x01, 0xf1},  //sleep on                        
	{0x08, 0x00},  //Hi-Z off                        
                                                       
	{0x01, 0xf3},                                    
	{0x01, 0xf1},                                    
                                                       
	                                                     
	{0x03, 0x20},  //page 20                         
	{0x10, 0x1c},  //ae off                          
                                                       
                                                       
	{0x03, 0x22},  //page 22                         
	{0x10, 0x69},  //awb off                         
                                                       
                                                       
	                                                     
	                                                     
	{0x03, 0x00},                                    
	{0x10, 0x11},  // Sub1/2_Preview2 Mode_H binning 
	{0x11, 0x91},                                    
	{0x12, 0x20}, //21                               
                                                       
	{0x0b, 0xaa},  // ESD Check Register             
	{0x0c, 0xaa},  // ESD Check Register             
	{0x0d, 0xaa},  // ESD Check Register             
                                                       
	{0x20, 0x00},  // Windowing start point Y        
	{0x21, 0x04},                                    
	{0x22, 0x00},  // Windowing start point X        
	{0x23, 0x07},                                    
                                                       
	{0x24, 0x04},                                    
	{0x25, 0xb0},                                    
	{0x26, 0x06},                                    
	{0x27, 0x40},  // WINROW END                     
                                                       
	{0x40, 0x01},  //Hblank 408                      
	{0x41, 0x68},                                    
	{0x42, 0x00},  //Vblank 20                       
	{0x43, 0x14},                                    
                                                       
	{0x45, 0x04},                                    
	{0x46, 0x18},                                    
	{0x47, 0xd8},                                    
                                                       
                                                       
	{0x80, 0x2e},                                    
	{0x81, 0x7e},                                    
	{0x82, 0x90},                                    
	{0x83, 0x00},                                    
	{0x84, 0x0c},                                    
	{0x85, 0x00},                                    
	{0x90, 0x14},  //BLC_TIME_TH_ON                  
	{0x91, 0x14},  //BLC_TIME_TH_OFF                 
	{0x92, 0x98},  //BLC_AG_TH_ON                    
	{0x93, 0x90},  //BLC_AG_TH_OFF                   
	{0x94, 0x75},                                    
	{0x95, 0x70},                                    
	{0x96, 0xdc},                                    
	{0x97, 0xfe},                                    
	{0x98, 0x38},                                    
                                                       
                                                       
	{0x99, 0x43},                                    
	{0x9a, 0x43},                                    
	{0x9b, 0x43},                                    
	{0x9c, 0x43},                                    
                                                       
                                                       
	{0xa0, 0x00},                                    
	{0xa2, 0x00},                                    
	{0xa4, 0x00},                                    
	{0xa6, 0x00},                                    
                                                       
                                                       
	{0xa8, 0x43},                                    
	{0xaa, 0x43},                                    
	{0xac, 0x43},                                    
	{0xae, 0x43},                                    
                                                       
                                                       
	{0x03, 0x02},                                    
	{0x12, 0x03},                                    
	{0x13, 0x03},                                    
	{0x16, 0x00},                                    
	{0x17, 0x8C},                                    
	{0x18, 0x4c},  //Double_AG off                   
	{0x19, 0x00},                                    
	{0x1a, 0x39},  //ADC400->560                     
	{0x1c, 0x09},                                    
	{0x1d, 0x40},                                    
	{0x1e, 0x30},                                    
	{0x1f, 0x10},                                    
                                                       
	{0x20, 0x77},                                    
	{0x21, 0xde},                                    
	{0x22, 0xa7},                                    
	{0x23, 0x30},  //CLAMP                           
	{0x27, 0x3c},                                    
	{0x2b, 0x80},                                    
	{0x2e, 0x11},                                    
	{0x2f, 0xa1},                                    
	{0x30, 0x05},  //For Hi-253 never no change 0x05 
                                                       
	{0x50, 0x20},                                    
	{0x52, 0x01},                                    
	{0x55, 0x1c},                                    
	{0x56, 0x11},                                    
	{0x5d, 0xa2},                                    
	{0x5e, 0x5a},                                    
                                                       
	{0x60, 0x87},                                    
	{0x61, 0x99},                                    
	{0x62, 0x88},                                    
	{0x63, 0x97},                                    
	{0x64, 0x88},                                    
	{0x65, 0x97},                                    
                                                       
	{0x67, 0x0c},                                    
	{0x68, 0x0c},                                    
	{0x69, 0x0c},                                    
                                                       
	{0x72, 0x89},                                    
	{0x73, 0x96},                                    
	{0x74, 0x89},                                    
	{0x75, 0x96},                                    
	{0x76, 0x89},                                    
	{0x77, 0x96},                                    
                                                       
	{0x7c, 0x85},                                    
	{0x7d, 0xaf},                                    
	{0x80, 0x01},                                    
	{0x81, 0x7f},                                    
	{0x82, 0x13},                                    
                                                       
	{0x83, 0x24},                                    
	{0x84, 0x7d},                                    
	{0x85, 0x81},                                    
	{0x86, 0x7d},                                    
	{0x87, 0x81},                                    
                                                       
	{0x92, 0x48},                                    
	{0x93, 0x54},                                    
	{0x94, 0x7d},                                    
	{0x95, 0x81},                                    
	{0x96, 0x7d},                                    
	{0x97, 0x81},                                    
                                                       
	{0xa0, 0x02},                                    
	{0xa1, 0x7b},                                    
	{0xa2, 0x02},                                    
	{0xa3, 0x7b},                                    
	{0xa4, 0x7b},                                    
	{0xa5, 0x02},                                    
	{0xa6, 0x7b},                                    
	{0xa7, 0x02},                                    
                                                       
	{0xa8, 0x85},                                    
	{0xa9, 0x8c},                                    
	{0xaa, 0x85},                                    
	{0xab, 0x8c},                                    
	{0xac, 0x10},                                    
	{0xad, 0x16},                                    
	{0xae, 0x10},                                    
	{0xaf, 0x16},                                    
                                                       
	{0xb0, 0x99},                                    
	{0xb1, 0xa3},                                    
	{0xb2, 0xa4},                                    
	{0xb3, 0xae},                                    
	{0xb4, 0x9b},                                    
	{0xb5, 0xa2},                                    
	{0xb6, 0xa6},                                    
	{0xb7, 0xac},                                    
	{0xb8, 0x9b},                                    
	{0xb9, 0x9f},                                    
	{0xba, 0xa6},                                    
	{0xbb, 0xaa},                                    
	{0xbc, 0x9b},                                    
	{0xbd, 0x9f},                                    
	{0xbe, 0xa6},                                    
	{0xbf, 0xaa},                                    
                                                       
	{0xc4, 0x2c},                                    
	{0xc5, 0x43},                                    
	{0xc6, 0x63},                                    
	{0xc7, 0x79},                                    
                                                       
	{0xc8, 0x2d},                                    
	{0xc9, 0x42},                                    
	{0xca, 0x2d},                                    
	{0xcb, 0x42},                                    
	{0xcc, 0x64},                                    
	{0xcd, 0x78},                                    
	{0xce, 0x64},                                    
	{0xcf, 0x78},                                    
                                                       
	{0xd0, 0x0a},                                    
	{0xd1, 0x09},                                    
	{0xd4, 0x14},  //DCDC_TIME_TH_ON                 
	{0xd5, 0x14},  //DCDC_TIME_TH_OFF                
	{0xd6, 0x98},  //DCDC_AG_TH_ON                   
	{0xd7, 0x90},  //DCDC_AG_TH_OFF                  
	{0xe0, 0xc4},                                    
	{0xe1, 0xc4},                                    
	{0xe2, 0xc4},                                    
	{0xe3, 0xc4},                                    
	{0xe4, 0x00},                                    
	{0xe8, 0x80},                                    
	{0xe9, 0x40},                                    
	{0xea, 0x7f},                                    
                                                       
                                                       
	{0x03, 0x03},                                    
	{0x10, 0x10},                                    
                                                       
                                                       
	{0x03, 0x10},                                    
	{0x10, 0x01},  // CrYCbY // For Demoset 0x03     
	{0x12, 0x30},                                    
	{0x13, 0x0a},  // contrast on                    
	{0x20, 0x00},                                    
                                                       
	{0x30, 0x00},                                    
	{0x31, 0x00},                                    
	{0x32, 0x00},                                    
	{0x33, 0x00},                                    
                                                       
	{0x34, 0x30},                                    
	{0x35, 0x00},                                    
	{0x36, 0x00},                                    
	{0x38, 0x00},                                    
	{0x3e, 0x58},                                    
	{0x3f, 0x00},                                    
                                                       
	{0x40, 0x80},  // YOFS                           
	{0x41, 0x10},  // DYOFS                          
	{0x48, 0x84},  // Contrast                       
	{0x50, 0x90},  // Contrast                       
                                                       
	{0x60, 0x6c}, //67                               
	{0x61, 0x70},  //7e //8e //88 //80               
	{0x62, 0x68},  //7e //8e //88 //80               
	{0x63, 0x50},  //Double_AG 50->30                
	{0x64, 0x41},                                    
                                                       
	{0x66, 0x42},                                    
	{0x67, 0x20},                                    
                                                       
	{0x6a, 0x80},  //8a                              
	{0x6b, 0x84},  //74                              
	{0x6c, 0x80},  //7e //7a                         
	{0x6d, 0x80},  //8e                              
          
                                                       
	{0x03, 0x11},                                    
	{0x10, 0x7f},                                    
	{0x11, 0x40},                                    
	{0x12, 0x0a},  /* Blue Max-Filter Delete*/       
	{0x13, 0xbb},                                    
                                                       
	{0x26, 0x31},  /* Double_AG 31->20*/             
	{0x27, 0x34},  /* Double_AG 34->22*/             
	{0x28, 0x0f},                                    
	{0x29, 0x10},                                    
	{0x2b, 0x30},                                    
	{0x2c, 0x32},                                    
                                                       
                                                       
	{0x30, 0x70},                                    
	{0x31, 0x10},                                    
	{0x32, 0x58},                                    
	{0x33, 0x09},                                    
	{0x34, 0x06},                                    
	{0x35, 0x03},                                    
                                                       
                                                       
	{0x36, 0x70},                                    
	{0x37, 0x18},                                    
	{0x38, 0x58},                                    
	{0x39, 0x09},                                    
	{0x3a, 0x06},                                    
	{0x3b, 0x03},                                    
                                                       
                                                       
	{0x3c, 0x80},                                    
	{0x3d, 0x18},                                    
	{0x3e, 0x83},  /*80*/                            
	{0x3f, 0x0c},                                    
	{0x40, 0x03},                                    
	{0x41, 0x06},                                    
                                                       
	{0x42, 0x80},                                    
	{0x43, 0x18},                                    
	{0x44, 0x83},  /*80*/                            
	{0x45, 0x12},                                    
	{0x46, 0x10},                                    
	{0x47, 0x10},                                    
                                                       
	{0x48, 0x90},                                    
	{0x49, 0x40},                                    
	{0x4a, 0x80},                                    
	{0x4b, 0x13},                                    
	{0x4c, 0x10},                                    
	{0x4d, 0x11},                                    
                                                       
	{0x4e, 0x80},                                    
	{0x4f, 0x30},                                    
	{0x50, 0x80},                                    
	{0x51, 0x13},                                    
	{0x52, 0x10},                                    
	{0x53, 0x13},                                    
                                                       
	{0x54, 0x11},                                    
	{0x55, 0x17},                                    
	{0x56, 0x20},                                    
	{0x57, 0x01},                                    
	{0x58, 0x00},                                    
	{0x59, 0x00},                                    
                                                       
	{0x5a, 0x1f},  /*18*/                            
	{0x5b, 0x00},                                    
	{0x5c, 0x00},                                    
                                                       
	{0x60, 0x3f},                                    
	{0x62, 0x60},                                    
	{0x70, 0x06},                                    
                                                       
                                                       
	{0x03, 0x12},                                    
	{0x20, 0x00},                                    
	{0x21, 0x00},                                    
                                                       
	{0x25, 0x00},                                    
                                                       
	{0x28, 0x00},                                    
	{0x29, 0x00},                                    
	{0x2a, 0x00},                                    
                                                       
	{0x30, 0x50},                                    
	{0x31, 0x18},                                    
	{0x32, 0x32},                                    
	{0x33, 0x40},                                    
	{0x34, 0x50},                                    
	{0x35, 0x70},                                    
	{0x36, 0xa0},                                    
                                                       
                                                       
	{0x40, 0xa0},                                    
	{0x41, 0x40},                                    
	{0x42, 0xa0},                                    
	{0x43, 0x90},                                    
	{0x44, 0x90},                                    
	{0x45, 0x80},                                    
                                                       
	                                                     
	{0x46, 0xb0},                                    
	{0x47, 0x55},                                    
	{0x48, 0xa0},                                    
	{0x49, 0x90},                                    
	{0x4a, 0x90},                                    
	{0x4b, 0x80},                                    
                                                       
                                                       
	{0x4c, 0xb0},                                    
	{0x4d, 0x40},                                    
	{0x4e, 0x90},                                    
	{0x4f, 0x90},                                    
	{0x50, 0xa0},                                    
	{0x51, 0x60},                                    
                                                       
	                                                     
	{0x52, 0xb0},                                    
	{0x53, 0x60},                                    
	{0x54, 0xc0},                                    
	{0x55, 0xc0},                                    
	{0x56, 0x80},                                    
	{0x57, 0x57},                                    
                                                       
                                                       
	{0x58, 0x90},                                    
	{0x59, 0x40},                                    
	{0x5a, 0xd0},                                    
	{0x5b, 0xd0},                                    
	{0x5c, 0xe0},                                    
	{0x5d, 0x80},                                    
                                                       
                                                       
	{0x5e, 0x88},                                    
	{0x5f, 0x40},                                    
	{0x60, 0xe0},                                    
	{0x61, 0xe0},                                    
	{0x62, 0xe0},                                    
	{0x63, 0x80},                                    
                                                       
	{0x70, 0x15},                                    
	{0x71, 0x01},  /*Don't Touch register*/          
                                                       
	{0x72, 0x18},                                    
	{0x73, 0x01},  /*Don't Touch register*/          
                                                       
	{0x74, 0x25},                                    
	{0x75, 0x15},                                    
                                                       
	{0x80, 0x20},                                    
	{0x81, 0x40},                                    
	{0x82, 0x65},                                    
	{0x85, 0x1a},                                    
	{0x88, 0x00},                                    
	{0x89, 0x00},                                    
	{0x90, 0x5d},  /*For Preview*/                   
                                                       
/*Dont Touch register*/                                
	{0xD0, 0x0c},                                    
	{0xD1, 0x80},                                    
	{0xD2, 0x67},                                    
	{0xD3, 0x00},                                    
	{0xD4, 0x00},                                    
	{0xD5, 0x02},                                    
	{0xD6, 0xff},                                    
	{0xD7, 0x18},                                    
                                                       
	{0x3b, 0x06},                                    
	{0x3c, 0x06},                                    
                                                       
	{0xc5, 0x00}, /*55->48*/                         
	{0xc6, 0x00}, /*48->40*/                         
                                                       
                                                       
	{0x03, 0x13},                                    
                                                       
	{0x10, 0xcb},                                    
	{0x11, 0x7b},                                    
	{0x12, 0x07},                                    
	{0x14, 0x00},                                    
                                                       
	{0x20, 0x15},                                    
	{0x21, 0x13},                                    
	{0x22, 0x33},                                    
	{0x23, 0x05},                                    
	{0x24, 0x09},                                    
                                                       
	{0x25, 0x0a},                                    
                                                       
	{0x26, 0x18},                                    
	{0x27, 0x30},                                    
	{0x29, 0x12},                                    
	{0x2a, 0x50},                                    
                                                       
                                                       
	{0x2b, 0x02},                                    
	{0x2c, 0x02},                                    
	{0x25, 0x06},                                    
	{0x2d, 0x0c},                                    
	{0x2e, 0x12},                                    
	{0x2f, 0x12},                                    
                                                       
                                                       
	{0x50, 0x10},                                    
	{0x51, 0x14},                                    
	{0x52, 0x12},                                    
	{0x53, 0x0c},                                    
	{0x54, 0x0f},                                    
	{0x55, 0x0c},                                    
                                                       
                                                       
	{0x56, 0x10},                                    
	{0x57, 0x13},                                    
	{0x58, 0x12},                                    
	{0x59, 0x0c},                                    
	{0x5a, 0x0f},                                    
	{0x5b, 0x0c},                                    
                                                       
                                                       
	{0x5c, 0x0a},                                    
	{0x5d, 0x0b},                                    
	{0x5e, 0x0a},                                    
	{0x5f, 0x08},                                    
	{0x60, 0x09},                                    
	{0x61, 0x08},                                    
                                                       
                                                       
	{0x62, 0x08},                                    
	{0x63, 0x08},                                    
	{0x64, 0x08},                                    
	{0x65, 0x06},                                    
	{0x66, 0x06},                                    
	{0x67, 0x06},                                    
                                                       
                                                       
	{0x68, 0x07},                                    
	{0x69, 0x07},                                    
	{0x6a, 0x07},                                    
	{0x6b, 0x05},                                    
	{0x6c, 0x05},                                    
	{0x6d, 0x05},                                    
                                                       
                                                       
	{0x6e, 0x07},                                    
	{0x6f, 0x07},                                    
	{0x70, 0x07},                                    
	{0x71, 0x05},                                    
	{0x72, 0x05},                                    
	{0x73, 0x05},                                    
                                                       
                                                       
	                                                     
	{0x80, 0xfd},                                    
	{0x81, 0x1f},                                    
	{0x82, 0x05},                                    
	{0x83, 0x31},                                    
                                                       
	{0x90, 0x05},                                    
	{0x91, 0x05},                                    
	{0x92, 0x33},                                    
	{0x93, 0x30},                                    
	{0x94, 0x03},                                    
	{0x95, 0x14},                                    
	{0x97, 0x20},                                    
	{0x99, 0x20},                                    
                                                       
	{0xa0, 0x01},                                    
	{0xa1, 0x02},                                    
	{0xa2, 0x01},                                    
	{0xa3, 0x02},                                    
	{0xa4, 0x05},                                    
	{0xa5, 0x05},                                    
	{0xa6, 0x07},                                    
	{0xa7, 0x08},                                    
	{0xa8, 0x07},                                    
	{0xa9, 0x08},                                    
	{0xaa, 0x07},                                    
	{0xab, 0x08},                                    
                                                       
                                                       
	{0xb0, 0x22},                                    
	{0xb1, 0x2a},                                    
	{0xb2, 0x28},                                    
	{0xb3, 0x22},                                    
	{0xb4, 0x2a},                                    
	{0xb5, 0x28},                                    
                                                       
                                                       
	{0xb6, 0x22},                                    
	{0xb7, 0x2a},                                    
	{0xb8, 0x28},                                    
	{0xb9, 0x22},                                    
	{0xba, 0x2a},                                    
	{0xbb, 0x28},                                    
                                                       
                                                       
	{0xbc, 0x25},                                    
	{0xbd, 0x2a},                                    
	{0xbe, 0x27},                                    
	{0xbf, 0x25},                                    
	{0xc0, 0x2a},                                    
	{0xc1, 0x27},                                    
                                                       
	                                                     
	{0xc2, 0x1e},                                    
	{0xc3, 0x24},                                    
	{0xc4, 0x20},                                    
	{0xc5, 0x1e},                                    
	{0xc6, 0x24},                                    
	{0xc7, 0x20},                                    
                                                       
	                                                     
	{0xc8, 0x18},                                    
	{0xc9, 0x20},                                    
	{0xca, 0x1e},                                    
	{0xcb, 0x18},                                    
	{0xcc, 0x20},                                    
	{0xcd, 0x1e},                                    
                                                       
                                                       
	{0xce, 0x18},                                    
	{0xcf, 0x20},                                    
	{0xd0, 0x1e},                                    
	{0xd1, 0x18},                                    
	{0xd2, 0x20},                                    
	{0xd3, 0x1e},                                    
                                                       
                                                       
	{0x03, 0x14},                                    
	{0x10, 0x11},                                    
                                                       
	{0x14, 0x80},  // GX                             
	{0x15, 0x80},  // GY                             
	{0x16, 0x80},  // RX                             
	{0x17, 0x80},  // RY                             
	{0x18, 0x80},  // BX                             
	{0x19, 0x80},  // BY                             
                                                       
	{0x20, 0x60},  //X 60 //a0                       
	{0x21, 0x80},  //Y                               
                                                       
	{0x22, 0x80},                                    
	{0x23, 0x80},                                    
	{0x24, 0x80},                                    
                                                       
	{0x30, 0xc8},                                    
	{0x31, 0x2b},                                    
	{0x32, 0x00},                                    
	{0x33, 0x00},                                    
	{0x34, 0x90},                                    
                                                       
	{0x40, 0x48},  //31                              
	{0x50, 0x34},  //23 //32                         
	{0x60, 0x29},  //                                
	{0x70, 0x34},  //23 //32                         
                                                       
                                                       
	{0x03, 0x15},                                    
	{0x10, 0x0f},                                    
                                                       
	                                                     
	                                                     
	{0x14, 0x42},  //CMCOFSGH_Day //4c               
	{0x15, 0x32},  //CMCOFSGM_CWF //3c               
	{0x16, 0x24},  //CMCOFSGL_A //2e                 
	{0x17, 0x2f},  //CMC SIGN                        
                                                       
                                                       
	{0x30, 0x8f},                                    
	{0x31, 0x59},                                    
	{0x32, 0x0a},                                    
	{0x33, 0x15},                                    
	{0x34, 0x5b},                                    
	{0x35, 0x06},                                    
	{0x36, 0x07},                                    
	{0x37, 0x40},                                    
	{0x38, 0x87},  //86                              
                                                       
	                                                     
	{0x40, 0x92},                                    
	{0x41, 0x1b},                                    
	{0x42, 0x89},                                    
	{0x43, 0x81},                                    
	{0x44, 0x00},                                    
	{0x45, 0x01},                                    
	{0x46, 0x89},                                    
	{0x47, 0x9e},                                    
	{0x48, 0x28},                                    
                                                 
                                                       
	{0x50, 0x02},                                    
	{0x51, 0x82},                                    
	{0x52, 0x00},                                    
	{0x53, 0x07},                                    
	{0x54, 0x11},                                    
	{0x55, 0x98},                                    
	{0x56, 0x00},                                    
	{0x57, 0x0b},                                    
	{0x58, 0x8b},                                    
                                                       
	{0x80, 0x03},                                    
	{0x85, 0x40},                                    
	{0x87, 0x02},                                    
	{0x88, 0x00},                                    
	{0x89, 0x00},                                    
	{0x8a, 0x00},                                    
                                                       
                                                       
	{0x03, 0x16},                                    
	{0x10, 0x31},                                    
	{0x18, 0x5e}, // Double_AG 5e->37                
	{0x19, 0x5d}, // Double_AG 5e->36                
	{0x1a, 0x0e},                                    
	{0x1b, 0x01},                                    
	{0x1c, 0xdc},                                    
	{0x1d, 0xfe},                                    
                                                       
                                                       
	{0x30, 0x00},                                    
	{0x31, 0x0a},                                    
	{0x32, 0x1f},                                    
	{0x33, 0x33},                                    
	{0x34, 0x53},                                    
	{0x35, 0x6c},                                    
	{0x36, 0x81},                                    
	{0x37, 0x94},                                    
	{0x38, 0xa4},                                    
	{0x39, 0xb3},                                    
	{0x3a, 0xc0},                                    
	{0x3b, 0xcb},                                    
	{0x3c, 0xd5},                                    
	{0x3d, 0xde},                                    
	{0x3e, 0xe6},                                    
	{0x3f, 0xee},                                    
	{0x40, 0xf5},                                    
	{0x41, 0xfc},                                    
	{0x42, 0xff},                                    
                                                       
	{0x50, 0x00},                                    
	{0x51, 0x09},                                    
	{0x52, 0x1f},                                    
	{0x53, 0x37},                                    
	{0x54, 0x5b},                                    
	{0x55, 0x76},                                    
	{0x56, 0x8d},                                    
	{0x57, 0xa1},                                    
	{0x58, 0xb2},                                    
	{0x59, 0xbe},                                    
	{0x5a, 0xc9},                                    
	{0x5b, 0xd2},                                    
	{0x5c, 0xdb},                                    
	{0x5d, 0xe3},                                    
	{0x5e, 0xeb},                                    
	{0x5f, 0xf0},                                    
	{0x60, 0xf5},                                    
	{0x61, 0xf7},                                    
	{0x62, 0xf8},                                    
                                                       
	{0x70, 0x00},                                    
	{0x71, 0x08},                                    
	{0x72, 0x17},                                    
	{0x73, 0x2f},                                    
	{0x74, 0x53},                                    
	{0x75, 0x6c},                                    
	{0x76, 0x81},                                    
	{0x77, 0x94},                                    
	{0x78, 0xa4},                                    
	{0x79, 0xb3},                                    
	{0x7a, 0xc0},                                    
	{0x7b, 0xcb},                                    
	{0x7c, 0xd5},                                    
	{0x7d, 0xde},                                    
	{0x7e, 0xe6},                                    
	{0x7f, 0xee},                                    
	{0x80, 0xf4},                                    
	{0x81, 0xfa},                                    
	{0x82, 0xff},                                    
                                                       
                                                       
	{0x03, 0x17},                                    
	{0x10, 0xf7},                                    
                                                       
	{0x03, 0x18},                                    
	{0x12, 0x20},                                    
	{0x10, 0x07},                                    
	{0x11, 0x00},                                    
	{0x20, 0x05},                                    
	{0x21, 0x20},                                    
	{0x22, 0x03},                                    
	{0x23, 0xd8},                                    
	{0x24, 0x00},                                    
	{0x25, 0x10},                                    
	{0x26, 0x00},                                    
	{0x27, 0x0c},                                    
	{0x28, 0x05},                                    
	{0x29, 0x10},                                    
	{0x2a, 0x03},                                    
	{0x2b, 0xcc},                                    
	{0x2c, 0x09},                                    
	{0x2d, 0xc1},                                    
	{0x2e, 0x09},                                    
	{0x2f, 0xc1},                                    
	{0x30, 0x41},                                    
                                                       
                                                       
	{0x03, 0x20},                                    
	{0x11, 0x1c},                                    
	{0x18, 0x30},                                    
	{0x1a, 0x08},                                    
	{0x20, 0x01},  //05_lowtemp Y Mean off           
	{0x21, 0x30},                                    
	{0x22, 0x10},                                    
	{0x23, 0x00},                                    
	{0x24, 0x00},  //Uniform Scene Off               
                                                       
	{0x28, 0xe7},                                    
	{0x29, 0x0d},  //20100305 ad->0d                 
	{0x2a, 0xff},                                    
	{0x2b, 0x04},  //f4->Adaptive off                
                                                       
	{0x2c, 0xc2},                                    
	{0x2d, 0xcf},   //ff->AE Speed option            
	{0x2e, 0x33},                                    
	{0x30, 0x78},  //f8                              
	{0x32, 0x03},                                    
	{0x33, 0x2e},                                    
	{0x34, 0x30},                                    
	{0x35, 0xd4},                                    
	{0x36, 0xfe},                                    
	{0x37, 0x32},                                    
	{0x38, 0x04},                                    
                                                       
	{0x39, 0x22},  //AE_escapeC10                    
	{0x3a, 0xde},  //AE_escapeC11                    
                                                       
	{0x3b, 0x22},  //AE_escapeC1                     
	{0x3c, 0xde},  //AE_escapeC2                     
                                                       
	{0x50, 0x45},                                    
	{0x51, 0x88},                                    
                                                       
	{0x56, 0x03},                                    
	{0x57, 0xf7},                                    
	{0x58, 0x14},                                    
	{0x59, 0x88},                                    
	{0x5a, 0x04}, 

	{0x60, 0x55},  // AEWGT1
	{0x61, 0x55},  // AEWGT2
	{0x62, 0x6a},  // AEWGT3
	{0x63, 0xa9},  // AEWGT4
	{0x64, 0x6a},  // AEWGT5
	{0x65, 0xa9},  // AEWGT6
	{0x66, 0x6a},  // AEWGT7
	{0x67, 0xa9},  // AEWGT8
	{0x68, 0x6b},  // AEWGT9
	{0x69, 0xe9},  // AEWGT10
	{0x6a, 0x6a},  // AEWGT11
	{0x6b, 0xa9},  // AEWGT12
	{0x6c, 0x6a},  // AEWGT13
	{0x6d, 0xa9},  // AEWGT14
	{0x6e, 0x55},  // AEWGT15
	{0x6f, 0x55},  // AEWGT16

	{0x70, 0x70},  //6e
	{0x71, 0x00},  //82(+8)->+0


	{0x76, 0x43}, 
	{0x77, 0xe2},  //04
	{0x78, 0x23},  //Yth1
	{0x79, 0x42},  //Yth2
	{0x7a, 0x23},  //23
	{0x7b, 0x22},  //22
	{0x7d, 0x23}, 

	{0x83, 0x01},  //EXP Normal 33.33 fps 
	{0x84, 0xb7},  
	{0x85, 0x74},  

	{0x86, 0x01},  //EXPMin 5859.38 fps
	{0x87, 0xf4},  

	{0x88, 0x05},  //EXP Max 10.00 fps 
	{0x89, 0xb8},  
	{0x8a, 0xd8},  

	{0x8B, 0x49},  //EXP100 
	{0x8C, 0x3e},  
	{0x8D, 0x3c},  //EXP120 
	{0x8E, 0x8c},  
	{0x9c, 0x17},  //EXP Limit 488.28 fps 
	{0x9d, 0x70},  
	{0x9e, 0x01},  //EXP Unit 
	{0x9f, 0xf4},  

	//AE_Middle Time option
	//{0xa0, 0x03}, 
	//{0xa1, 0xa9}, 
	//{0xa2, 0x80}, 

	{0xb0, 0x18}, 
	{0xb1, 0x14},  //ADC 400->560
	{0xb2, 0xa0},  //d0
	{0xb3, 0x18}, 
	{0xb4, 0x1a}, 
	{0xb5, 0x44}, 
	{0xb6, 0x2f}, 
	{0xb7, 0x28}, 
	{0xb8, 0x25}, 
	{0xb9, 0x22}, 
	{0xba, 0x21}, 
	{0xbb, 0x20}, 
	{0xbc, 0x1f}, 
	{0xbd, 0x1f}, 

	//AE_Adaptive Time option
	//{0xc0, 0x10}, 
	//{0xc1, 0x2b}, 
	//{0xc2, 0x2b}, 
	//{0xc3, 0x2b}, 
	//{0xc4, 0x08}, 

	{0xc8, 0x80}, 
	{0xc9, 0x40}, 

	/////// PAGE 22 START ///////
	{0x03, 0x22}, 
	{0x10, 0xfd}, 
	{0x11, 0x2e}, 
	{0x19, 0x01},  // Low On //
	{0x20, 0x30}, 
	{0x21, 0x80}, 
	{0x24, 0x01}, 
	//{0x25, 0x00},  //7f New Lock Cond & New light stable

	{0x30, 0x80}, 
	{0x31, 0x80}, 
	{0x38, 0x11}, 
	{0x39, 0x34}, 

	{0x40, 0xf4}, 
	{0x41, 0x55},  //44
	{0x42, 0x33},  //43

	{0x43, 0xf6}, 
	{0x44, 0x55},  //44
	{0x45, 0x44},  //33

	{0x46, 0x00}, 
	{0x50, 0xb2}, 
	{0x51, 0x81}, 
	{0x52, 0x98}, 

	{0x80, 0x40},  //3e
	{0x81, 0x20}, 
	{0x82, 0x3e}, 

	{0x83, 0x5e},  //5e
	{0x84, 0x1e},  //24
	{0x85, 0x5e},  //54 //56 //5a
	{0x86, 0x22},  //24 //22

	{0x87, 0x49}, 
	{0x88, 0x39}, 
	{0x89, 0x37},  //38
	{0x8a, 0x28},  //2a

	{0x8b, 0x41},  //47
	{0x8c, 0x39},  
	{0x8d, 0x34},  
	{0x8e, 0x28},  //2c

	{0x8f, 0x53},  //4e
	{0x90, 0x52},  //4d
	{0x91, 0x51},  //4c
	{0x92, 0x4e},  //4a
	{0x93, 0x4a},  //46
	{0x94, 0x45}, 
	{0x95, 0x3d}, 
	{0x96, 0x31}, 
	{0x97, 0x28}, 
	{0x98, 0x24}, 
	{0x99, 0x20}, 
	{0x9a, 0x20}, 

	{0x9b, 0x77}, 
	{0x9c, 0x77}, 
	{0x9d, 0x48}, 
	{0x9e, 0x38}, 
	{0x9f, 0x30}, 

	{0xa0, 0x60}, 
	{0xa1, 0x34}, 
	{0xa2, 0x6f}, 
	{0xa3, 0xff}, 

	{0xa4, 0x14},  //1500fps
	{0xa5, 0x2c},  // 700fps
	{0xa6, 0xcf}, 

	{0xad, 0x40}, 
	{0xae, 0x4a}, 

	{0xaf, 0x28},   // low temp Rgain
	{0xb0, 0x26},   // low temp Rgain

	{0xb1, 0x00},  //0x20 -> 0x00 0405 modify
	{0xb4, 0xea}, 
	{0xb8, 0xa0},  //a2: b-2, R+2  //b4 B-3, R+4 lowtemp
	{0xb9, 0x00}, 

	/////// PAGE 20 ///////
	{0x03, 0x20}, 
	{0x10, 0x8c}, 

	// PAGE 20
	{0x03, 0x20},  //page 20
	{0x10, 0x9c},  //ae off

	// PAGE 22
	{0x03, 0x22},  //page 22
	{0x10, 0xe9},  //awb off

	// PAGE 0
	{0x03, 0x00}, 
	{0x0e, 0x03},  //PLL On
	{0x0e, 0x73},  //PLLx2

	{0x03, 0x00},  // Dummy 750us
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 

	/*640*480 */
	{0x03, 0x00},
	{0x10, 0x11},//
	{0x20, 0x00},
	{0x21, 0x07},
	{0x22, 0x00},
	{0x23, 0x20},
	{0x24, 0x03},
	{0x25, 0xc0},
	{0x26, 0x05},
	{0x27, 0x00},

	{0x03, 0x18},
	{0x10, 0x07},
	{0x11, 0x00},
	{0x12, 0x20},
	{0x20, 0x05},
	{0x21, 0x00},
	{0x22, 0x03},
	{0x23, 0xc0},
	{0x24, 0x00},
	{0x25, 0x04},
	{0x26, 0x00},
	{0x27, 0x04},
	{0x28, 0x05},
	{0x29, 0x04},
	{0x2a, 0x03},
	{0x2b, 0xc4},
	{0x2c, 0x0a},
	{0x2d, 0x00},
	{0x2e, 0x0a},
	{0x2f, 0x00},
	{0x30, 0x41}, //41->44

	{0x03, 0x00},  // Page 0
	{0x01, 0xf8},  // Sleep Off 0xf8->0x50 for solve green line issue	
};

static struct sensor_reg hi253_setting_30fps_VGA_640_480[] = {
	/*
	 * Only support 7.5fps for QXGA to workaround screen tearing issue
	 * for 15fps when capturing still image.
	 */
	{0x01, 0xf9},  //sleep on                         
	{0x08, 0x0f},  //Hi-Z on                         
	{0x01, 0xf8},   //sleep off                      
                                                       
	{0x03, 0x00},  // Dummy 750us START              
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},  // Dummy 750us END                
                                                       
	{0x0e, 0x03},  //PLL On                          
	{0x0e, 0x73},  //PLLx2                           
                                                       
	{0x03, 0x00},  // Dummy 750us START              
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},                                    
	{0x03, 0x00},  // Dummy 750us END                
                                                       
	{0x0e, 0x00},  //PLL off                         
	{0x01, 0xf1},  //sleep on                        
	{0x08, 0x00},  //Hi-Z off                        
                                                       
	{0x01, 0xf3},                                    
	{0x01, 0xf1},                                    
                                                       
	                                                     
	{0x03, 0x20},  //page 20                         
	{0x10, 0x1c},  //ae off                          
                                                       
                                                       
	{0x03, 0x22},  //page 22                         
	{0x10, 0x69},  //awb off                         
                                                       
                                                       
	                                                     
	                                                     
	{0x03, 0x00},                                    
	{0x10, 0x11},  // Sub1/2_Preview2 Mode_H binning 
	{0x11, 0x91},                                    
	{0x12, 0x20}, //21                               
                                                       
	{0x0b, 0xaa},  // ESD Check Register             
	{0x0c, 0xaa},  // ESD Check Register             
	{0x0d, 0xaa},  // ESD Check Register             
                                                       
	{0x20, 0x00},  // Windowing start point Y        
	{0x21, 0x04},                                    
	{0x22, 0x00},  // Windowing start point X        
	{0x23, 0x07},                                    
                                                       
	{0x24, 0x04},                                    
	{0x25, 0xb0},                                    
	{0x26, 0x06},                                    
	{0x27, 0x40},  // WINROW END                     
                                                       
	{0x40, 0x01},  //Hblank 408                      
	{0x41, 0x68},                                    
	{0x42, 0x00},  //Vblank 20                       
	{0x43, 0x14},                                    
                                                       
	{0x45, 0x04},                                    
	{0x46, 0x18},                                    
	{0x47, 0xd8},                                    
                                                       
                                                       
	{0x80, 0x2e},                                    
	{0x81, 0x7e},                                    
	{0x82, 0x90},                                    
	{0x83, 0x00},                                    
	{0x84, 0x0c},                                    
	{0x85, 0x00},                                    
	{0x90, 0x14},  //BLC_TIME_TH_ON                  
	{0x91, 0x14},  //BLC_TIME_TH_OFF                 
	{0x92, 0x98},  //BLC_AG_TH_ON                    
	{0x93, 0x90},  //BLC_AG_TH_OFF                   
	{0x94, 0x75},                                    
	{0x95, 0x70},                                    
	{0x96, 0xdc},                                    
	{0x97, 0xfe},                                    
	{0x98, 0x38},                                    
                                                       
                                                       
	{0x99, 0x43},                                    
	{0x9a, 0x43},                                    
	{0x9b, 0x43},                                    
	{0x9c, 0x43},                                    
                                                       
                                                       
	{0xa0, 0x00},                                    
	{0xa2, 0x00},                                    
	{0xa4, 0x00},                                    
	{0xa6, 0x00},                                    
                                                       
                                                       
	{0xa8, 0x43},                                    
	{0xaa, 0x43},                                    
	{0xac, 0x43},                                    
	{0xae, 0x43},                                    
                                                       
                                                       
	{0x03, 0x02},                                    
	{0x12, 0x03},                                    
	{0x13, 0x03},                                    
	{0x16, 0x00},                                    
	{0x17, 0x8C},                                    
	{0x18, 0x4c},  //Double_AG off                   
	{0x19, 0x00},                                    
	{0x1a, 0x39},  //ADC400->560                     
	{0x1c, 0x09},                                    
	{0x1d, 0x40},                                    
	{0x1e, 0x30},                                    
	{0x1f, 0x10},                                    
                                                       
	{0x20, 0x77},                                    
	{0x21, 0xde},                                    
	{0x22, 0xa7},                                    
	{0x23, 0x30},  //CLAMP                           
	{0x27, 0x3c},                                    
	{0x2b, 0x80},                                    
	{0x2e, 0x11},                                    
	{0x2f, 0xa1},                                    
	{0x30, 0x05},  //For Hi-253 never no change 0x05 
                                                       
	{0x50, 0x20},                                    
	{0x52, 0x01},                                    
	{0x55, 0x1c},                                    
	{0x56, 0x11},                                    
	{0x5d, 0xa2},                                    
	{0x5e, 0x5a},                                    
                                                       
	{0x60, 0x87},                                    
	{0x61, 0x99},                                    
	{0x62, 0x88},                                    
	{0x63, 0x97},                                    
	{0x64, 0x88},                                    
	{0x65, 0x97},                                    
                                                       
	{0x67, 0x0c},                                    
	{0x68, 0x0c},                                    
	{0x69, 0x0c},                                    
                                                       
	{0x72, 0x89},                                    
	{0x73, 0x96},                                    
	{0x74, 0x89},                                    
	{0x75, 0x96},                                    
	{0x76, 0x89},                                    
	{0x77, 0x96},                                    
                                                       
	{0x7c, 0x85},                                    
	{0x7d, 0xaf},                                    
	{0x80, 0x01},                                    
	{0x81, 0x7f},                                    
	{0x82, 0x13},                                    
                                                       
	{0x83, 0x24},                                    
	{0x84, 0x7d},                                    
	{0x85, 0x81},                                    
	{0x86, 0x7d},                                    
	{0x87, 0x81},                                    
                                                       
	{0x92, 0x48},                                    
	{0x93, 0x54},                                    
	{0x94, 0x7d},                                    
	{0x95, 0x81},                                    
	{0x96, 0x7d},                                    
	{0x97, 0x81},                                    
                                                       
	{0xa0, 0x02},                                    
	{0xa1, 0x7b},                                    
	{0xa2, 0x02},                                    
	{0xa3, 0x7b},                                    
	{0xa4, 0x7b},                                    
	{0xa5, 0x02},                                    
	{0xa6, 0x7b},                                    
	{0xa7, 0x02},                                    
                                                       
	{0xa8, 0x85},                                    
	{0xa9, 0x8c},                                    
	{0xaa, 0x85},                                    
	{0xab, 0x8c},                                    
	{0xac, 0x10},                                    
	{0xad, 0x16},                                    
	{0xae, 0x10},                                    
	{0xaf, 0x16},                                    
                                                       
	{0xb0, 0x99},                                    
	{0xb1, 0xa3},                                    
	{0xb2, 0xa4},                                    
	{0xb3, 0xae},                                    
	{0xb4, 0x9b},                                    
	{0xb5, 0xa2},                                    
	{0xb6, 0xa6},                                    
	{0xb7, 0xac},                                    
	{0xb8, 0x9b},                                    
	{0xb9, 0x9f},                                    
	{0xba, 0xa6},                                    
	{0xbb, 0xaa},                                    
	{0xbc, 0x9b},                                    
	{0xbd, 0x9f},                                    
	{0xbe, 0xa6},                                    
	{0xbf, 0xaa},                                    
                                                       
	{0xc4, 0x2c},                                    
	{0xc5, 0x43},                                    
	{0xc6, 0x63},                                    
	{0xc7, 0x79},                                    
                                                       
	{0xc8, 0x2d},                                    
	{0xc9, 0x42},                                    
	{0xca, 0x2d},                                    
	{0xcb, 0x42},                                    
	{0xcc, 0x64},                                    
	{0xcd, 0x78},                                    
	{0xce, 0x64},                                    
	{0xcf, 0x78},                                    
                                                       
	{0xd0, 0x0a},                                    
	{0xd1, 0x09},                                    
	{0xd4, 0x14},  //DCDC_TIME_TH_ON                 
	{0xd5, 0x14},  //DCDC_TIME_TH_OFF                
	{0xd6, 0x98},  //DCDC_AG_TH_ON                   
	{0xd7, 0x90},  //DCDC_AG_TH_OFF                  
	{0xe0, 0xc4},                                    
	{0xe1, 0xc4},                                    
	{0xe2, 0xc4},                                    
	{0xe3, 0xc4},                                    
	{0xe4, 0x00},                                    
	{0xe8, 0x80},                                    
	{0xe9, 0x40},                                    
	{0xea, 0x7f},                                    
                                                       
                                                       
	{0x03, 0x03},                                    
	{0x10, 0x10},                                    
                                                       
                                                       
	{0x03, 0x10},                                    
	{0x10, 0x01},  // CrYCbY // For Demoset 0x03     
	{0x12, 0x30},                                    
	{0x13, 0x0a},  // contrast on                    
	{0x20, 0x00},                                    
                                                       
	{0x30, 0x00},                                    
	{0x31, 0x00},                                    
	{0x32, 0x00},                                    
	{0x33, 0x00},                                    
                                                       
	{0x34, 0x30},                                    
	{0x35, 0x00},                                    
	{0x36, 0x00},                                    
	{0x38, 0x00},                                    
	{0x3e, 0x58},                                    
	{0x3f, 0x00},                                    
                                                       
	{0x40, 0x80},  // YOFS                           
	{0x41, 0x10},  // DYOFS                          
	{0x48, 0x84},  // Contrast                       
	{0x50, 0x90},  // Contrast                       
                                                       
	{0x60, 0x6c}, //67                               
	{0x61, 0x70},  //7e //8e //88 //80               
	{0x62, 0x68},  //7e //8e //88 //80               
	{0x63, 0x50},  //Double_AG 50->30                
	{0x64, 0x41},                                    
                                                       
	{0x66, 0x42},                                    
	{0x67, 0x20},                                    
                                                       
	{0x6a, 0x80},  //8a                              
	{0x6b, 0x84},  //74                              
	{0x6c, 0x80},  //7e //7a                         
	{0x6d, 0x80},  //8e                              
          
                                                       
	{0x03, 0x11},                                    
	{0x10, 0x7f},                                    
	{0x11, 0x40},                                    
	{0x12, 0x0a},  /* Blue Max-Filter Delete*/       
	{0x13, 0xbb},                                    
                                                       
	{0x26, 0x31},  /* Double_AG 31->20*/             
	{0x27, 0x34},  /* Double_AG 34->22*/             
	{0x28, 0x0f},                                    
	{0x29, 0x10},                                    
	{0x2b, 0x30},                                    
	{0x2c, 0x32},                                    
                                                       
                                                       
	{0x30, 0x70},                                    
	{0x31, 0x10},                                    
	{0x32, 0x58},                                    
	{0x33, 0x09},                                    
	{0x34, 0x06},                                    
	{0x35, 0x03},                                    
                                                       
                                                       
	{0x36, 0x70},                                    
	{0x37, 0x18},                                    
	{0x38, 0x58},                                    
	{0x39, 0x09},                                    
	{0x3a, 0x06},                                    
	{0x3b, 0x03},                                    
                                                       
                                                       
	{0x3c, 0x80},                                    
	{0x3d, 0x18},                                    
	{0x3e, 0x83},  /*80*/                            
	{0x3f, 0x0c},                                    
	{0x40, 0x03},                                    
	{0x41, 0x06},                                    
                                                       
	{0x42, 0x80},                                    
	{0x43, 0x18},                                    
	{0x44, 0x83},  /*80*/                            
	{0x45, 0x12},                                    
	{0x46, 0x10},                                    
	{0x47, 0x10},                                    
                                                       
	{0x48, 0x90},                                    
	{0x49, 0x40},                                    
	{0x4a, 0x80},                                    
	{0x4b, 0x13},                                    
	{0x4c, 0x10},                                    
	{0x4d, 0x11},                                    
                                                       
	{0x4e, 0x80},                                    
	{0x4f, 0x30},                                    
	{0x50, 0x80},                                    
	{0x51, 0x13},                                    
	{0x52, 0x10},                                    
	{0x53, 0x13},                                    
                                                       
	{0x54, 0x11},                                    
	{0x55, 0x17},                                    
	{0x56, 0x20},                                    
	{0x57, 0x01},                                    
	{0x58, 0x00},                                    
	{0x59, 0x00},                                    
                                                       
	{0x5a, 0x1f},  /*18*/                            
	{0x5b, 0x00},                                    
	{0x5c, 0x00},                                    
                                                       
	{0x60, 0x3f},                                    
	{0x62, 0x60},                                    
	{0x70, 0x06},                                    
                                                       
                                                       
	{0x03, 0x12},                                    
	{0x20, 0x00},                                    
	{0x21, 0x00},                                    
                                                       
	{0x25, 0x00},                                    
                                                       
	{0x28, 0x00},                                    
	{0x29, 0x00},                                    
	{0x2a, 0x00},                                    
                                                       
	{0x30, 0x50},                                    
	{0x31, 0x18},                                    
	{0x32, 0x32},                                    
	{0x33, 0x40},                                    
	{0x34, 0x50},                                    
	{0x35, 0x70},                                    
	{0x36, 0xa0},                                    
                                                       
                                                       
	{0x40, 0xa0},                                    
	{0x41, 0x40},                                    
	{0x42, 0xa0},                                    
	{0x43, 0x90},                                    
	{0x44, 0x90},                                    
	{0x45, 0x80},                                    
                                                       
	                                                     
	{0x46, 0xb0},                                    
	{0x47, 0x55},                                    
	{0x48, 0xa0},                                    
	{0x49, 0x90},                                    
	{0x4a, 0x90},                                    
	{0x4b, 0x80},                                    
                                                       
                                                       
	{0x4c, 0xb0},                                    
	{0x4d, 0x40},                                    
	{0x4e, 0x90},                                    
	{0x4f, 0x90},                                    
	{0x50, 0xa0},                                    
	{0x51, 0x60},                                    
                                                       
	                                                     
	{0x52, 0xb0},                                    
	{0x53, 0x60},                                    
	{0x54, 0xc0},                                    
	{0x55, 0xc0},                                    
	{0x56, 0x80},                                    
	{0x57, 0x57},                                    
                                                       
                                                       
	{0x58, 0x90},                                    
	{0x59, 0x40},                                    
	{0x5a, 0xd0},                                    
	{0x5b, 0xd0},                                    
	{0x5c, 0xe0},                                    
	{0x5d, 0x80},                                    
                                                       
                                                       
	{0x5e, 0x88},                                    
	{0x5f, 0x40},                                    
	{0x60, 0xe0},                                    
	{0x61, 0xe0},                                    
	{0x62, 0xe0},                                    
	{0x63, 0x80},                                    
                                                       
	{0x70, 0x15},                                    
	{0x71, 0x01},  /*Don't Touch register*/          
                                                       
	{0x72, 0x18},                                    
	{0x73, 0x01},  /*Don't Touch register*/          
                                                       
	{0x74, 0x25},                                    
	{0x75, 0x15},                                    
                                                       
	{0x80, 0x20},                                    
	{0x81, 0x40},                                    
	{0x82, 0x65},                                    
	{0x85, 0x1a},                                    
	{0x88, 0x00},                                    
	{0x89, 0x00},                                    
	{0x90, 0x5d},  /*For Preview*/                   
                                                       
/*Dont Touch register*/                                
	{0xD0, 0x0c},                                    
	{0xD1, 0x80},                                    
	{0xD2, 0x67},                                    
	{0xD3, 0x00},                                    
	{0xD4, 0x00},                                    
	{0xD5, 0x02},                                    
	{0xD6, 0xff},                                    
	{0xD7, 0x18},                                    
                                                       
	{0x3b, 0x06},                                    
	{0x3c, 0x06},                                    
                                                       
	{0xc5, 0x00}, /*55->48*/                         
	{0xc6, 0x00}, /*48->40*/                         
                                                       
                                                       
	{0x03, 0x13},                                    
                                                       
	{0x10, 0xcb},                                    
	{0x11, 0x7b},                                    
	{0x12, 0x07},                                    
	{0x14, 0x00},                                    
                                                       
	{0x20, 0x15},                                    
	{0x21, 0x13},                                    
	{0x22, 0x33},                                    
	{0x23, 0x05},                                    
	{0x24, 0x09},                                    
                                                       
	{0x25, 0x0a},                                    
                                                       
	{0x26, 0x18},                                    
	{0x27, 0x30},                                    
	{0x29, 0x12},                                    
	{0x2a, 0x50},                                    
                                                       
                                                       
	{0x2b, 0x02},                                    
	{0x2c, 0x02},                                    
	{0x25, 0x06},                                    
	{0x2d, 0x0c},                                    
	{0x2e, 0x12},                                    
	{0x2f, 0x12},                                    
                                                       
                                                       
	{0x50, 0x10},                                    
	{0x51, 0x14},                                    
	{0x52, 0x12},                                    
	{0x53, 0x0c},                                    
	{0x54, 0x0f},                                    
	{0x55, 0x0c},                                    
                                                       
                                                       
	{0x56, 0x10},                                    
	{0x57, 0x13},                                    
	{0x58, 0x12},                                    
	{0x59, 0x0c},                                    
	{0x5a, 0x0f},                                    
	{0x5b, 0x0c},                                    
                                                       
                                                       
	{0x5c, 0x0a},                                    
	{0x5d, 0x0b},                                    
	{0x5e, 0x0a},                                    
	{0x5f, 0x08},                                    
	{0x60, 0x09},                                    
	{0x61, 0x08},                                    
                                                       
                                                       
	{0x62, 0x08},                                    
	{0x63, 0x08},                                    
	{0x64, 0x08},                                    
	{0x65, 0x06},                                    
	{0x66, 0x06},                                    
	{0x67, 0x06},                                    
                                                       
                                                       
	{0x68, 0x07},                                    
	{0x69, 0x07},                                    
	{0x6a, 0x07},                                    
	{0x6b, 0x05},                                    
	{0x6c, 0x05},                                    
	{0x6d, 0x05},                                    
                                                       
                                                       
	{0x6e, 0x07},                                    
	{0x6f, 0x07},                                    
	{0x70, 0x07},                                    
	{0x71, 0x05},                                    
	{0x72, 0x05},                                    
	{0x73, 0x05},                                    
                                                       
                                                       
	                                                     
	{0x80, 0xfd},                                    
	{0x81, 0x1f},                                    
	{0x82, 0x05},                                    
	{0x83, 0x31},                                    
                                                       
	{0x90, 0x05},                                    
	{0x91, 0x05},                                    
	{0x92, 0x33},                                    
	{0x93, 0x30},                                    
	{0x94, 0x03},                                    
	{0x95, 0x14},                                    
	{0x97, 0x20},                                    
	{0x99, 0x20},                                    
                                                       
	{0xa0, 0x01},                                    
	{0xa1, 0x02},                                    
	{0xa2, 0x01},                                    
	{0xa3, 0x02},                                    
	{0xa4, 0x05},                                    
	{0xa5, 0x05},                                    
	{0xa6, 0x07},                                    
	{0xa7, 0x08},                                    
	{0xa8, 0x07},                                    
	{0xa9, 0x08},                                    
	{0xaa, 0x07},                                    
	{0xab, 0x08},                                    
                                                       
                                                       
	{0xb0, 0x22},                                    
	{0xb1, 0x2a},                                    
	{0xb2, 0x28},                                    
	{0xb3, 0x22},                                    
	{0xb4, 0x2a},                                    
	{0xb5, 0x28},                                    
                                                       
                                                       
	{0xb6, 0x22},                                    
	{0xb7, 0x2a},                                    
	{0xb8, 0x28},                                    
	{0xb9, 0x22},                                    
	{0xba, 0x2a},                                    
	{0xbb, 0x28},                                    
                                                       
                                                       
	{0xbc, 0x25},                                    
	{0xbd, 0x2a},                                    
	{0xbe, 0x27},                                    
	{0xbf, 0x25},                                    
	{0xc0, 0x2a},                                    
	{0xc1, 0x27},                                    
                                                       
	                                                     
	{0xc2, 0x1e},                                    
	{0xc3, 0x24},                                    
	{0xc4, 0x20},                                    
	{0xc5, 0x1e},                                    
	{0xc6, 0x24},                                    
	{0xc7, 0x20},                                    
                                                       
	                                                     
	{0xc8, 0x18},                                    
	{0xc9, 0x20},                                    
	{0xca, 0x1e},                                    
	{0xcb, 0x18},                                    
	{0xcc, 0x20},                                    
	{0xcd, 0x1e},                                    
                                                       
                                                       
	{0xce, 0x18},                                    
	{0xcf, 0x20},                                    
	{0xd0, 0x1e},                                    
	{0xd1, 0x18},                                    
	{0xd2, 0x20},                                    
	{0xd3, 0x1e},                                    
                                                       
                                                       
	{0x03, 0x14},                                    
	{0x10, 0x11},                                    
                                                       
	{0x14, 0x80},  // GX                             
	{0x15, 0x80},  // GY                             
	{0x16, 0x80},  // RX                             
	{0x17, 0x80},  // RY                             
	{0x18, 0x80},  // BX                             
	{0x19, 0x80},  // BY                             
                                                       
	{0x20, 0x60},  //X 60 //a0                       
	{0x21, 0x80},  //Y                               
                                                       
	{0x22, 0x80},                                    
	{0x23, 0x80},                                    
	{0x24, 0x80},                                    
                                                       
	{0x30, 0xc8},                                    
	{0x31, 0x2b},                                    
	{0x32, 0x00},                                    
	{0x33, 0x00},                                    
	{0x34, 0x90},                                    
                                                       
	{0x40, 0x48},  //31                              
	{0x50, 0x34},  //23 //32                         
	{0x60, 0x29},  //                                
	{0x70, 0x34},  //23 //32                         
                                                       
                                                       
	{0x03, 0x15},                                    
	{0x10, 0x0f},                                    
                                                       
	                                                     
	                                                     
	{0x14, 0x42},  //CMCOFSGH_Day //4c               
	{0x15, 0x32},  //CMCOFSGM_CWF //3c               
	{0x16, 0x24},  //CMCOFSGL_A //2e                 
	{0x17, 0x2f},  //CMC SIGN                        
                                                       
                                                       
	{0x30, 0x8f},                                    
	{0x31, 0x59},                                    
	{0x32, 0x0a},                                    
	{0x33, 0x15},                                    
	{0x34, 0x5b},                                    
	{0x35, 0x06},                                    
	{0x36, 0x07},                                    
	{0x37, 0x40},                                    
	{0x38, 0x87},  //86                              
                                                       
	                                                     
	{0x40, 0x92},                                    
	{0x41, 0x1b},                                    
	{0x42, 0x89},                                    
	{0x43, 0x81},                                    
	{0x44, 0x00},                                    
	{0x45, 0x01},                                    
	{0x46, 0x89},                                    
	{0x47, 0x9e},                                    
	{0x48, 0x28},                                    
              
                                                       
	{0x50, 0x02},                                    
	{0x51, 0x82},                                    
	{0x52, 0x00},                                    
	{0x53, 0x07},                                    
	{0x54, 0x11},                                    
	{0x55, 0x98},                                    
	{0x56, 0x00},                                    
	{0x57, 0x0b},                                    
	{0x58, 0x8b},                                    
                                                       
	{0x80, 0x03},                                    
	{0x85, 0x40},                                    
	{0x87, 0x02},                                    
	{0x88, 0x00},                                    
	{0x89, 0x00},                                    
	{0x8a, 0x00},                                    
                                                       
                                                       
	{0x03, 0x16},                                    
	{0x10, 0x31},                                    
	{0x18, 0x5e}, // Double_AG 5e->37                
	{0x19, 0x5d}, // Double_AG 5e->36                
	{0x1a, 0x0e},                                    
	{0x1b, 0x01},                                    
	{0x1c, 0xdc},                                    
	{0x1d, 0xfe},                                    
                                                       
                                                       
	{0x30, 0x00},                                    
	{0x31, 0x0a},                                    
	{0x32, 0x1f},                                    
	{0x33, 0x33},                                    
	{0x34, 0x53},                                    
	{0x35, 0x6c},                                    
	{0x36, 0x81},                                    
	{0x37, 0x94},                                    
	{0x38, 0xa4},                                    
	{0x39, 0xb3},                                    
	{0x3a, 0xc0},                                    
	{0x3b, 0xcb},                                    
	{0x3c, 0xd5},                                    
	{0x3d, 0xde},                                    
	{0x3e, 0xe6},                                    
	{0x3f, 0xee},                                    
	{0x40, 0xf5},                                    
	{0x41, 0xfc},                                    
	{0x42, 0xff},                                    
                                                       
	{0x50, 0x00},                                    
	{0x51, 0x09},                                    
	{0x52, 0x1f},                                    
	{0x53, 0x37},                                    
	{0x54, 0x5b},                                    
	{0x55, 0x76},                                    
	{0x56, 0x8d},                                    
	{0x57, 0xa1},                                    
	{0x58, 0xb2},                                    
	{0x59, 0xbe},                                    
	{0x5a, 0xc9},                                    
	{0x5b, 0xd2},                                    
	{0x5c, 0xdb},                                    
	{0x5d, 0xe3},                                    
	{0x5e, 0xeb},                                    
	{0x5f, 0xf0},                                    
	{0x60, 0xf5},                                    
	{0x61, 0xf7},                                    
	{0x62, 0xf8},                                    
                                                       
	{0x70, 0x00},                                    
	{0x71, 0x08},                                    
	{0x72, 0x17},                                    
	{0x73, 0x2f},                                    
	{0x74, 0x53},                                    
	{0x75, 0x6c},                                    
	{0x76, 0x81},                                    
	{0x77, 0x94},                                    
	{0x78, 0xa4},                                    
	{0x79, 0xb3},                                    
	{0x7a, 0xc0},                                    
	{0x7b, 0xcb},                                    
	{0x7c, 0xd5},                                    
	{0x7d, 0xde},                                    
	{0x7e, 0xe6},                                    
	{0x7f, 0xee},                                    
	{0x80, 0xf4},                                    
	{0x81, 0xfa},                                    
	{0x82, 0xff},                                    
                                                       
                                                       
	{0x03, 0x17},                                    
	{0x10, 0xf7},                                    
                                                       
	{0x03, 0x18},                                    
	{0x12, 0x20},                                    
	{0x10, 0x07},                                    
	{0x11, 0x00},                                    
	{0x20, 0x05},                                    
	{0x21, 0x20},                                    
	{0x22, 0x03},                                    
	{0x23, 0xd8},                                    
	{0x24, 0x00},                                    
	{0x25, 0x10},                                    
	{0x26, 0x00},                                    
	{0x27, 0x0c},                                    
	{0x28, 0x05},                                    
	{0x29, 0x10},                                    
	{0x2a, 0x03},                                    
	{0x2b, 0xcc},                                    
	{0x2c, 0x09},                                    
	{0x2d, 0xc1},                                    
	{0x2e, 0x09},                                    
	{0x2f, 0xc1},                                    
	{0x30, 0x41},                                    
                                                       
                                                       
	{0x03, 0x20},                                    
	{0x11, 0x1c},                                    
	{0x18, 0x30},                                    
	{0x1a, 0x08},                                    
	{0x20, 0x01},  //05_lowtemp Y Mean off           
	{0x21, 0x30},                                    
	{0x22, 0x10},                                    
	{0x23, 0x00},                                    
	{0x24, 0x00},  //Uniform Scene Off               
                                                       
	{0x28, 0xe7},                                    
	{0x29, 0x0d},  //20100305 ad->0d                 
	{0x2a, 0xff},                                    
	{0x2b, 0x04},  //f4->Adaptive off                
                                                       
	{0x2c, 0xc2},                                    
	{0x2d, 0xcf},   //ff->AE Speed option            
	{0x2e, 0x33},                                    
	{0x30, 0x78},  //f8                              
	{0x32, 0x03},                                    
	{0x33, 0x2e},                                    
	{0x34, 0x30},                                    
	{0x35, 0xd4},                                    
	{0x36, 0xfe},                                    
	{0x37, 0x32},                                    
	{0x38, 0x04},                                    
                                                       
	{0x39, 0x22},  //AE_escapeC10                    
	{0x3a, 0xde},  //AE_escapeC11                    
                                                       
	{0x3b, 0x22},  //AE_escapeC1                     
	{0x3c, 0xde},  //AE_escapeC2                     
                                                       
	{0x50, 0x45},                                    
	{0x51, 0x88},                                    
                                                       
	{0x56, 0x03},                                    
	{0x57, 0xf7},                                    
	{0x58, 0x14},                                    
	{0x59, 0x88},                                    
	{0x5a, 0x04}, 

	{0x60, 0x55},  // AEWGT1
	{0x61, 0x55},  // AEWGT2
	{0x62, 0x6a},  // AEWGT3
	{0x63, 0xa9},  // AEWGT4
	{0x64, 0x6a},  // AEWGT5
	{0x65, 0xa9},  // AEWGT6
	{0x66, 0x6a},  // AEWGT7
	{0x67, 0xa9},  // AEWGT8
	{0x68, 0x6b},  // AEWGT9
	{0x69, 0xe9},  // AEWGT10
	{0x6a, 0x6a},  // AEWGT11
	{0x6b, 0xa9},  // AEWGT12
	{0x6c, 0x6a},  // AEWGT13
	{0x6d, 0xa9},  // AEWGT14
	{0x6e, 0x55},  // AEWGT15
	{0x6f, 0x55},  // AEWGT16

	{0x70, 0x70},  //6e
	{0x71, 0x00},  //82(+8)->+0


	{0x76, 0x43}, 
	{0x77, 0xe2},  //04
	{0x78, 0x23},  //Yth1
	{0x79, 0x42},  //Yth2
	{0x7a, 0x23},  //23
	{0x7b, 0x22},  //22
	{0x7d, 0x23}, 

	{0x83, 0x01},  //EXP Normal 33.33 fps 
	{0x84, 0xb7},  
	{0x85, 0x74},  

	{0x86, 0x01},  //EXPMin 5859.38 fps
	{0x87, 0xf4},  

	{0x88, 0x05},  //EXP Max 10.00 fps 
	{0x89, 0xb8},  
	{0x8a, 0xd8},  

	{0x8B, 0x49},  //EXP100 
	{0x8C, 0x3e},  
	{0x8D, 0x3c},  //EXP120 
	{0x8E, 0x8c},  
	{0x9c, 0x17},  //EXP Limit 488.28 fps 
	{0x9d, 0x70},  
	{0x9e, 0x01},  //EXP Unit 
	{0x9f, 0xf4},  

	//AE_Middle Time option
	//{0xa0, 0x03}, 
	//{0xa1, 0xa9}, 
	//{0xa2, 0x80}, 

	{0xb0, 0x18}, 
	{0xb1, 0x14},  //ADC 400->560
	{0xb2, 0xa0},  //d0
	{0xb3, 0x18}, 
	{0xb4, 0x1a}, 
	{0xb5, 0x44}, 
	{0xb6, 0x2f}, 
	{0xb7, 0x28}, 
	{0xb8, 0x25}, 
	{0xb9, 0x22}, 
	{0xba, 0x21}, 
	{0xbb, 0x20}, 
	{0xbc, 0x1f}, 
	{0xbd, 0x1f}, 

	//AE_Adaptive Time option
	//{0xc0, 0x10}, 
	//{0xc1, 0x2b}, 
	//{0xc2, 0x2b}, 
	//{0xc3, 0x2b}, 
	//{0xc4, 0x08}, 

	{0xc8, 0x80}, 
	{0xc9, 0x40}, 

	/////// PAGE 22 START ///////
	{0x03, 0x22}, 
	{0x10, 0xfd}, 
	{0x11, 0x2e}, 
	{0x19, 0x01},  // Low On //
	{0x20, 0x30}, 
	{0x21, 0x80}, 
	{0x24, 0x01}, 
	//{0x25, 0x00},  //7f New Lock Cond & New light stable

	{0x30, 0x80}, 
	{0x31, 0x80}, 
	{0x38, 0x11}, 
	{0x39, 0x34}, 

	{0x40, 0xf4}, 
	{0x41, 0x55},  //44
	{0x42, 0x33},  //43

	{0x43, 0xf6}, 
	{0x44, 0x55},  //44
	{0x45, 0x44},  //33

	{0x46, 0x00}, 
	{0x50, 0xb2}, 
	{0x51, 0x81}, 
	{0x52, 0x98}, 

	{0x80, 0x40},  //3e
	{0x81, 0x20}, 
	{0x82, 0x3e}, 

	{0x83, 0x5e},  //5e
	{0x84, 0x1e},  //24
	{0x85, 0x5e},  //54 //56 //5a
	{0x86, 0x22},  //24 //22

	{0x87, 0x49}, 
	{0x88, 0x39}, 
	{0x89, 0x37},  //38
	{0x8a, 0x28},  //2a

	{0x8b, 0x41},  //47
	{0x8c, 0x39},  
	{0x8d, 0x34},  
	{0x8e, 0x28},  //2c

	{0x8f, 0x53},  //4e
	{0x90, 0x52},  //4d
	{0x91, 0x51},  //4c
	{0x92, 0x4e},  //4a
	{0x93, 0x4a},  //46
	{0x94, 0x45}, 
	{0x95, 0x3d}, 
	{0x96, 0x31}, 
	{0x97, 0x28}, 
	{0x98, 0x24}, 
	{0x99, 0x20}, 
	{0x9a, 0x20}, 

	{0x9b, 0x77}, 
	{0x9c, 0x77}, 
	{0x9d, 0x48}, 
	{0x9e, 0x38}, 
	{0x9f, 0x30}, 

	{0xa0, 0x60}, 
	{0xa1, 0x34}, 
	{0xa2, 0x6f}, 
	{0xa3, 0xff}, 

	{0xa4, 0x14},  //1500fps
	{0xa5, 0x2c},  // 700fps
	{0xa6, 0xcf}, 

	{0xad, 0x40}, 
	{0xae, 0x4a}, 

	{0xaf, 0x28},   // low temp Rgain
	{0xb0, 0x26},   // low temp Rgain

	{0xb1, 0x00},  //0x20 -> 0x00 0405 modify
	{0xb4, 0xea}, 
	{0xb8, 0xa0},  //a2: b-2, R+2  //b4 B-3, R+4 lowtemp
	{0xb9, 0x00}, 

	/////// PAGE 20 ///////
	{0x03, 0x20}, 
	{0x10, 0x8c}, 

	// PAGE 20
	{0x03, 0x20},  //page 20
	{0x10, 0x9c},  //ae off

	// PAGE 22
	{0x03, 0x22},  //page 22
	{0x10, 0xe9},  //awb off

	// PAGE 0
	{0x03, 0x00}, 
	{0x0e, 0x03},  //PLL On
	{0x0e, 0x73},  //PLLx2

	{0x03, 0x00},  // Dummy 750us
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 
	{0x03, 0x00}, 

	/*640*480 */
	{0x03, 0x00},
	{0x10, 0x11},//
	{0x20, 0x00},
	{0x21, 0x07},
	{0x22, 0x00},
	{0x23, 0x20},
	{0x24, 0x03},
	{0x25, 0xc0},
	{0x26, 0x05},
	{0x27, 0x00},

	{0x03, 0x18},
	{0x10, 0x07},
	{0x11, 0x00},
	{0x12, 0x20},
	{0x20, 0x05},
	{0x21, 0x00},
	{0x22, 0x03},
	{0x23, 0xc0},
	{0x24, 0x00},
	{0x25, 0x04},
	{0x26, 0x00},
	{0x27, 0x04},
	{0x28, 0x05},
	{0x29, 0x04},
	{0x2a, 0x03},
	{0x2b, 0xc4},
	{0x2c, 0x0a},
	{0x2d, 0x00},
	{0x2e, 0x0a},
	{0x2f, 0x00},
	{0x30, 0x41}, //41->44

	{0x03, 0x00},  // Page 0
	{0x01, 0xf8},  // Sleep Off 0xf8->0x50 for solve green line issue	
};

static struct sensor_reg hi253_setting_15fps_QVGA_320_240[] = {
	{0x86, 0x03}, 
};

static struct sensor_reg hi253_setting_30fps_QVGA_320_240[] = {
	{0x12, 0x80},

};

static struct sensor_reg hi253_setting_15fps_NTSC_720_480[] = {
	{0x12, 0x80},

};

static struct sensor_reg hi253_setting_15fps_PAL_720_576[] = {
	{0x12, 0x80}, 	
};

static struct sensor_reg hi253_setting_30fps_NTSC_720_480[] = {
	{0x12, 0x80}, 
	
};

static struct sensor_reg hi253_setting_30fps_PAL_720_576[] = {
	{0x12, 0x80}, 
	
};

static struct hi253_mode_info hi253_mode_info_data[2][hi253_mode_MAX + 1] = {
	{

		{hi253_mode_VGA_640_480,    640,  480,
		hi253_setting_15fps_VGA_640_480,
		ARRAY_SIZE(hi253_setting_15fps_VGA_640_480)},	
		{hi253_mode_QVGA_320_240,   320,  240,
		hi253_setting_15fps_QVGA_320_240,
		ARRAY_SIZE(hi253_setting_15fps_QVGA_320_240)},
		{hi253_mode_XGA_1024_768,   1024, 768,
		hi253_setting_15fps_XGA_1024_768,
		ARRAY_SIZE(hi253_setting_15fps_XGA_1024_768)},
		{hi253_mode_QXGA_1600_1200, 1600, 1200,
		hi253_setting_15fps_QXGA_1600_1200,
		ARRAY_SIZE(hi253_setting_15fps_QXGA_1600_1200)},			
		{hi253_mode_NTSC_720_480,   720, 480,
		hi253_setting_15fps_NTSC_720_480,
		ARRAY_SIZE(hi253_setting_15fps_NTSC_720_480)},
		{hi253_mode_PAL_720_576,    720, 576,
		hi253_setting_15fps_PAL_720_576,
		ARRAY_SIZE(hi253_setting_15fps_PAL_720_576)},
	},
	{
		{hi253_mode_VGA_640_480,    640,  480,
		hi253_setting_30fps_VGA_640_480,
		ARRAY_SIZE(hi253_setting_30fps_VGA_640_480)},
		{hi253_mode_QVGA_320_240,   320,  240,
		hi253_setting_30fps_QVGA_320_240,
		ARRAY_SIZE(hi253_setting_30fps_QVGA_320_240)},
		{hi253_mode_XGA_1024_768,   1024, 768,
		hi253_setting_30fps_XGA_1024_768,
		ARRAY_SIZE(hi253_setting_30fps_XGA_1024_768)},
		{hi253_mode_QXGA_1600_1200, 0, 0, NULL, 0},
		{hi253_mode_NTSC_720_480,   720, 480,
		hi253_setting_30fps_NTSC_720_480,
		ARRAY_SIZE(hi253_setting_30fps_NTSC_720_480)},
		{hi253_mode_PAL_720_576,    720, 576,
		hi253_setting_30fps_PAL_720_576,
		ARRAY_SIZE(hi253_setting_30fps_PAL_720_576)},
	},
};


static struct sensor_reg sensor_initialize[] = {

	/////// Start Sleep ///////
	{0x01, 0xf9}, //sleep on
	{0x08, 0x0f}, //Hi-Z on
	{0x01, 0xf8}, //sleep off

	{0x03, 0x00}, // Dummy 750us START
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00}, // Dummy 750us END

	{0x0e, 0x03}, //PLL On
	{0x0e, 0x73}, //PLLx2

	{0x03, 0x00}, // Dummy 750us START
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00}, // Dummy 750us END

	{0x0e, 0x00}, //PLL off
	{0x01, 0xf1}, //sleep on
	{0x08, 0x00}, //Hi-Z off

	{0x01, 0xf3},
	{0x01, 0xf1},

	// PAGE 20
	{0x03, 0x20}, //page 20
	{0x10, 0x1c}, //ae off

	// PAGE 22
	{0x03, 0x22}, //page 22
	{0x10, 0x69}, //awb off


	//Initial Start
	/////// PAGE 0 START ///////
	{0x03, 0x00},
	{0x10, 0x11}, // Sub1/2_Preview2 Mode_H binning
	{0x11, 0x91},
	{0x12, 0x20},//21

	{0x0b, 0xaa}, // ESD Check Register
	{0x0c, 0xaa}, // ESD Check Register
	{0x0d, 0xaa}, // ESD Check Register

	{0x20, 0x00}, // Windowing start point Y
	{0x21, 0x04},
	{0x22, 0x00}, // Windowing start point X
	{0x23, 0x07},

	{0x24, 0x04},
	{0x25, 0xb0},
	{0x26, 0x06},
	{0x27, 0x40}, // WINROW END

	{0x40, 0x01}, //Hblank 408
	{0x41, 0x68}, 
	{0x42, 0x00}, //Vblank 20
	{0x43, 0x14},

	{0x45, 0x04},
	{0x46, 0x18},
	{0x47, 0xd8},

	//BLC
	{0x80, 0x2e},
	{0x81, 0x7e},
	{0x82, 0x90},
	{0x83, 0x00},
	{0x84, 0x0c},
	{0x85, 0x00},
	{0x90, 0x14}, //BLC_TIME_TH_ON
	{0x91, 0x14}, //BLC_TIME_TH_OFF 
	{0x92, 0x98}, //BLC_AG_TH_ON
	{0x93, 0x90}, //BLC_AG_TH_OFF
	{0x94, 0x75},
	{0x95, 0x70},
	{0x96, 0xdc},
	{0x97, 0xfe},
	{0x98, 0x38},

	//OutDoor  BLC
	{0x99, 0x43},
	{0x9a, 0x43},
	{0x9b, 0x43},
	{0x9c, 0x43},

	//Dark BLC
	{0xa0, 0x00},
	{0xa2, 0x00},
	{0xa4, 0x00},
	{0xa6, 0x00},

	//Normal BLC
	{0xa8, 0x43},
	{0xaa, 0x43},
	{0xac, 0x43},
	{0xae, 0x43},

	/////// PAGE 2 START ///////
	{0x03, 0x02},
	{0x12, 0x03},
	{0x13, 0x03},
	{0x16, 0x00},
	{0x17, 0x8C},
	{0x18, 0x4c}, //Double_AG off
	{0x19, 0x00},
	{0x1a, 0x39}, //ADC400->560
	{0x1c, 0x09},
	{0x1d, 0x40},
	{0x1e, 0x30},
	{0x1f, 0x10},

	{0x20, 0x77},
	{0x21, 0xde},
	{0x22, 0xa7},
	{0x23, 0x30}, //CLAMP
	{0x27, 0x3c},
	{0x2b, 0x80},
	{0x2e, 0x11},
	{0x2f, 0xa1},
	{0x30, 0x05}, //For Hi-253 never no change 0x05

	{0x50, 0x20},
	{0x52, 0x01},
	{0x55, 0x1c},
	{0x56, 0x11},
	{0x5d, 0xa2},
	{0x5e, 0x5a},

	{0x60, 0x87},
	{0x61, 0x99},
	{0x62, 0x88},
	{0x63, 0x97},
	{0x64, 0x88},
	{0x65, 0x97},

	{0x67, 0x0c},
	{0x68, 0x0c},
	{0x69, 0x0c},

	{0x72, 0x89},
	{0x73, 0x96},
	{0x74, 0x89},
	{0x75, 0x96},
	{0x76, 0x89},
	{0x77, 0x96},

	{0x7c, 0x85},
	{0x7d, 0xaf},
	{0x80, 0x01},
	{0x81, 0x7f},
	{0x82, 0x13},

	{0x83, 0x24},
	{0x84, 0x7d},
	{0x85, 0x81},
	{0x86, 0x7d},
	{0x87, 0x81},

	{0x92, 0x48},
	{0x93, 0x54},
	{0x94, 0x7d},
	{0x95, 0x81},
	{0x96, 0x7d},
	{0x97, 0x81},

	{0xa0, 0x02},
	{0xa1, 0x7b},
	{0xa2, 0x02},
	{0xa3, 0x7b},
	{0xa4, 0x7b},
	{0xa5, 0x02},
	{0xa6, 0x7b},
	{0xa7, 0x02},

	{0xa8, 0x85},
	{0xa9, 0x8c},
	{0xaa, 0x85},
	{0xab, 0x8c},
	{0xac, 0x10},
	{0xad, 0x16},
	{0xae, 0x10},
	{0xaf, 0x16},

	{0xb0, 0x99},
	{0xb1, 0xa3},
	{0xb2, 0xa4},
	{0xb3, 0xae},
	{0xb4, 0x9b},
	{0xb5, 0xa2},
	{0xb6, 0xa6},
	{0xb7, 0xac},
	{0xb8, 0x9b},
	{0xb9, 0x9f},
	{0xba, 0xa6},
	{0xbb, 0xaa},
	{0xbc, 0x9b},
	{0xbd, 0x9f},
	{0xbe, 0xa6},
	{0xbf, 0xaa},

	{0xc4, 0x2c},
	{0xc5, 0x43},
	{0xc6, 0x63},
	{0xc7, 0x79},

	{0xc8, 0x2d},
	{0xc9, 0x42},
	{0xca, 0x2d},
	{0xcb, 0x42},
	{0xcc, 0x64},
	{0xcd, 0x78},
	{0xce, 0x64},
	{0xcf, 0x78},

	{0xd0, 0x0a},
	{0xd1, 0x09},
	{0xd4, 0x14}, //DCDC_TIME_TH_ON
	{0xd5, 0x14}, //DCDC_TIME_TH_OFF 
	{0xd6, 0x98}, //DCDC_AG_TH_ON
	{0xd7, 0x90}, //DCDC_AG_TH_OFF
	{0xe0, 0xc4},
	{0xe1, 0xc4},
	{0xe2, 0xc4},
	{0xe3, 0xc4},
	{0xe4, 0x00},
	{0xe8, 0x80},
	{0xe9, 0x40},
	{0xea, 0x7f},

	/////// PAGE 3 ///////
	{0x03, 0x03},
	{0x10, 0x10},

	/////// PAGE 10 START ///////
	{0x03, 0x10},
	{0x10, 0x01}, // CrYCbY // For Demoset 0x03
	{0x12, 0x30},
	{0x13, 0x0a}, // contrast on
	{0x20, 0x00},

	{0x30, 0x00},
	{0x31, 0x00},
	{0x32, 0x00},
	{0x33, 0x00},

	{0x34, 0x30},
	{0x35, 0x00},
	{0x36, 0x00},
	{0x38, 0x00},
	{0x3e, 0x58},
	{0x3f, 0x00},

	{0x40, 0x80}, // YOFS
	{0x41, 0x10}, // DYOFS
	{0x48, 0x84}, // Contrast
	{0x50, 0x90}, // Contrast

	{0x60, 0x6c},//67
	{0x61, 0x70}, //7e //8e //88 //80
	{0x62, 0x68}, //7e //8e //88 //80
	{0x63, 0x50}, //Double_AG 50->30
	{0x64, 0x41},

	{0x66, 0x42},
	{0x67, 0x20},

	{0x6a, 0x80}, //8a
	{0x6b, 0x84}, //74
	{0x6c, 0x80}, //7e //7a
	{0x6d, 0x80}, //8e

	/*Don't touch//////////////////////////
	//{0x72, 0x84},
	//{0x76, 0x19},
	//{0x73, 0x70},
	//{0x74, 0x68},
	//{0x75, 0x60}, // white protection ON
	//{0x77, 0x0e}, //08 //0a
	//{0x78, 0x2a}, //20
	//{0x79, 0x08},
	//////////////////////////////////////*/

	/*////// PAGE 11 START ///////*/
	{0x03, 0x11},
	{0x10, 0x7f},
	{0x11, 0x40},
	{0x12, 0x0a}, /* Blue Max-Filter Delete*/
	{0x13, 0xbb},

	{0x26, 0x31}, /* Double_AG 31->20*/
	{0x27, 0x34}, /* Double_AG 34->22*/
	{0x28, 0x0f},
	{0x29, 0x10},
	{0x2b, 0x30},
	{0x2c, 0x32},

	/*Out2 D-LPF th*/
	{0x30, 0x70},
	{0x31, 0x10},
	{0x32, 0x58},
	{0x33, 0x09},
	{0x34, 0x06},
	{0x35, 0x03},

	/*Out1 D-LPF th*/
	{0x36, 0x70},
	{0x37, 0x18},
	{0x38, 0x58},
	{0x39, 0x09},
	{0x3a, 0x06},
	{0x3b, 0x03},

	/*Indoor D-LPF th*/
	{0x3c, 0x80},
	{0x3d, 0x18},
	{0x3e, 0x83}, /*80*/
	{0x3f, 0x0c},
	{0x40, 0x03},
	{0x41, 0x06},

	{0x42, 0x80},
	{0x43, 0x18},
	{0x44, 0x83}, /*80*/
	{0x45, 0x12},
	{0x46, 0x10},
	{0x47, 0x10},

	{0x48, 0x90},
	{0x49, 0x40},
	{0x4a, 0x80},
	{0x4b, 0x13},
	{0x4c, 0x10},
	{0x4d, 0x11},

	{0x4e, 0x80},
	{0x4f, 0x30},
	{0x50, 0x80},
	{0x51, 0x13},
	{0x52, 0x10},
	{0x53, 0x13},

	{0x54, 0x11},
	{0x55, 0x17},
	{0x56, 0x20},
	{0x57, 0x01},
	{0x58, 0x00},
	{0x59, 0x00},

	{0x5a, 0x1f}, /*18*/
	{0x5b, 0x00},
	{0x5c, 0x00},

	{0x60, 0x3f},
	{0x62, 0x60},
	{0x70, 0x06},

	/*////// PAGE 12 START ///////*/
	{0x03, 0x12},
	{0x20, 0x00},
	{0x21, 0x00},

	{0x25, 0x00}, /*0x30*/

	{0x28, 0x00},
	{0x29, 0x00},
	{0x2a, 0x00},

	{0x30, 0x50},
	{0x31, 0x18},
	{0x32, 0x32},
	{0x33, 0x40},
	{0x34, 0x50},
	{0x35, 0x70},
	{0x36, 0xa0},

	/*Out2 th*/
	{0x40, 0xa0},
	{0x41, 0x40},
	{0x42, 0xa0},
	{0x43, 0x90},
	{0x44, 0x90},
	{0x45, 0x80},

	/*Out1 th*/
	{0x46, 0xb0},
	{0x47, 0x55},
	{0x48, 0xa0},
	{0x49, 0x90},
	{0x4a, 0x90},
	{0x4b, 0x80},

	/*Indoor th*/
	{0x4c, 0xb0},
	{0x4d, 0x40},
	{0x4e, 0x90},
	{0x4f, 0x90},
	{0x50, 0xa0},
	{0x51, 0x60},

	/*Dark1 th*/
	{0x52, 0xb0},
	{0x53, 0x60},
	{0x54, 0xc0},
	{0x55, 0xc0},
	{0x56, 0x80},
	{0x57, 0x57},

	/*Dark2 th*/
	{0x58, 0x90},
	{0x59, 0x40},
	{0x5a, 0xd0},
	{0x5b, 0xd0},
	{0x5c, 0xe0},
	{0x5d, 0x80},

	/*Dark3 th*/
	{0x5e, 0x88},
	{0x5f, 0x40},
	{0x60, 0xe0},
	{0x61, 0xe0},
	{0x62, 0xe0},
	{0x63, 0x80},

	{0x70, 0x15},
	{0x71, 0x01}, /*Don't Touch register*/

	{0x72, 0x18},
	{0x73, 0x01}, /*Don't Touch register*/

	{0x74, 0x25},
	{0x75, 0x15},

	{0x80, 0x20},
	{0x81, 0x40},
	{0x82, 0x65},
	{0x85, 0x1a},
	{0x88, 0x00},
	{0x89, 0x00},
	{0x90, 0x5d}, /*For Preview*/

	/*Dont Touch register*/
	{0xD0, 0x0c},
	{0xD1, 0x80},
	{0xD2, 0x67},
	{0xD3, 0x00},
	{0xD4, 0x00},
	{0xD5, 0x02},
	{0xD6, 0xff},
	{0xD7, 0x18},
	/*End*/
	{0x3b, 0x06},
	{0x3c, 0x06},

	{0xc5, 0x00},/*55->48*/
	{0xc6, 0x00},/*48->40*/

	/*////// PAGE 13 START //////*/
	{0x03, 0x13},
	/*Edge*/
	{0x10, 0xcb},
	{0x11, 0x7b},
	{0x12, 0x07},
	{0x14, 0x00},

	{0x20, 0x15},
	{0x21, 0x13},
	{0x22, 0x33},
	{0x23, 0x05},
	{0x24, 0x09},

	{0x25, 0x0a},

	{0x26, 0x18},
	{0x27, 0x30},
	{0x29, 0x12},
	{0x2a, 0x50},

	/*Low clip th*/
	{0x2b, 0x02},
	{0x2c, 0x02},
	{0x25, 0x06},
	{0x2d, 0x0c},
	{0x2e, 0x12},
	{0x2f, 0x12},

	/*Out2 Edge*/
	{0x50, 0x10},
	{0x51, 0x14},
	{0x52, 0x12},
	{0x53, 0x0c},
	{0x54, 0x0f},
	{0x55, 0x0c},

	/*Out1 Edge*/
	{0x56, 0x10},
	{0x57, 0x13},
	{0x58, 0x12},
	{0x59, 0x0c},
	{0x5a, 0x0f},
	{0x5b, 0x0c},

	/*Indoor Edge*/
	{0x5c, 0x0a},
	{0x5d, 0x0b},
	{0x5e, 0x0a},
	{0x5f, 0x08},
	{0x60, 0x09},
	{0x61, 0x08},

	/*Dark1 Edge*/
	{0x62, 0x08},
	{0x63, 0x08},
	{0x64, 0x08},
	{0x65, 0x06},
	{0x66, 0x06},
	{0x67, 0x06},

	/*Dark2 Edge*/
	{0x68, 0x07},
	{0x69, 0x07},
	{0x6a, 0x07},
	{0x6b, 0x05},
	{0x6c, 0x05},
	{0x6d, 0x05},

	/*Dark3 Edge*/
	{0x6e, 0x07},
	{0x6f, 0x07},
	{0x70, 0x07},
	{0x71, 0x05},
	{0x72, 0x05},
	{0x73, 0x05},


	/*2DY*/
	{0x80, 0xfd},
	{0x81, 0x1f},
	{0x82, 0x05},
	{0x83, 0x31},

	{0x90, 0x05},
	{0x91, 0x05},
	{0x92, 0x33},
	{0x93, 0x30},
	{0x94, 0x03},
	{0x95, 0x14},
	{0x97, 0x20},
	{0x99, 0x20},

	{0xa0, 0x01},
	{0xa1, 0x02},
	{0xa2, 0x01},
	{0xa3, 0x02},
	{0xa4, 0x05},
	{0xa5, 0x05},
	{0xa6, 0x07},
	{0xa7, 0x08},
	{0xa8, 0x07},
	{0xa9, 0x08},
	{0xaa, 0x07},
	{0xab, 0x08},

	//Out2 
	{0xb0, 0x22},
	{0xb1, 0x2a},
	{0xb2, 0x28},
	{0xb3, 0x22},
	{0xb4, 0x2a},
	{0xb5, 0x28},

	//Out1 
	{0xb6, 0x22},
	{0xb7, 0x2a},
	{0xb8, 0x28},
	{0xb9, 0x22},
	{0xba, 0x2a},
	{0xbb, 0x28},

	//Indoor 
	{0xbc, 0x25},
	{0xbd, 0x2a},
	{0xbe, 0x27},
	{0xbf, 0x25},
	{0xc0, 0x2a},
	{0xc1, 0x27},

	//Dark1
	{0xc2, 0x1e},
	{0xc3, 0x24},
	{0xc4, 0x20},
	{0xc5, 0x1e},
	{0xc6, 0x24},
	{0xc7, 0x20},

	//Dark2
	{0xc8, 0x18},
	{0xc9, 0x20},
	{0xca, 0x1e},
	{0xcb, 0x18},
	{0xcc, 0x20},
	{0xcd, 0x1e},

	//Dark3 
	{0xce, 0x18},
	{0xcf, 0x20},
	{0xd0, 0x1e},
	{0xd1, 0x18},
	{0xd2, 0x20},
	{0xd3, 0x1e},

	/////// PAGE 14 START ///////
	{0x03, 0x14},
	{0x10, 0x11},

	{0x14, 0x80}, // GX
	{0x15, 0x80}, // GY
	{0x16, 0x80}, // RX
	{0x17, 0x80}, // RY
	{0x18, 0x80}, // BX
	{0x19, 0x80}, // BY

	{0x20, 0x60}, //X 60 //a0
	{0x21, 0x80}, //Y

	{0x22, 0x80},
	{0x23, 0x80},
	{0x24, 0x80},

	{0x30, 0xc8},
	{0x31, 0x2b},
	{0x32, 0x00},
	{0x33, 0x00},
	{0x34, 0x90},

	{0x40, 0x48}, //31
	{0x50, 0x34}, //23 //32
	{0x60, 0x29}, //
	{0x70, 0x34}, //23 //32

	/////// PAGE 15 START ///////
	{0x03, 0x15},
	{0x10, 0x0f},

	//Rstep H 16
	//Rstep L 14
	{0x14, 0x42}, //CMCOFSGH_Day //4c
	{0x15, 0x32}, //CMCOFSGM_CWF //3c
	{0x16, 0x24}, //CMCOFSGL_A //2e
	{0x17, 0x2f}, //CMC SIGN

	//CMC_Default_CWF
	{0x30, 0x8f},
	{0x31, 0x59},
	{0x32, 0x0a},
	{0x33, 0x15},
	{0x34, 0x5b},
	{0x35, 0x06},
	{0x36, 0x07},
	{0x37, 0x40},
	{0x38, 0x87}, //86

	//CMC OFS L_A
	{0x40, 0x92},
	{0x41, 0x1b},
	{0x42, 0x89},
	{0x43, 0x81},
	{0x44, 0x00},
	{0x45, 0x01},
	{0x46, 0x89},
	{0x47, 0x9e},
	{0x48, 0x28},

	//{0x40, 0x93},
	//{0x41, 0x1c},
	//{0x42, 0x89},
	//{0x43, 0x82},
	//{0x44, 0x01},
	//{0x45, 0x01},
	//{0x46, 0x8a},
	//{0x47, 0x9d},
	//{0x48, 0x28},

	//CMC POFS H_DAY
	{0x50, 0x02},
	{0x51, 0x82},
	{0x52, 0x00},
	{0x53, 0x07},
	{0x54, 0x11},
	{0x55, 0x98},
	{0x56, 0x00},
	{0x57, 0x0b},
	{0x58, 0x8b},

	{0x80, 0x03},
	{0x85, 0x40},
	{0x87, 0x02},
	{0x88, 0x00},
	{0x89, 0x00},
	{0x8a, 0x00},

	/////// PAGE 16 START ///////
	{0x03, 0x16},
	{0x10, 0x31},
	{0x18, 0x5e},// Double_AG 5e->37
	{0x19, 0x5d},// Double_AG 5e->36
	{0x1a, 0x0e},
	{0x1b, 0x01},
	{0x1c, 0xdc},
	{0x1d, 0xfe},

	//GMA Default
	{0x30, 0x00},
	{0x31, 0x0a},
	{0x32, 0x1f},
	{0x33, 0x33},
	{0x34, 0x53},
	{0x35, 0x6c},
	{0x36, 0x81},
	{0x37, 0x94},
	{0x38, 0xa4},
	{0x39, 0xb3},
	{0x3a, 0xc0},
	{0x3b, 0xcb},
	{0x3c, 0xd5},
	{0x3d, 0xde},
	{0x3e, 0xe6},
	{0x3f, 0xee},
	{0x40, 0xf5},
	{0x41, 0xfc},
	{0x42, 0xff},

	{0x50, 0x00},
	{0x51, 0x09},
	{0x52, 0x1f},
	{0x53, 0x37},
	{0x54, 0x5b},
	{0x55, 0x76},
	{0x56, 0x8d},
	{0x57, 0xa1},
	{0x58, 0xb2},
	{0x59, 0xbe},
	{0x5a, 0xc9},
	{0x5b, 0xd2},
	{0x5c, 0xdb},
	{0x5d, 0xe3},
	{0x5e, 0xeb},
	{0x5f, 0xf0},
	{0x60, 0xf5},
	{0x61, 0xf7},
	{0x62, 0xf8},

	{0x70, 0x00},
	{0x71, 0x08},
	{0x72, 0x17},
	{0x73, 0x2f},
	{0x74, 0x53},
	{0x75, 0x6c},
	{0x76, 0x81},
	{0x77, 0x94},
	{0x78, 0xa4},
	{0x79, 0xb3},
	{0x7a, 0xc0},
	{0x7b, 0xcb},
	{0x7c, 0xd5},
	{0x7d, 0xde},
	{0x7e, 0xe6},
	{0x7f, 0xee},
	{0x80, 0xf4},
	{0x81, 0xfa},
	{0x82, 0xff},

	/////// PAGE 17 START ///////
	{0x03, 0x17},
	{0x10, 0xf7},

	{0x03, 0x18},
	{0x12, 0x20},
	{0x10, 0x07},
	{0x11, 0x00},
	{0x20, 0x05},
	{0x21, 0x20},
	{0x22, 0x03},
	{0x23, 0xd8},
	{0x24, 0x00},
	{0x25, 0x10},
	{0x26, 0x00},
	{0x27, 0x0c},
	{0x28, 0x05},
	{0x29, 0x10},
	{0x2a, 0x03},
	{0x2b, 0xcc},
	{0x2c, 0x09},
	{0x2d, 0xc1},
	{0x2e, 0x09},
	{0x2f, 0xc1},
	{0x30, 0x41},

	/////// PAGE 20 START ///////
	{0x03, 0x20},
	{0x11, 0x1c},
	{0x18, 0x30},
	{0x1a, 0x08},
	{0x20, 0x01}, //05_lowtemp Y Mean off
	{0x21, 0x30},
	{0x22, 0x10},
	{0x23, 0x00},
	{0x24, 0x00}, //Uniform Scene Off

	{0x28, 0xe7},
	{0x29, 0x0d}, //20100305 ad->0d
	{0x2a, 0xff},
	{0x2b, 0x04}, //f4->Adaptive off

	{0x2c, 0xc2},
	{0x2d, 0xcf},  //ff->AE Speed option
	{0x2e, 0x33},
	{0x30, 0x78}, //f8
	{0x32, 0x03},
	{0x33, 0x2e},
	{0x34, 0x30},
	{0x35, 0xd4},
	{0x36, 0xfe},
	{0x37, 0x32},
	{0x38, 0x04},

	{0x39, 0x22}, //AE_escapeC10
	{0x3a, 0xde}, //AE_escapeC11

	{0x3b, 0x22}, //AE_escapeC1
	{0x3c, 0xde}, //AE_escapeC2

	{0x50, 0x45},
	{0x51, 0x88},

	{0x56, 0x03},
	{0x57, 0xf7},
	{0x58, 0x14},
	{0x59, 0x88},
	{0x5a, 0x04},

	//New Weight For Samsung
	//{0x60, 0xaa},
	//{0x61, 0xaa},
	//{0x62, 0xaa},
	//{0x63, 0xaa},
	//{0x64, 0xaa},
	//{0x65, 0xaa},
	//{0x66, 0xab},
	//{0x67, 0xEa},
	//{0x68, 0xab},
	//{0x69, 0xEa},
	//{0x6a, 0xaa},
	//{0x6b, 0xaa},
	//{0x6c, 0xaa},
	//{0x6d, 0xaa},
	//{0x6e, 0xaa},
	//{0x6f, 0xaa},

	{0x60, 0x55}, // AEWGT1
	{0x61, 0x55}, // AEWGT2
	{0x62, 0x6a}, // AEWGT3
	{0x63, 0xa9}, // AEWGT4
	{0x64, 0x6a}, // AEWGT5
	{0x65, 0xa9}, // AEWGT6
	{0x66, 0x6a}, // AEWGT7
	{0x67, 0xa9}, // AEWGT8
	{0x68, 0x6b}, // AEWGT9
	{0x69, 0xe9}, // AEWGT10
	{0x6a, 0x6a}, // AEWGT11
	{0x6b, 0xa9}, // AEWGT12
	{0x6c, 0x6a}, // AEWGT13
	{0x6d, 0xa9}, // AEWGT14
	{0x6e, 0x55}, // AEWGT15
	{0x6f, 0x55}, // AEWGT16

	{0x70, 0x70}, //6e
	{0x71, 0x00}, //82(+8)->+0

	// haunting control
	{0x76, 0x43},
	{0x77, 0xe2}, //04
	{0x78, 0x23}, //Yth1
	{0x79, 0x42}, //Yth2
	{0x7a, 0x23}, //23
	{0x7b, 0x22}, //22
	{0x7d, 0x23},

	{0x83, 0x01}, //EXP Normal 33.33 fps 
	{0x84, 0xb7}, 
	{0x85, 0x74}, 

	{0x86, 0x01}, //EXPMin 5859.38 fps
	{0x87, 0xf4}, 

	{0x88, 0x05}, //EXP Max 10.00 fps 
	{0x89, 0xb8}, 
	{0x8a, 0xd8}, 

	{0x8B, 0x49}, //EXP100 
	{0x8C, 0x3e}, 
	{0x8D, 0x3c}, //EXP120 
	{0x8E, 0x8c}, 
	{0x9c, 0x17}, //EXP Limit 488.28 fps 
	{0x9d, 0x70}, 
	{0x9e, 0x01}, //EXP Unit 
	{0x9f, 0xf4}, 

	//AE_Middle Time option
	//{0xa0, 0x03},
	//{0xa1, 0xa9},
	//{0xa2, 0x80},

	{0xb0, 0x18},
	{0xb1, 0x14}, //ADC 400->560
	{0xb2, 0xa0}, //d0
	{0xb3, 0x18},
	{0xb4, 0x1a},
	{0xb5, 0x44},
	{0xb6, 0x2f},
	{0xb7, 0x28},
	{0xb8, 0x25},
	{0xb9, 0x22},
	{0xba, 0x21},
	{0xbb, 0x20},
	{0xbc, 0x1f},
	{0xbd, 0x1f},

	//AE_Adaptive Time option
	//{0xc0, 0x10},
	//{0xc1, 0x2b},
	//{0xc2, 0x2b},
	//{0xc3, 0x2b},
	//{0xc4, 0x08},

	{0xc8, 0x80},
	{0xc9, 0x40},

	/////// PAGE 22 START ///////
	{0x03, 0x22},
	{0x10, 0xfd},
	{0x11, 0x2e},
	{0x19, 0x01}, // Low On //
	{0x20, 0x30},
	{0x21, 0x80},
	{0x24, 0x01},
	//{0x25, 0x00}, //7f New Lock Cond & New light stable

	{0x30, 0x80},
	{0x31, 0x80},
	{0x38, 0x11},
	{0x39, 0x34},

	{0x40, 0xf4},
	{0x41, 0x55}, //44
	{0x42, 0x33}, //43

	{0x43, 0xf6},
	{0x44, 0x55}, //44
	{0x45, 0x44}, //33

	{0x46, 0x00},
	{0x50, 0xb2},
	{0x51, 0x81},
	{0x52, 0x98},

	{0x80, 0x40}, //3e
	{0x81, 0x20},
	{0x82, 0x3e},

	{0x83, 0x5e}, //5e
	{0x84, 0x1e}, //24
	{0x85, 0x5e}, //54 //56 //5a
	{0x86, 0x22}, //24 //22

	{0x87, 0x49},
	{0x88, 0x39},
	{0x89, 0x37}, //38
	{0x8a, 0x28}, //2a

	{0x8b, 0x41}, //47
	{0x8c, 0x39}, 
	{0x8d, 0x34}, 
	{0x8e, 0x28}, //2c

	{0x8f, 0x53}, //4e
	{0x90, 0x52}, //4d
	{0x91, 0x51}, //4c
	{0x92, 0x4e}, //4a
	{0x93, 0x4a}, //46
	{0x94, 0x45},
	{0x95, 0x3d},
	{0x96, 0x31},
	{0x97, 0x28},
	{0x98, 0x24},
	{0x99, 0x20},
	{0x9a, 0x20},

	{0x9b, 0x77},
	{0x9c, 0x77},
	{0x9d, 0x48},
	{0x9e, 0x38},
	{0x9f, 0x30},

	{0xa0, 0x60},
	{0xa1, 0x34},
	{0xa2, 0x6f},
	{0xa3, 0xff},

	{0xa4, 0x14}, //1500fps
	{0xa5, 0x2c}, // 700fps
	{0xa6, 0xcf},

	{0xad, 0x40},
	{0xae, 0x4a},

	{0xaf, 0x28},  // low temp Rgain
	{0xb0, 0x26},  // low temp Rgain

	{0xb1, 0x00}, //0x20 -> 0x00 0405 modify
	{0xb4, 0xea},
	{0xb8, 0xa0}, //a2: b-2, R+2  //b4 B-3, R+4 lowtemp
	{0xb9, 0x00},

	/////// PAGE 20 ///////
	{0x03, 0x20},
	{0x10, 0x8c},

	// PAGE 20
	{0x03, 0x20}, //page 20
	{0x10, 0x9c}, //ae off

	// PAGE 22
	{0x03, 0x22}, //page 22
	{0x10, 0xe9}, //awb off

	// PAGE 0
	{0x03, 0x00},
	{0x0e, 0x03}, //PLL On
	{0x0e, 0x73}, //PLLx2

	{0x03, 0x00}, // Dummy 750us
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},
	{0x03, 0x00},

	{0x03, 0x00}, // Page 0
	{0x01, 0xf8}, // Sleep Off 0xf8->0x50 for solve green line issue
	{REG_TERM, VAL_TERM}

};


static struct regulator *io_regulator;
static struct regulator *core_regulator;
static struct regulator *analog_regulator;
static struct regulator *gpo_regulator;
static struct mxc_camera_platform_data *camera_plat;

static int hi253_probe(struct i2c_client *adapter,
				const struct i2c_device_id *device_id);
static int hi253_remove(struct i2c_client *client);

static s32 hi253_read_reg(u16 reg, u8 *val);
static s32 hi253_write_reg(u16 reg, u8 val);

static const struct i2c_device_id hi253_id[] = {
	{"hi253", 0},
	{},
};

MODULE_DEVICE_TABLE(i2c, hi253_id);

static struct i2c_driver hi253_i2c_driver = {
	.driver = {
		  .owner = THIS_MODULE,
		  .name  = "hi253",
		  },
	.probe  = hi253_probe,
	.remove = hi253_remove,
	.id_table = hi253_id,
};

extern void gpio_sensor_active(unsigned int csi_index);
extern void gpio_sensor_inactive(unsigned int csi);

static s32 hi253_write_reg(u16 reg, u8 val)
{
	u8 au8Buf[3] = {0};

	//au8Buf[0] = reg >> 8;
	au8Buf[0] = reg & 0xff;
	au8Buf[1] = val;
	
	if (i2c_master_send(hi253_data.i2c_client, au8Buf, 2) < 0) {
		pr_err("%s:write reg error:reg=%x,val=%x\n",
			__func__, reg, val);
		return -1;
	}

	return 0;
}

static s32 hi253_read_reg(u16 reg, u8 *val)
{
	u8 au8RegBuf[2] = {0};
	u8 u8RdVal = 0;

	//au8RegBuf[0] = reg >> 8;
	au8RegBuf[0] = reg & 0xff;

       printk("\n=== [joe]=== %s, %d, %s\n", __FILE__,__LINE__,__func__);

	if (2 != i2c_master_send(hi253_data.i2c_client, au8RegBuf, 1)) {
		pr_err("%s:write reg error:reg=%x\n",
				__func__, reg);
		return -1;
	}

	if (1 != i2c_master_recv(hi253_data.i2c_client, &u8RdVal, 1)) {
		pr_err("%s:read reg error:reg=%x,val=%x\n",
				__func__, reg, u8RdVal);
		return -1;
	}

	*val = u8RdVal;

	return 0;
}

static int hi253_init_mode(enum hi253_frame_rate frame_rate,
			    enum hi253_mode mode)
{

	struct sensor_reg *pModeSetting = NULL;
	s32 i = 0;
	s32 iModeSettingArySize = 0;
	register u16 RegAddr = 0;	
	register u8 Val = 0;	
	int retval = 0;
	
	if (mode > hi253_mode_MAX || mode < hi253_mode_MIN) {
		pr_err("Wrong hi253 mode detected!\n");
		return -1;
	}

	printk("\n\n====joe==========frame=%d, mode=%d ======\n\n",frame_rate,mode);

	pModeSetting = hi253_mode_info_data[frame_rate][mode].init_data_ptr;
	iModeSettingArySize =
		hi253_mode_info_data[frame_rate][mode].init_data_size;

       printk("\n=========iModeSettingArySize=%d ===========\n",iModeSettingArySize);

	hi253_data.pix.width = hi253_mode_info_data[frame_rate][mode].width;
	hi253_data.pix.height = hi253_mode_info_data[frame_rate][mode].height;

	printk("\n\n====joe=======width=%d, height=%d ======\n\n",hi253_data.pix.width,hi253_data.pix.height);

	for (i = 0; i < iModeSettingArySize; ++i, ++pModeSetting) {
		RegAddr = pModeSetting->reg;
		Val = pModeSetting->val;
		
		retval = hi253_write_reg(RegAddr, Val);

		if (retval < 0)
		{
			printk("\n ERROR: Write register fail. hi253_init_mode\n");
			return -1;
		}
	}
	if ( mode == 0 )
	{
		msleep(500);
	}

	/*
	retval = hi253_write_reg(0x03, 0x00);
	retval = hi253_write_reg(0x03, 0x20); 
	if (retval < 0)
	{
		printk("\n ERROR: Write register fail. hi253_init_mode\n");
		return -1;
	}
	*/
	
	return 0;

/*
	int err;
       struct sensor_reg *next = sensor_initialize;
       printk("=== [joe]hi253_init_mode=== %s, %d, %s\n", __FILE__,__LINE__,__func__);

	   
	if (mode > hi253_mode_MAX || mode < hi253_mode_MIN) {
		pr_err("Wrong hi253 mode detected!\n");
		return -1;
	}

	while (!((next->reg == REG_TERM) && (next->val == VAL_TERM)))
	{
	
		//printk("====hi253_init_mode  reg=%d,  val=%d =====\n",next->reg,next->val);	
		if(next->reg == REG_TERM && next->val != VAL_TERM)
		{
			mdelay(next->val);
			printk("Sensor init Delay[%d]!!!! \n", next->val);
			next++;
		}
		else
		{
			err = hi253_write_reg(next->reg, next->val);
		       if (err)
		       {
				printk("ERROR: Sensor I2C !!!! \n"); 
				return -1;
			 }else
		        {
		            next++;
		        }
		}
	}

	return 0;
*/
}

/* --------------- IOCTL functions from v4l2_int_ioctl_desc --------------- */

static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p)
{
	if (s == NULL) {
		pr_err("   ERROR!! no slave device set!\n");
		return -1;
	}
       printk("\n=== [joe]=== %s, %d, %s\n", __FILE__,__LINE__,__func__);
	memset(p, 0, sizeof(*p));
	p->u.bt656.clock_curr = hi253_data.mclk;
	pr_debug("   clock_curr=mclk=%d\n", hi253_data.mclk);
	p->if_type = V4L2_IF_TYPE_BT656;
	p->u.bt656.mode = V4L2_IF_TYPE_BT656_MODE_NOBT_8BIT;
	p->u.bt656.clock_min = HI253_XCLK_MIN;
	p->u.bt656.clock_max = HI253_XCLK_MAX;
	p->u.bt656.bt_sync_correct = 1;  /* Indicate external vsync */

	return 0;
}

/*!
 * ioctl_s_power - V4L2 sensor interface handler for VIDIOC_S_POWER ioctl
 * @s: pointer to standard V4L2 device structure
 * @on: indicates power mode (on or off)
 *
 * Turns the power on or off, depending on the value of on and returns the
 * appropriate error code.
 */
static int ioctl_s_power(struct v4l2_int_device *s, int on)
{
	struct sensor *sensor = s->priv;
       printk("\n=== [joe]=== %s, %d, %s\n", __FILE__,__LINE__,__func__);
	if (on && !sensor->on) {
		gpio_sensor_active(hi253_data.csi);
		if (io_regulator)
			if (regulator_enable(io_regulator) != 0)
				return -EIO;
		if (core_regulator)
			if (regulator_enable(core_regulator) != 0)
				return -EIO;
		if (gpo_regulator)
			if (regulator_enable(gpo_regulator) != 0)
				return -EIO;
		if (analog_regulator)
			if (regulator_enable(analog_regulator) != 0)
				return -EIO;
		/* Make sure power on */
		if (camera_plat->pwdn)
			camera_plat->pwdn(0);

	} else if (!on && sensor->on) {
		if (analog_regulator)
			regulator_disable(analog_regulator);
		if (core_regulator)
			regulator_disable(core_regulator);
		if (io_regulator)
			regulator_disable(io_regulator);
		if (gpo_regulator)
			regulator_disable(gpo_regulator);
		gpio_sensor_inactive(hi253_data.csi);
	}

	sensor->on = on;

	return 0;
}

/*!
 * ioctl_g_parm - V4L2 sensor interface handler for VIDIOC_G_PARM ioctl
 * @s: pointer to standard V4L2 device structure
 * @a: pointer to standard V4L2 VIDIOC_G_PARM ioctl structure
 *
 * Returns the sensor's video CAPTURE parameters.
 */
static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
{
	struct sensor *sensor = s->priv;
	struct v4l2_captureparm *cparm = &a->parm.capture;
	int ret = 0;
       printk("\n=== [joe]=== %s, %d, %s\n", __FILE__,__LINE__,__func__);
	switch (a->type) {
	/* This is the only case currently handled. */
	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
		memset(a, 0, sizeof(*a));
		a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
		cparm->capability = sensor->streamcap.capability;
		cparm->timeperframe = sensor->streamcap.timeperframe;
		cparm->capturemode = sensor->streamcap.capturemode;


		printk("\n++++++++cparm->capturemode=%d +++++++++\n",cparm->capturemode );

		
		ret = 0;
		break;

	/* These are all the possible cases. */
	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
	case V4L2_BUF_TYPE_VIDEO_OVERLAY:
	case V4L2_BUF_TYPE_VBI_CAPTURE:
	case V4L2_BUF_TYPE_VBI_OUTPUT:
	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
	case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
		ret = -EINVAL;
		break;

	default:
		pr_debug("   type is unknown - %d\n", a->type);
		ret = -EINVAL;
		break;
	}

	return ret;
}

/*!
 * ioctl_s_parm - V4L2 sensor interface handler for VIDIOC_S_PARM ioctl
 * @s: pointer to standard V4L2 device structure
 * @a: pointer to standard V4L2 VIDIOC_S_PARM ioctl structure
 *
 * Configures the sensor to use the input parameters, if possible.  If
 * not possible, reverts to the old parameters and returns the
 * appropriate error code.
 */
static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
{
	struct sensor *sensor = s->priv;
	struct v4l2_fract *timeperframe = &a->parm.capture.timeperframe;
	u32 tgt_fps;	/* target frames per secound */
	enum hi253_frame_rate frame_rate;
	int ret = 0;
       printk("\n=== [joe]=== %s, %d, %s\n", __FILE__,__LINE__,__func__);
	/* Make sure power on */
	if (camera_plat->pwdn)
		camera_plat->pwdn(0);

	
	switch (a->type) {
	/* This is the only case currently handled. */
	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
		/* Check that the new frame rate is allowed. */
		if ((timeperframe->numerator == 0) ||
		    (timeperframe->denominator == 0)) {
			timeperframe->denominator = DEFAULT_FPS;
			timeperframe->numerator = 1;
		}

		tgt_fps = timeperframe->denominator /
			  timeperframe->numerator;

		if (tgt_fps > MAX_FPS) {
			timeperframe->denominator = MAX_FPS;
			timeperframe->numerator = 1;
		} else if (tgt_fps < MIN_FPS) {
			timeperframe->denominator = MIN_FPS;
			timeperframe->numerator = 1;
		}

		/* Actual frame rate we use */
		tgt_fps = timeperframe->denominator /
			  timeperframe->numerator;

		if (tgt_fps == 15)
			frame_rate = hi253_15_fps;
		else if (tgt_fps == 30)
			frame_rate = hi253_30_fps;
		else {
			pr_err(" The camera frame rate is not supported!\n");
			return -EINVAL;
		}

		sensor->streamcap.timeperframe = *timeperframe;
		sensor->streamcap.capturemode =
				(u32)a->parm.capture.capturemode;

		ret = hi253_init_mode(frame_rate,
				       sensor->streamcap.capturemode);
		break;

	/* These are all the possible cases. */
	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
	case V4L2_BUF_TYPE_VIDEO_OVERLAY:
	case V4L2_BUF_TYPE_VBI_CAPTURE:
	case V4L2_BUF_TYPE_VBI_OUTPUT:
	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
	case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
		pr_debug("   type is not " \
			"V4L2_BUF_TYPE_VIDEO_CAPTURE but %d\n",
			a->type);
		ret = -EINVAL;
		break;

	default:
		pr_debug("   type is unknown - %d\n", a->type);
		ret = -EINVAL;
		break;
	}

	return ret;
}

/*!
 * ioctl_g_fmt_cap - V4L2 sensor interface handler for ioctl_g_fmt_cap
 * @s: pointer to standard V4L2 device structure
 * @f: pointer to standard V4L2 v4l2_format structure
 *
 * Returns the sensor's current pixel format in the v4l2_format
 * parameter.
 */
static int ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f)
{
	struct sensor *sensor = s->priv;

	/*
	u8 HI253_Sleep_Mode;
	u8 CLK_DIV_REG;
	u32 HI253_pv_HI253_exposure_lines;
	u32 HI253_cp_HI253_exposure_lines;
  	int retval = 0;
	*/
	f->fmt.pix = sensor->pix;
	f->win.w.width
	/*	
	HI253_Sleep_Mode = (hi253_read_reg(0x01,0xff) & 0xfe);
	HI253_Sleep_Mode |= 0x01;
	retval = hi253_write_reg(0x01, HI253_Sleep_Mode);

	CLK_DIV_REG=(hi253_read_reg(0x12,0xff)&0xFc);    // don't divide,PCLK=48M


	//read the shutter (manual exptime)
	retval = hi253_write_reg(0x03, 0x20);
	HI253_pv_HI253_exposure_lines = (hi253_read_reg(0x80,0xff) << 16)|(hi253_read_reg(0x81,0xff) << 8)|hi253_read_reg(0x82,0xff);

	HI253_cp_HI253_exposure_lines = HI253_pv_HI253_exposure_lines/2;

	retval = hi253_write_reg(0x03, 0x00);

  	retval = hi253_write_reg(0x20, 0x00); 
	retval = hi253_write_reg(0x21, 0x0a); 
	retval = hi253_write_reg(0x22, 0x00); 
	retval = hi253_write_reg(0x23, 0x0a); 

	retval = hi253_write_reg(0x40, 0x01); //360
	retval = hi253_write_reg(0x41, 0x68); 
	retval = hi253_write_reg(0x42, 0x00);
	retval = hi253_write_reg(0x43, 0x14);

	retval = hi253_write_reg(0x03, 0x10);
	retval = hi253_write_reg(0x3f, 0x00);

	//Page12
	retval = hi253_write_reg(0x03, 0x12);
	retval = hi253_write_reg(0x20, 0x0f);
	retval = hi253_write_reg(0x21, 0x0f);
	retval = hi253_write_reg(0x90, 0x5d);

	//Page13
	retval = hi253_write_reg(0x03, 0x13);
	retval = hi253_write_reg(0x80, 0xfd);

	// 1600*1200	
	retval = hi253_write_reg(0x03,0x00);
	retval = hi253_write_reg(0x10,0x00);

	retval = hi253_write_reg(0x03, 0x00); 
	retval = hi253_write_reg(0x12,21);

	retval = hi253_write_reg(0x03, 0x20); 
	retval = hi253_write_reg(0x86, 0x01);
	retval = hi253_write_reg(0x87, 0xf4);
	
	retval = hi253_write_reg(0x8b, 0x3a);
	retval = hi253_write_reg(0x8c, 0x98);
	retval = hi253_write_reg(0x8d, 0x30);
	retval = hi253_write_reg(0x8e, 0xd4);

	retval = hi253_write_reg(0x9c, 0x17);
	retval = hi253_write_reg(0x9d, 0x70);
	retval = hi253_write_reg(0x9e, 0x01);
	retval = hi253_write_reg(0x9f, 0xf4);


	if(HI253_cp_HI253_exposure_lines<1)
	HI253_cp_HI253_exposure_lines=1;

	retval = hi253_write_reg(0x03, 0x20); 
	retval = hi253_write_reg(0x83, HI253_cp_HI253_exposure_lines >> 16);
	retval = hi253_write_reg(0x84, (HI253_cp_HI253_exposure_lines >> 8) & 0x000000FF);
	retval = hi253_write_reg(0x85, HI253_cp_HI253_exposure_lines & 0x000000FF);

	retval = hi253_write_reg(0x03,0x00); 	
	HI253_Sleep_Mode = (hi253_read_reg(0x01,0xff) & 0xfe);
	HI253_Sleep_Mode |= 0x00;
	retval = hi253_write_reg(0x01, HI253_Sleep_Mode);
	*/
	return 0;
}

/*!
 * ioctl_g_ctrl - V4L2 sensor interface handler for VIDIOC_G_CTRL ioctl
 * @s: pointer to standard V4L2 device structure
 * @vc: standard V4L2 VIDIOC_G_CTRL ioctl structure
 *
 * If the requested control is supported, returns the control's current
 * value from the video_control[] array.  Otherwise, returns -EINVAL
 * if the control is not supported.
 */
static int ioctl_g_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc)
{
	int ret = 0;
   	switch (vc->id) {
	case V4L2_CID_BRIGHTNESS:
		vc->value = hi253_data.brightness;
		break;
	case V4L2_CID_HUE:
		vc->value = hi253_data.hue;
		break;
	case V4L2_CID_CONTRAST:
		vc->value = hi253_data.contrast;
		break;
	case V4L2_CID_SATURATION:
		vc->value = hi253_data.saturation;
		break;
	case V4L2_CID_RED_BALANCE:
		vc->value = hi253_data.red;
		break;
	case V4L2_CID_BLUE_BALANCE:
		vc->value = hi253_data.blue;
		break;
	case V4L2_CID_EXPOSURE:
		vc->value = hi253_data.ae_mode;
		break;
	default:
		ret = -EINVAL;
	}

	return ret;
}

/*!
 * ioctl_s_ctrl - V4L2 sensor interface handler for VIDIOC_S_CTRL ioctl
 * @s: pointer to standard V4L2 device structure
 * @vc: standard V4L2 VIDIOC_S_CTRL ioctl structure
 *
 * If the requested control is supported, sets the control's current
 * value in HW (and updates the video_control[] array).  Otherwise,
 * returns -EINVAL if the control is not supported.
 */
static int ioctl_s_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc)
{
	int retval = 0;
       printk("\n=== [joe]=== %s, %d, %s\n", __FILE__,__LINE__,__func__);

	pr_debug("In hi253:ioctl_s_ctrl %d\n",
		 vc->id);

	switch (vc->id) {
	case V4L2_CID_BRIGHTNESS:
		break;
	case V4L2_CID_CONTRAST:
		break;
	case V4L2_CID_SATURATION:
		break;
	case V4L2_CID_HUE:
		break;
	case V4L2_CID_AUTO_WHITE_BALANCE:
		break;
	case V4L2_CID_DO_WHITE_BALANCE:
		break;
	case V4L2_CID_RED_BALANCE:
		break;
	case V4L2_CID_BLUE_BALANCE:
		break;
	case V4L2_CID_GAMMA:
		break;
	case V4L2_CID_EXPOSURE:
		break;
	case V4L2_CID_AUTOGAIN:
		break;
	case V4L2_CID_GAIN:
		break;
	case V4L2_CID_HFLIP:
		break;
	case V4L2_CID_VFLIP:
		break;
	default:
		retval = -EPERM;
		break;
	}

	return retval;
}

/*!
 * ioctl_init - V4L2 sensor interface handler for VIDIOC_INT_INIT
 * @s: pointer to standard V4L2 device structure
 */
static int ioctl_init(struct v4l2_int_device *s)
{
 	return 0;
}

/*!
 * ioctl_dev_init - V4L2 sensor interface handler for vidioc_int_dev_init_num
 * @s: pointer to standard V4L2 device structure
 *
 * Initialise the device when slave attaches to the master.
 */
static int ioctl_dev_init(struct v4l2_int_device *s)
{
	struct sensor *sensor = s->priv;
	u32 tgt_xclk;	/* target xclk */
	u32 tgt_fps;	/* target frames per secound */
	enum hi253_frame_rate frame_rate;
	gpio_sensor_active(hi253_data.csi);
	hi253_data.on = true;


	/* mclk */
	tgt_xclk = hi253_data.mclk;
	tgt_xclk = min(tgt_xclk, (u32)HI253_XCLK_MAX);
	tgt_xclk = max(tgt_xclk, (u32)HI253_XCLK_MIN);
	hi253_data.mclk = tgt_xclk;


	pr_debug("   Setting mclk to %d MHz\n", tgt_xclk / 1000000);
	set_mclk_rate(&hi253_data.mclk, hi253_data.csi);

	/* Default camera frame rate is set in probe */
	tgt_fps = sensor->streamcap.timeperframe.denominator /
		  sensor->streamcap.timeperframe.numerator;
	if (tgt_fps == 15)
		frame_rate = hi253_15_fps;
	else if (tgt_fps == 30)
		frame_rate = hi253_30_fps;
	else
		return -EINVAL; /* Only support 15fps or 30fps now. */

	return hi253_init_mode(frame_rate,
				sensor->streamcap.capturemode);
	
}

/*!
 * ioctl_dev_exit - V4L2 sensor interface handler for vidioc_int_dev_exit_num
 * @s: pointer to standard V4L2 device structure
 *
 * Delinitialise the device when slave detaches to the master.
 */
static int ioctl_dev_exit(struct v4l2_int_device *s)
{
	gpio_sensor_inactive(hi253_data.csi);
       printk("\n=== [joe]=== %s, %d, %s\n", __FILE__,__LINE__,__func__);
	return 0;
}

/*!
 * This structure defines all the ioctls for this module and links them to the
 * enumeration.
 */
static struct v4l2_int_ioctl_desc hi253_ioctl_desc[] = {
	{vidioc_int_dev_init_num, (v4l2_int_ioctl_func *)ioctl_dev_init},
	{vidioc_int_dev_exit_num, ioctl_dev_exit},
	{vidioc_int_s_power_num, (v4l2_int_ioctl_func *)ioctl_s_power},
	{vidioc_int_g_ifparm_num, (v4l2_int_ioctl_func *)ioctl_g_ifparm},
/*	{vidioc_int_g_needs_reset_num,
				(v4l2_int_ioctl_func *)ioctl_g_needs_reset}, */
/*	{vidioc_int_reset_num, (v4l2_int_ioctl_func *)ioctl_reset}, */
	{vidioc_int_init_num, (v4l2_int_ioctl_func *)ioctl_init},
/*	{vidioc_int_enum_fmt_cap_num,
				(v4l2_int_ioctl_func *)ioctl_enum_fmt_cap}, */
/*	{vidioc_int_try_fmt_cap_num,
				(v4l2_int_ioctl_func *)ioctl_try_fmt_cap}, */
	{vidioc_int_g_fmt_cap_num, (v4l2_int_ioctl_func *)ioctl_g_fmt_cap},
/*	{vidioc_int_s_fmt_cap_num, (v4l2_int_ioctl_func *)ioctl_s_fmt_cap}, */
	{vidioc_int_g_parm_num, (v4l2_int_ioctl_func *)ioctl_g_parm},
	{vidioc_int_s_parm_num, (v4l2_int_ioctl_func *)ioctl_s_parm},
/*	{vidioc_int_queryctrl_num, (v4l2_int_ioctl_func *)ioctl_queryctrl}, */
	{vidioc_int_g_ctrl_num, (v4l2_int_ioctl_func *)ioctl_g_ctrl},
	{vidioc_int_s_ctrl_num, (v4l2_int_ioctl_func *)ioctl_s_ctrl},
};

static struct v4l2_int_slave hi253_slave = {
	.ioctls = hi253_ioctl_desc,
	.num_ioctls = ARRAY_SIZE(hi253_ioctl_desc),
};

static struct v4l2_int_device hi253_int_device = {
	.module = THIS_MODULE,
	.name = "hi253",
	.type = v4l2_int_type_slave,
	.u = {
		.slave = &hi253_slave,
	},
};

/*!
 * hi253 I2C probe function
 *
 * @param adapter            struct i2c_adapter *
 * @return  Error code indicating success or failure
 */
static int hi253_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
{
	int retval;
	struct mxc_camera_platform_data *plat_data = client->dev.platform_data;
         printk("\n=== [joe]=== %s, %d, %s\n", __FILE__,__LINE__,__func__);

	/* Set initial values for the sensor struct. */
	memset(&hi253_data, 0, sizeof(hi253_data));
	
	hi253_data.mclk = 24000000; /* 6 - 54 MHz, typical 24MHz */
	hi253_data.mclk = plat_data->mclk;
	hi253_data.csi = plat_data->csi;

	hi253_data.i2c_client = client;
	hi253_data.pix.pixelformat = V4L2_PIX_FMT_UYVY;

	hi253_data.pix.width = 640;
	hi253_data.pix.height = 480;
	hi253_data.streamcap.capability = V4L2_MODE_HIGHQUALITY |
					   V4L2_CAP_TIMEPERFRAME;
	hi253_data.streamcap.capturemode = 0;
	hi253_data.streamcap.timeperframe.denominator = DEFAULT_FPS;
	hi253_data.streamcap.timeperframe.numerator = 1;
	if (plat_data->io_regulator) {
		io_regulator = regulator_get(&client->dev,
					     plat_data->io_regulator);
		if (!IS_ERR(io_regulator)) {
			regulator_set_voltage(io_regulator,
					      HI253_VOLTAGE_DIGITAL_IO,
					      HI253_VOLTAGE_DIGITAL_IO);
			if (regulator_enable(io_regulator) != 0) {
				pr_err("%s:io set voltage error\n", __func__);
				goto err1;
			} else {
				dev_dbg(&client->dev,
					"%s:io set voltage ok\n", __func__);
			}
		} else
			io_regulator = NULL;
	}

	if (plat_data->core_regulator) {
		core_regulator = regulator_get(&client->dev,
					       plat_data->core_regulator);
		if (!IS_ERR(core_regulator)) {
			regulator_set_voltage(core_regulator,
					      HI253_VOLTAGE_DIGITAL_CORE,
					      HI253_VOLTAGE_DIGITAL_CORE);
			if (regulator_enable(core_regulator) != 0) {
				pr_err("%s:core set voltage error\n", __func__);
				goto err2;
			} else {
				dev_dbg(&client->dev,
					"%s:core set voltage ok\n", __func__);
			}
		} else
			core_regulator = NULL;
	}

	if (plat_data->analog_regulator) {
		analog_regulator = regulator_get(&client->dev,
						 plat_data->analog_regulator);
		if (!IS_ERR(analog_regulator)) {
			regulator_set_voltage(analog_regulator,
					      HI253_VOLTAGE_ANALOG,
					      HI253_VOLTAGE_ANALOG);
			if (regulator_enable(analog_regulator) != 0) {
				pr_err("%s:analog set voltage error\n",
					__func__);
				goto err3;
			} else {
				dev_dbg(&client->dev,
					"%s:analog set voltage ok\n", __func__);
			}
		} else
			analog_regulator = NULL;
	}
	if (plat_data->gpo_regulator) {
		gpo_regulator = regulator_get(&client->dev,
					      plat_data->gpo_regulator);
		if (!IS_ERR(gpo_regulator)) {
			regulator_set_voltage(gpo_regulator,
					      HI253_VOLTAGE_DIGITAL_GPO,
					      HI253_VOLTAGE_DIGITAL_GPO);
			if (regulator_enable(gpo_regulator) != 0) {
				pr_err("%s:gpo enable error\n", __func__);
				goto err4;
			} else {
				dev_dbg(&client->dev,
					"%s:gpo enable ok\n", __func__);
			}
		} else
			gpo_regulator = NULL;
	}

	if (plat_data->pwdn)
		plat_data->pwdn(0);

	camera_plat = plat_data;

	hi253_int_device.priv = &hi253_data;
	retval = v4l2_int_device_register(&hi253_int_device);
	return retval;

err4:
	if (analog_regulator) {
		regulator_disable(analog_regulator);
		regulator_put(analog_regulator);
	}
err3:
	if (core_regulator) {
		regulator_disable(core_regulator);
		regulator_put(core_regulator);
	}
err2:
	if (io_regulator) {
		regulator_disable(io_regulator);
		regulator_put(io_regulator);
	}
err1:
	return -1;
}

/*!
 * hi253 I2C detach function
 *
 * @param client            struct i2c_client *
 * @return  Error code indicating success or failure
 */
static int hi253_remove(struct i2c_client *client)
{
	v4l2_int_device_unregister(&hi253_int_device);

	if (gpo_regulator) {
		regulator_disable(gpo_regulator);
		regulator_put(gpo_regulator);
	}

	if (analog_regulator) {
		regulator_disable(analog_regulator);
		regulator_put(analog_regulator);
	}

	if (core_regulator) {
		regulator_disable(core_regulator);
		regulator_put(core_regulator);
	}

	if (io_regulator) {
		regulator_disable(io_regulator);
		regulator_put(io_regulator);
	}

	return 0;
}

/*!
 * hi253 init function
 * Called by insmod hi253_camera.ko.
 *
 * @return  Error code indicating success or failure
 */
static __init int hi253_init(void)
{
	u8 err;
	err = i2c_add_driver(&hi253_i2c_driver);
	if (err != 0)
		pr_err("%s:driver registration failed, error=%d \n",
			__func__, err);
  
    	return err;
}

/*!
 * HI253 cleanup function
 * Called on rmmod hi253_camera.ko
 *
 * @return  Error code indicating success or failure
 */
static void __exit hi253_clean(void)
{
	i2c_del_driver(&hi253_i2c_driver);
}

module_init(hi253_init);
module_exit(hi253_clean);

MODULE_AUTHOR("XXX,Inc. JOE");
MODULE_DESCRIPTION("HI253 Camera Driver");
MODULE_LICENSE("GPL");
MODULE_VERSION("1.0");
MODULE_ALIAS("CSI");

你可能感兴趣的:(c,struct,Module,video,interface,structure)