Merge tag 'lsk-v3.10-android-14.11'
[firefly-linux-kernel-4.4.55.git] / drivers / media / video / sp0838.c
1 //#include <linux/gpio.h>
2 #include "generic_sensor.h"
3 /*
4 *      Driver Version Note
5 *v0.0.1: this driver is compatible with generic_sensor
6 *v0.1.1:
7 *        add sensor_focus_af_const_pause_usr_cb;
8 */
9 static int version = KERNEL_VERSION(0,1,1);
10 module_param(version, int, S_IRUGO);
11
12
13
14 static int debug;
15 module_param(debug, int, S_IRUGO|S_IWUSR);
16
17 #define dprintk(level, fmt, arg...) do {                        \
18         if (debug > level)                                      \
19         printk(KERN_WARNING fmt , ## arg); } while (0)
20
21 /* Sensor Driver Configuration Begin */
22 #define SENSOR_NAME RK29_CAM_SENSOR_SP0838
23 #define SENSOR_V4L2_IDENT V4L2_IDENT_SP0838
24 #define SENSOR_ID 0x27
25 #define SENSOR_BUS_PARAM                     (V4L2_MBUS_MASTER |\
26                                              V4L2_MBUS_PCLK_SAMPLE_RISING|V4L2_MBUS_HSYNC_ACTIVE_HIGH| V4L2_MBUS_VSYNC_ACTIVE_HIGH|\
27                                              V4L2_MBUS_DATA_ACTIVE_LOW   | SOCAM_MCLK_24MHZ)
28 #define SENSOR_PREVIEW_W                     640
29 #define SENSOR_PREVIEW_H                     480
30 #define SENSOR_PREVIEW_FPS                   15000     // 15fps 
31 #define SENSOR_FULLRES_L_FPS                 7500      // 7.5fps
32 #define SENSOR_FULLRES_H_FPS                 7500      // 7.5fps
33 #define SENSOR_720P_FPS                      0
34 #define SENSOR_1080P_FPS                     0
35
36 #define SENSOR_REGISTER_LEN                  1         // sensor register address bytes
37 #define SENSOR_VALUE_LEN                     1         // sensor register value bytes
38
39 static unsigned int SensorConfiguration = (CFG_WhiteBalance|CFG_Effect|CFG_Scene);
40 static unsigned int SensorChipID[] = {SENSOR_ID};
41 /* Sensor Driver Configuration End */
42
43
44 #define SENSOR_NAME_STRING(a) STR(CONS(SENSOR_NAME, a))
45 #define SENSOR_NAME_VARFUN(a) CONS(SENSOR_NAME, a)
46
47 #define SensorRegVal(a,b) CONS4(SensorReg,SENSOR_REGISTER_LEN,Val,SENSOR_VALUE_LEN)(a,b)
48 #define sensor_write(client,reg,v) CONS4(sensor_write_reg,SENSOR_REGISTER_LEN,val,SENSOR_VALUE_LEN)(client,(reg),(v))
49 #define sensor_read(client,reg,v) CONS4(sensor_read_reg,SENSOR_REGISTER_LEN,val,SENSOR_VALUE_LEN)(client,(reg),(v))
50 #define sensor_write_array generic_sensor_write_array
51
52 struct sensor_parameter
53 {
54         unsigned int PreviewDummyPixels;
55         unsigned int CaptureDummyPixels;
56         unsigned int preview_exposure;
57         unsigned short int preview_line_width;
58         unsigned short int preview_gain;
59
60         unsigned short int PreviewPclk;
61         unsigned short int CapturePclk;
62         char awb[6];
63 };
64
65 struct specific_sensor{
66         struct generic_sensor common_sensor;
67         //define user data below
68         struct sensor_parameter parameter;
69
70 };
71
72 #ifndef SP0838_MIRROR
73 #define SP0838_MIRROR 0
74 #endif
75 #ifndef SP0838_FLIP
76 #define SP0838_FLIP 0
77 #endif
78 /*
79 *  The follow setting need been filled.
80 *  
81 *  Must Filled:
82 *  sensor_init_data :               Sensor initial setting;
83 *  sensor_fullres_lowfps_data :     Sensor full resolution setting with best auality, recommand for video;
84 *  sensor_preview_data :            Sensor preview resolution setting, recommand it is vga or svga;
85 *  sensor_softreset_data :          Sensor software reset register;
86 *  sensor_check_id_data :           Sensir chip id register;
87 *
88 *  Optional filled:
89 *  sensor_fullres_highfps_data:     Sensor full resolution setting with high framerate, recommand for video;
90 *  sensor_720p:                     Sensor 720p setting, it is for video;
91 *  sensor_1080p:                    Sensor 1080p setting, it is for video;
92 *
93 *  :::::WARNING:::::
94 *  The SensorEnd which is the setting end flag must be filled int the last of each setting;
95 */
96
97 /* Sensor initial setting *//* init 640X480 VGA */
98 static struct rk_sensor_reg sensor_init_data[] =
99 {
100         {0xfd , 0x00}, //P0
101         {0x1B , 0x02},
102 #ifdef SP0838_FRONT_DRVCAP 
103         {0x1C , 0x03},  //add by sp_yjp,bit2: driver ability set(8mA)
104 #else
105         {0x1C , 0x07},
106 #endif
107         {0x30 , 0x02},//   1/2ispclk
108         {0x27 , 0xe8},
109         {0x28 , 0x0b}, // 0x0B pzt 2012-7-26
110         {0x32 , 0x00},
111         {0x22 , 0xc0},
112         {0x26 , 0x10}, 
113         {0x31 , 0x10|(SP0838_FLIP<<6)|(SP0838_MIRROR<<5)},//0x10},   //Upside/mirr/Pclk inv/sub
114
115         {0x5f , 0x11},   //Bayer order
116         {0xfd , 0x01},   //P1
117 //{0x20 , 0x68}, 
118 //{0x21 , 0x68}, 
119 //{0x22 , 0x7f}, 
120 //{0x23 , 0x30}, 
121
122         
123         {0x25 , 0x1a},   //Awb start
124         {0x26 , 0xfb}, 
125         {0x28 , 0x75}, 
126         {0x29 , 0x4e},
127         {0xfd , 0x00},   
128         {0xe7 , 0x03}, 
129         {0xe7 , 0x00}, 
130         {0xfd , 0x01},
131
132         {0x31 , 0x60},//64
133         {0x32 , 0x18},
134         {0x4d , 0xdc},
135         {0x4e , 0x53},
136         {0x41 , 0x8c},
137         {0x42 , 0x57},
138         {0x55 , 0xff},
139         {0x56 , 0x00},
140         {0x59 , 0x82},
141         {0x5a , 0x00},
142         {0x5d , 0xff},
143         {0x5e , 0x6f},
144         {0x57 , 0xff},
145         {0x58 , 0x00},
146         {0x5b , 0xff},
147         {0x5c , 0xa8},
148         {0x5f , 0x75},
149         {0x60 , 0x00},
150         {0x2d , 0x00},
151         {0x2e , 0x00},
152         {0x2f , 0x00},
153         {0x30 , 0x00},
154         {0x33 , 0x00},
155         {0x34 , 0x00},
156         {0x37 , 0x00},
157         {0x38 , 0x00},  //awb end
158         {0xfd , 0x00},  //P0
159         {0x33 , 0x6f},  //LSC BPC EN  // 0x6f pzt 2012-7-26
160         {0x51 , 0x3f},  //BPC debug start
161         {0x52 , 0x09},  
162         {0x53 , 0x00},  
163         {0x54 , 0x00},
164         {0x55 , 0x10},  //BPC debug end
165         {0x4f , 0xff},  //blueedge
166         {0x50 , 0xff},
167         {0x57 , 0x10},  //Raw filter debut start
168         {0x58 , 0x10},
169         {0x59 , 0x10},
170         {0x56 , 0x71},  //0x70  modify by sp_yjp,20120613
171         
172         {0x5a , 0x06},  //{0x5a , 0x02},    //0x05 modify by sp_yjp,20130709
173         {0x5b , 0x08},//        {0x5b , 0x02},  //0x06 modify by sp_yjp,20130709
174         {0x5c , 0x30},  //Raw filter debut end  //0x20 modify by sp_yjp,20120613
175
176         {0x65 , 0x04},  //Sharpness debug start //0x03 modify by sp_yjp,20130709
177         {0x66 , 0x01}, //       {0x66 , 0x01},sp_wyq
178         {0x67 , 0x08},//        {0x67 , 0x03},  //0x05  //modify by sp_yjp,20120613
179         {0x68 , 0x46},//        {0x68 , 0x46},//0x46 zch 20120725
180         
181         {0x69 , 0x7f},
182         {0x6a , 0x01},
183         
184         {0x6b , 0x04},//{0x6b , 0x04},  //0x06 modify by sp_yjp,20130709
185         {0x6c , 0x01},
186         {0x6d , 0x06},  //Edge gain normal {0x6d , 0x03},  //0x05  //modify by sp_yjp,20120613
187         {0x6e , 0x46},  //Edge gain normal      {0x6e , 0x46}, //0x46 zch 20120725
188         
189         {0x6f , 0x7f},
190         {0x70 , 0x01},
191
192         {0x71 , 0x0a}, //����Ã\96µ//0x09    modify by sp_yjp,20130709       
193         {0x72 , 0x01}, //�ï½ï¿½ï¿½ï¿½ï¿½Ã\96?      
194         {0x73 , 0x02}, //? //0x05  //modify by sp_yjp,20120613
195         {0x74 , 0x43}, //ï¿//0x47? //modify by sp_yjp,20120613
196
197
198         {0x75 , 0x7f}, //Ã\8a¹ÿ¿½ÿ¿½Ã\8e»           
199         {0x76 , 0x01},  //Sharpness debug end
200         {0xcb , 0x07},  //HEQ&Saturation debug start 
201         {0xcc , 0x04},
202         {0xce , 0xff},
203         {0xcf , 0x10},
204         {0xd0 , 0x20},
205         {0xd1 , 0x00},
206         {0xd2 , 0x1c},
207         {0xd3 , 0x16},
208         {0xd4 , 0x00},
209         {0xd6 , 0x1c},
210         {0xd7 , 0x16},
211         {0xdc , 0x08},
212         {0xdd , 0x70},  //Contrast  //0x70  //modify by sp_yjp,20130709
213         {0xde , 0xa0},  //HEQ&Saturation debug end  //0x90 //modify by sp_yjp,20130709
214
215         #if 0
216         {0x7f , 0xe1},  //Color Correction start
217         {0x80 , 0xbc},                          
218         {0x81 , 0xe3},                          
219         {0x82 , 0xd7},                          
220         {0x83 , 0xd5},                          
221         {0x84 , 0xd4},                          
222         {0x85 , 0xff},                          
223         {0x86 , 0x89},                          
224         {0x87 , 0xf8},                          
225         {0x88 , 0x3c},                          
226         {0x89 , 0x33},                          
227         {0x8a , 0x0f},  //Color Correction end  
228         #endif
229
230
231 #if 0//ÉԺ젠                                                       
232                 {0x7f , 0xee},  //Color Correction start                                        
233                 {0x80 , 0xc9},                                                                                          
234                 {0x81 , 0xc9},                                                                                          
235                 {0x82 , 0xd7},                                                                                          
236                 {0x83 , 0xe5},                                                                                          
237                 {0x84 , 0xc4},                                                                                          
238                 {0x85 , 0x07},                                                                                          
239                 {0x86 , 0x9a},                                                                                          
240                 {0x87 , 0xde},                                                                                          
241                 {0x88 , 0x3c},                                                                                          
242                 {0x89 , 0x33},                                                                                          
243                 {0x8a , 0x0c},  //Color Correction end                                          
244 #endif                                                      
245
246
247 #if 1
248 {0x7f , 0xf4},//0xed//0xe1      //Color Correction start
249 {0x80 , 0xbc},//0xbc//0xbc                                                      
250 {0x81 , 0xd0},//0xd7//0xe3                                                      
251 {0x82 , 0xbe},//0xbe//0xd7                                                      
252 {0x83 , 0xd5},//0xd5//0xd5                                                      
253 {0x84 , 0xee},//0xee//0xd4                                                      
254 {0x85 , 0xec},//0xf3//0xff                                                      
255 {0x86 , 0xb6},//0xaf//0x89                                                      
256 {0x87 , 0xde},//0xdf//0xf8                                                      
257 {0x88 , 0x3c},//0x3c//0x3c                                                      
258 {0x89 , 0x33},//0x33//0x33                                                      
259 {0x8a , 0x0f},//0x0f//0x0f      //Color Correction end  
260 #endif
261
262         
263         {0x8b , 0x00},  //gamma start
264         {0x8c , 0x1a},               
265         {0x8d , 0x29},               
266         {0x8e , 0x41},               
267         {0x8f , 0x62},               
268         {0x90 , 0x7c},               
269         {0x91 , 0x90},               
270         {0x92 , 0xa2},               
271         {0x93 , 0xaf},               
272         {0x94 , 0xbc},               
273         {0x95 , 0xc5},               
274         {0x96 , 0xcd},               
275         {0x97 , 0xd5},               
276         {0x98 , 0xda},               
277         {0x99 , 0xe3},               
278         {0x9a , 0xe8},               
279         {0x9b , 0xf0},               
280         {0xfd , 0x01},  //P1         
281         {0x8d , 0xf6},               
282         {0x8e , 0xfa},  //gamma end  
283         {0xfd , 0x00},  //P0
284         {0xca , 0xcf},
285
286         #if 0
287         {0xd8 , 0x58},  //UV outdoor
288         {0xd9 , 0x58},  //UV indoor 
289         {0xda , 0x50},  //UV dummy  //0x48  //modify by sp_yjp,20120613
290         {0xdb , 0x40},  //UV lowlight   //0x48  //modify by sp_yjp,20120613
291         #else
292         {0xd8 , 0x58},  //UV outdoor
293         {0xd9 , 0x58},  //UV indoor 
294         {0xda , 0x50},  //UV dummy  //0x48  //modify by sp_yjp,20120613
295         {0xdb , 0x50},  //UV lowlight   //0x48  //modify by sp_yjp,20120613
296         #endif
297         
298         {0xb9 , 0x00},  //Ygamma start
299         {0xba , 0x04},
300         {0xbb , 0x08},
301         {0xbc , 0x10},
302         {0xbd , 0x20},
303         {0xbe , 0x30},
304         {0xbf , 0x40},
305         {0xc0 , 0x50},
306         {0xc1 , 0x60},
307         {0xc2 , 0x70},
308         {0xc3 , 0x80},
309         {0xc4 , 0x90},
310         {0xc5 , 0xA0},
311         {0xc6 , 0xB0},
312         {0xc7 , 0xC0},
313         {0xc8 , 0xD0},
314         {0xc9 , 0xE0},
315         {0xfd , 0x01},  //P1
316         {0x89 , 0xf0},
317         {0x8a , 0xff},  //Ygamma end
318         {0xfd , 0x00},  //P0
319         {0xe8 , 0x30},  //AEdebug start
320         {0xe9 , 0x30},
321         {0xea , 0x40},  //Alc Window sel
322         {0xf4 , 0x1b},  //outdoor mode sel
323         {0xf5 , 0x80},
324
325         ///{0xf7 , 0x78},  //AE target
326         ///{0xf8 , 0x63},  
327         ///{0xf9 , 0x68},  //AE target
328         ///{0xfa , 0x53},
329
330         #if 1
331         {0xf7 , 0x88},  //AE target  //modify by sp_yjp,20130709
332         {0xf8 , 0x73},  
333         {0xf9 , 0x78},  //AE target
334         {0xfa , 0x63},
335         #else
336         {0xf7 , 0x80},  //AE target  //modify by sp_yjp,20120613
337         {0xf8 , 0x6b},  
338         {0xf9 , 0x70},  //AE target
339         {0xfa , 0x5b},
340         #endif
341
342         {0xfd , 0x01},  //P1
343         {0x09 , 0x31},  //AE Step 3.0
344         {0x0a , 0x85},
345         {0x0b , 0x0b},  //AE Step 3.0
346         {0x14 , 0x20},
347         {0x15 , 0x0f},
348
349         /*
350 #if 0//24M 1div 50HZ 16-8fps    //modify by sp_yjp,20120613
351         {0xfd , 0x00},
352         {0x05 , 0x0 },
353         {0x06 , 0x0 },
354         {0x09 , 0x2 },
355         {0x0a , 0x9d},
356         {0xf0 , 0x4f},
357         {0xf1 , 0x0 },
358         {0xf2 , 0x5b},
359         {0xf5 , 0x74},
360         {0xfd , 0x01},
361         {0x00 , 0xae},
362         {0x0f , 0x5c},
363         {0x16 , 0x5c},
364         {0x17 , 0x9e},
365         {0x18 , 0xa6},
366         {0x1b , 0x5c},
367         {0x1c , 0xa6},
368         {0xb4 , 0x21},
369         {0xb5 , 0x3b},
370         {0xb6 , 0x4b},
371         {0xb9 , 0x40},
372         {0xba , 0x4f},
373         {0xbb , 0x47},
374         {0xbc , 0x45},
375         {0xbd , 0x43},
376         {0xbe , 0x42},
377         {0xbf , 0x42},
378         {0xc0 , 0x42},
379         {0xc1 , 0x41},
380         {0xc2 , 0x41},
381         {0xc3 , 0x41},
382         {0xc4 , 0x41},
383         {0xc5 , 0x70},  //0x70
384         {0xc6 , 0x41},
385         {0xca , 0x70},  //0x70
386         {0xcb , 0xc },
387         {0xfd , 0x00},
388 #else//caprure preview daylight 24M 50hz 20-8FPS maxgain:0x70   
389         {0xfd , 0x00},
390         {0x05 , 0x0 },
391         {0x06 , 0x0 },
392         {0x09 , 0x1 },
393         {0x0a , 0x76},
394         {0xf0 , 0x62},
395         {0xf1 , 0x0 },
396         {0xf2 , 0x5f},
397         {0xf5 , 0x78},
398         {0xfd , 0x01},
399         {0x00 , 0xb2},
400         {0x0f , 0x60},
401         {0x16 , 0x60},
402         {0x17 , 0xa2},
403         {0x18 , 0xaa},
404         {0x1b , 0x60},
405         {0x1c , 0xaa},
406         {0xb4 , 0x20},
407         {0xb5 , 0x3a},
408         {0xb6 , 0x5e},
409         {0xb9 , 0x40},
410         {0xba , 0x4f},
411         {0xbb , 0x47},
412         {0xbc , 0x45},
413         {0xbd , 0x43},
414         {0xbe , 0x42},
415         {0xbf , 0x42},
416         {0xc0 , 0x42},
417         {0xc1 , 0x41},
418         {0xc2 , 0x41},
419         {0xc3 , 0x41},
420         {0xc4 , 0x41},
421         {0xc5 , 0x70},
422         {0xc6 , 0x41},
423         {0xca , 0x70},
424         {0xcb , 0xc },
425         {0xfd , 0x00},
426 #endif  
427         */
428         #if 0//zch 20130709
429         //caprure preview daylight 24M 50hz 15-10FPS maxgain:0x68                                
430         {0xfd,0x00},
431         {0x05,0x00},
432         {0x06,0x00},
433         {0x09,0x03},
434         {0x0a,0x04},
435         {0xf0,0x4a},
436         {0xf1,0x00},
437         {0xf2,0x59},
438         {0xf5,0x72},
439         {0xfd,0x01},
440         {0x00,0xa0},
441         {0x0f,0x5a},
442         {0x16,0x5a},
443         {0x17,0x98},
444         {0x18,0xa0},
445         {0x1b,0x5a},
446         {0x1c,0xa0},
447         {0xb4,0x20},
448         {0xb5,0x3a},
449         {0xb6,0x46},
450         {0xb9,0x40},
451         {0xba,0x4f},
452         {0xbb,0x47},
453         {0xbc,0x45},
454         {0xbd,0x43},
455         {0xbe,0x42},
456         {0xbf,0x42},
457         {0xc0,0x42},
458         {0xc1,0x41},
459         {0xc2,0x41},
460         {0xc3,0x68},
461         {0xc4,0x41},
462         {0xc5,0x41},
463         {0xc6,0x41},
464         {0xca,0x68},
465         {0xcb,0x0a},
466         {0xfd,0x00},
467         #endif
468
469         #if 0//2/1/2 ISP9-12fps
470         {0xfd,0x00},                                            
471         {0x05,0x00},                                            
472         {0x06,0x00},                                            
473         {0x09,0x00},                                            
474         {0x0a,0xa7},                                            
475         {0xf0,0x3b},                                            
476         {0xf1,0x00},                                            
477         {0xf2,0x56},                                            
478         {0xf5,0x6f},                                            
479         {0xfd,0x01},                                            
480         {0x00,0xa9},                                            
481         {0x0f,0x57},                                            
482         {0x16,0x57},                                            
483         {0x17,0x99},                                            
484         {0x18,0xa1},                                            
485         {0x1b,0x57},                                            
486         {0x1c,0xa1},                                            
487         {0xb4,0x21},                                            
488         {0xb5,0x39},                                            
489         {0xb6,0x39},                                            
490         {0xb9,0x40},                                            
491         {0xba,0x4f},                                            
492         {0xbb,0x47},                                            
493         {0xbc,0x45},                                            
494         {0xbd,0x43},                                            
495         {0xbe,0x42},                                            
496         {0xbf,0x42},                                            
497         {0xc0,0x42},                                            
498         {0xc1,0x41},                                            
499         {0xc2,0x41},                                            
500         {0xc3,0x41},                                            
501         {0xc4,0x41},                                            
502         {0xc5,0x70},                                            
503         {0xc6,0x41},                                            
504         {0xca,0x70},                                            
505         {0xcb,0x0c},                                            
506         {0xfd,0x00},                                            
507                                          
508         #endif
509
510 #if 0//10-12fps
511 {0xfd,0x00},      
512 {0x05,0x00},      
513 {0x06,0x00},      
514 {0x09,0x00},      
515 {0x0a,0xa7},      
516 {0xf0,0x3b},      
517 {0xf1,0x00},      
518 {0xf2,0x56},      
519 {0xf5,0x6f},      
520 {0xfd,0x01},      
521 {0x00,0xa7},      
522 {0x0f,0x57},      
523 {0x16,0x57},      
524 {0x17,0x97},      
525 {0x18,0x9f},      
526 {0x1b,0x57},      
527 {0x1c,0x9f},      
528 {0xb4,0x21},      
529 {0xb5,0x39},      
530 {0xb6,0x39},      
531 {0xb9,0x40},      
532 {0xba,0x4f},      
533 {0xbb,0x47},      
534 {0xbc,0x45},      
535 {0xbd,0x43},      
536 {0xbe,0x42},      
537 {0xbf,0x42},      
538 {0xc0,0x42},      
539 {0xc1,0x41},      
540 {0xc2,0x41},      
541 {0xc3,0x41},      
542 {0xc4,0x70},      
543 {0xc5,0x41},      
544 {0xc6,0x41},      
545 {0xca,0x70},      
546 {0xcb,0x0b},      
547 {0xfd,0x00},      
548
549 #endif
550
551
552 #if 1
553 //sensor AE settings:6-11fps                                      
554 {0xfd,0x00},                                                      
555 {0x05,0x00},                                                      
556 {0x06,0x00},                                                      
557 {0x09,0x01},                                                      
558 {0x0a,0x05},                                                      
559 {0xf0,0x36},                                                      
560 {0xf1,0x00},                                                      
561 {0xf2,0x53},                                                      
562 {0xf5,0x6c},                                                      
563 {0xfd,0x01},                                                      
564 {0x00,0x9c},                                                      
565 {0x0f,0x54},                                                      
566 {0x16,0x54},                                                      
567 {0x17,0x9c},                                                      
568 {0x18,0x00},                                                      
569 {0x1b,0x54},                                                      
570 {0x1c,0x43},                                                      
571 {0xb4,0x20},                                                      
572 {0xb5,0x34},                                                      
573 {0xb6,0x34},                                                      
574 {0xb9,0x40},                                                      
575 {0xba,0x4f},                                                      
576 {0xbb,0x47},                                                      
577 {0xbc,0x45},                                                      
578 {0xbd,0x43},                                                      
579 {0xbe,0x42},                                                      
580 {0xbf,0x42},                                                      
581 {0xc0,0x42},                                                      
582 {0xc1,0x41},                                                      
583 {0xc2,0x41},                                                      
584 {0xc3,0x41},                                                      
585 {0xc4,0x41},                                                      
586 {0xc5,0x41},                                                      
587 {0xc6,0x41},                                                      
588 {0xca,0x60},                                                      
589 {0xcb,0x10},                                                      
590 {0xfd,0x00},                                                                                                       
591 #endif
592         //added by yaowei@2013-06-05
593         //{0xfd,0x00},  //P0
594         //{0xd9,0x55},
595         //{0xda,0x55},
596         //{0xdb,0x55},
597         //{0xdc,0xe0},
598         
599
600         {0xfd , 0x00},  //P0
601         {0x32 , 0x15},  //Auto_mode set
602         {0x34 , 0x66},  //Isp_mode set
603         {0x35 , 0x40},   //out format
604         {0xfd , 0x00},  //P0
605         SensorEnd
606 };
607
608
609 /* Senor full resolution setting: recommand for capture */
610 static struct rk_sensor_reg sensor_fullres_lowfps_data[] ={
611
612     {0x47, 0x00},
613     {0x48, 0x00},
614     {0x49, 0x01},
615     {0x4a, 0xe0},
616     {0x4b, 0x00},
617     {0x4c, 0x00},
618     {0x4d, 0x02},
619     {0x4e, 0x80},
620         SensorEnd
621 };
622 /* Senor full resolution setting: recommand for video */
623 static struct rk_sensor_reg sensor_fullres_highfps_data[] ={
624         SensorEnd
625 };
626 /* Preview resolution setting*/
627 static struct rk_sensor_reg sensor_preview_data[] =
628 {
629     {0x47, 0x00},
630     {0x48, 0x00},
631     {0x49, 0x01},
632     {0x4a, 0xe0},
633     {0x4b, 0x00},
634     {0x4c, 0x00},
635     {0x4d, 0x02},
636     {0x4e, 0x80},
637
638         SensorEnd
639 };
640 /* 1280x720 */
641 static struct rk_sensor_reg sensor_720p[]={
642         SensorEnd
643 };
644
645 /* 1920x1080 */
646 static struct rk_sensor_reg sensor_1080p[]={
647         SensorEnd
648 };
649
650
651 static struct rk_sensor_reg sensor_softreset_data[]={
652         SensorEnd
653 };
654
655 static struct rk_sensor_reg sensor_check_id_data[]={
656     SensorRegVal(0x02,0x27),
657         SensorEnd
658 };
659
660 ///=========sp0838-modify by sp_yjp,20120529=================
661
662 static  struct rk_sensor_reg sensor_WhiteB_Auto[]=
663 {
664         //sp0838_reg_WB_auto         ï¿½Ô¶ï¿½     
665         {0xfd, 0x01},                                                          
666         {0x28, 0x75},                                                                  
667         {0x29, 0x4e},
668         {0xfd, 0x00},  // AUTO 3000K~7000K                                     
669         {0x32, 0x15}, 
670         {0xfd, 0x00},
671         SensorEnd
672 };
673 /* Cloudy Colour Temperature : 6500K - 8000K  */
674 static  struct rk_sensor_reg sensor_WhiteB_Cloudy[]=
675 {
676         // sp0838_reg_WB_auto   ï¿½ï¿½ï¿½ï¿½
677         {0xfd, 0x00},                                   
678         {0x32, 0x05},                                                          
679         {0xfd, 0x01},                                                          
680         {0x28, 0x71},                                                                  
681         {0x29, 0x41},                                                                  
682     {0xfd, 0x00},
683         SensorEnd
684 };
685 /* ClearDay Colour Temperature : 5000K - 6500K  */
686 static  struct rk_sensor_reg sensor_WhiteB_ClearDay[]=
687 {
688     //Sunny
689         // sp0838_reg_WB_auto  ï¿½ï¿½ï¿½ï¿½ 
690         {0xfd, 0x00},                                   
691         {0x32, 0x05},                                                          
692         {0xfd, 0x01},                                                          
693         {0x28, 0x6b},                                                                  
694         {0x29, 0x48},                                                                  
695     {0xfd, 0x00},
696         SensorEnd
697 };
698 /* Office Colour Temperature : 3500K - 5000K  */
699 static  struct rk_sensor_reg sensor_WhiteB_TungstenLamp1[]=
700 {
701     //Office
702         //sp0838_reg_WB_auto  Ó«ï¿½ï¿½ï¿½ï¿½ 
703     {0xfd, 0x00},
704     {0x32, 0x05},                                                          
705     {0xfd, 0x01},                                                          
706     {0x28, 0x41},                                                                      
707     {0x29, 0x71},                                                                      
708     {0xfd, 0x00},
709         SensorEnd
710 };
711 /* Home Colour Temperature : 2500K - 3500K  */
712 static  struct rk_sensor_reg sensor_WhiteB_TungstenLamp2[]=
713 {
714     //Home
715         //sp0838_reg_WB_auto ï¿½×³ï¿½ï¿½ï¿½ 
716     {0xfd, 0x00},                                  
717     {0x32, 0x05},                                                          
718     {0xfd, 0x01},                                                          
719     {0x28, 0x5a},                                                                      
720     {0x29, 0x62},                                                                      
721     {0xfd, 0x00},
722         SensorEnd
723 };
724 static struct rk_sensor_reg *sensor_WhiteBalanceSeqe[] = {sensor_WhiteB_Auto, sensor_WhiteB_TungstenLamp1,sensor_WhiteB_TungstenLamp2,
725     sensor_WhiteB_ClearDay, sensor_WhiteB_Cloudy,NULL,
726 };
727
728 ///=========sp0838-modify by sp_yjp,20120529=================
729 static  struct rk_sensor_reg sensor_Brightness0[]=
730 {
731     // Brightness -2
732     {0xfd, 0x00},
733         {0xdc, 0xe0},
734         {0xfd, 0x00},
735         SensorEnd
736 };
737
738 static  struct rk_sensor_reg sensor_Brightness1[]=
739 {
740     // Brightness -1
741     {0xfd, 0x00},
742         {0xdc, 0xf0},
743         {0xfd, 0x00},
744         SensorEnd
745 };
746
747 static  struct rk_sensor_reg sensor_Brightness2[]=
748 {
749     //  Brightness 0
750     {0xfd, 0x00},
751         {0xdc, 0x10},
752         {0xfd, 0x00},
753         SensorEnd
754 };
755
756 static  struct rk_sensor_reg sensor_Brightness3[]=
757 {
758     // Brightness +1
759     {0xfd, 0x00},
760         {0xdc, 0x10},
761         {0xfd, 0x00},
762         SensorEnd
763 };
764
765 static  struct rk_sensor_reg sensor_Brightness4[]=
766 {
767     //  Brightness +2
768     {0xfd, 0x00},
769         {0xdc, 0x20},
770         {0xfd, 0x00},
771         SensorEnd
772 };
773
774 static  struct rk_sensor_reg sensor_Brightness5[]=
775 {
776     //  Brightness +3
777     {0xfd, 0x00},
778         {0xdc, 0x30},
779         {0xfd, 0x00},
780         SensorEnd
781 };
782 static struct rk_sensor_reg *sensor_BrightnessSeqe[] = {sensor_Brightness0, sensor_Brightness1, sensor_Brightness2, sensor_Brightness3,
783     sensor_Brightness4, sensor_Brightness5,NULL,
784 };
785
786 ///=========sp0838-modify by sp_yjp,20120529=================
787 static  struct rk_sensor_reg sensor_Effect_Normal[] =
788 {
789         {0xfd, 0x00},
790         {0x62, 0x00},
791         {0x63, 0x80},
792         {0x64, 0x80},
793     {0xfd, 0x00},
794         SensorEnd
795 };
796
797 static  struct rk_sensor_reg sensor_Effect_WandB[] =
798 {
799         {0xfd, 0x00},
800         {0x62, 0x40},
801         {0x63, 0x80},
802         {0x64, 0x80},
803     {0xfd, 0x00},
804         SensorEnd
805 };
806
807 static  struct rk_sensor_reg sensor_Effect_Sepia[] =
808 {
809         {0xfd, 0x00},
810         {0x62, 0x20},
811         {0x63, 0xc0},
812         {0x64, 0x20},
813     {0xfd, 0x00},
814         SensorEnd
815 };
816
817 static  struct rk_sensor_reg sensor_Effect_Negative[] =
818 {
819     //Negative
820         {0xfd, 0x00},
821         {0x62, 0x10},
822         {0x63, 0x80},
823         {0x64, 0x80},
824     {0xfd, 0x00},
825         SensorEnd
826 };
827 static  struct rk_sensor_reg sensor_Effect_Bluish[] =
828 {
829     // Bluish
830     {0xfd, 0x00},
831         {0x62, 0x20},
832         {0x63, 0x20},
833         {0x64, 0xf0},
834     {0xfd, 0x00},
835         SensorEnd
836 };
837
838 static  struct rk_sensor_reg sensor_Effect_Green[] =
839 {
840     //  Greenish
841     {0xfd, 0x00},
842         {0x62, 0x20},
843         {0x63, 0x20},
844         {0x64, 0x20},
845     {0xfd, 0x00},
846         SensorEnd
847 };
848 static struct rk_sensor_reg *sensor_EffectSeqe[] = {sensor_Effect_Normal, sensor_Effect_WandB, sensor_Effect_Negative,sensor_Effect_Sepia,
849     sensor_Effect_Bluish, sensor_Effect_Green,NULL,
850 };
851
852 ///=========sp0838-modify by sp_yjp,20120529=================
853 static  struct rk_sensor_reg sensor_Exposure0[]=
854 {
855         {0xfd, 0x00},
856         {0xdc, 0xd0},
857     {0xfd, 0x00},
858     SensorEnd
859 };
860
861 static  struct rk_sensor_reg sensor_Exposure1[]=
862 {
863         {0xfd, 0x00},
864         {0xdc, 0xe0},
865     {0xfd, 0x00},
866     SensorEnd
867 };
868
869 static  struct rk_sensor_reg sensor_Exposure2[]=
870 {
871         {0xfd, 0x00},
872         {0xdc, 0xf0},
873     {0xfd, 0x00},
874     SensorEnd
875 };
876
877 static  struct rk_sensor_reg sensor_Exposure3[]=
878 {
879         {0xfd, 0x00},
880         {0xdc, 0x10},
881     {0xfd, 0x00},
882     SensorEnd
883 };
884
885 static  struct rk_sensor_reg sensor_Exposure4[]=
886 {
887         {0xfd, 0x00},
888         {0xdc, 0x10},
889     {0xfd, 0x00},
890     SensorEnd
891 };
892
893 static  struct rk_sensor_reg sensor_Exposure5[]=
894 {
895         {0xfd, 0x00},
896         {0xdc, 0x20},
897     {0xfd, 0x00},
898     SensorEnd
899 };
900
901 static  struct rk_sensor_reg sensor_Exposure6[]=
902 {
903         {0xfd, 0x00},
904         {0xdc, 0x30},
905     {0xfd, 0x00},
906     SensorEnd
907 };
908
909 static struct rk_sensor_reg *sensor_ExposureSeqe[] = {sensor_Exposure0, sensor_Exposure1, sensor_Exposure2, sensor_Exposure3,
910     sensor_Exposure4, sensor_Exposure5,sensor_Exposure6,NULL,
911 };
912
913 ///=========sp0838-modify by sp_yjp,20120529=================
914 static  struct rk_sensor_reg sensor_Saturation0[]=
915 {
916     SensorEnd
917 };
918
919 static  struct rk_sensor_reg sensor_Saturation1[]=
920 {
921     SensorEnd
922 };
923
924 static  struct rk_sensor_reg sensor_Saturation2[]=
925 {
926     SensorEnd
927 };
928 static struct rk_sensor_reg *sensor_SaturationSeqe[] = {sensor_Saturation0, sensor_Saturation1, sensor_Saturation2, NULL,};
929
930 ///=========sp0838-modify by sp_yjp,20120529=================
931 static  struct rk_sensor_reg sensor_Contrast0[]=
932 {
933     SensorEnd
934 };
935
936 static  struct rk_sensor_reg sensor_Contrast1[]=
937 {
938     SensorEnd
939 };
940
941 static  struct rk_sensor_reg sensor_Contrast2[]=
942 {
943 SensorEnd
944 };
945
946 static  struct rk_sensor_reg sensor_Contrast3[]=
947 {
948 SensorEnd
949 };
950
951 static  struct rk_sensor_reg sensor_Contrast4[]=
952 {
953 SensorEnd
954 };
955
956
957 static  struct rk_sensor_reg sensor_Contrast5[]=
958 {
959 SensorEnd
960 };
961
962 static  struct rk_sensor_reg sensor_Contrast6[]=
963 {
964 SensorEnd
965 };
966
967
968
969
970 static struct rk_sensor_reg *sensor_ContrastSeqe[] = {sensor_Contrast0, sensor_Contrast1, sensor_Contrast2, sensor_Contrast3,
971     sensor_Contrast4, sensor_Contrast5, sensor_Contrast6, NULL,
972 };
973
974
975 /*
976 ///=========sp0838-modify by sp_yjp,20120529=================
977 static  struct rk_sensor_reg sensor_MirrorOn[]=
978 {
979     {0xfd, 0x00},   //page 0
980     {0x31, 0x30},   //bit6:flip  bit5:mirror  bit4:pclk
981     {0xfd, 0x00},
982     SensorEnd
983 };
984
985 static  struct rk_sensor_reg sensor_MirrorOff[]=
986 {
987     {0xfd, 0x00},   //page 0
988     {0x31, 0x10},
989     {0xfd, 0x00},
990     SensorEnd
991 };
992 //static struct rk_sensor_reg *sensor_MirrorSeqe[] = {sensor_MirrorOff, sensor_MirrorOn,NULL,};
993
994 static  struct rk_sensor_reg sensor_FlipOn[]=
995 {
996     {0xfd, 0x00},   //page 0
997     {0x31, 0x50},
998     {0xfd, 0x00},
999     SensorEnd
1000 };
1001
1002 static  struct rk_sensor_reg sensor_FlipOff[]=
1003 {
1004     {0xfd, 0x00},   //page 0
1005     {0x31, 0x10},
1006     {0xfd, 0x00},
1007     SensorEnd
1008 };*/
1009 //static struct rk_sensor_reg *sensor_FlipSeqe[] = {sensor_FlipOff, sensor_FlipOn,NULL,};
1010
1011 ///=========sp0838-modify by sp_yjp,20120529=================
1012
1013 static  struct rk_sensor_reg sensor_SceneAuto[] =
1014 {
1015 #if 0
1016 //caprure preview daylight 24M 50hz 20-10FPS maxgain:0x70                                
1017 {0xfd,0x00},
1018 {0x05,0x00},
1019 {0x06,0x00},
1020 {0x07,0x00},
1021 {0x08,0x00},
1022 {0x09,0x01},
1023 {0x0a,0x76},
1024 {0xf0,0x62},
1025 {0xf1,0x00},
1026 {0xf2,0x5f},
1027 {0xf5,0x78},
1028 {0xfd,0x01},
1029 {0x00,0xae},
1030 {0x0f,0x60},
1031 {0x16,0x60},
1032 {0x17,0x9e},
1033 {0x18,0xa6},
1034 {0x1b,0x60},
1035 {0x1c,0xa6},
1036 {0xb4,0x20},
1037 {0xb5,0x3a},
1038 {0xb6,0x5e},
1039 {0xb9,0x40},
1040 {0xba,0x4f},
1041 {0xbb,0x47},
1042 {0xbc,0x45},
1043 {0xbd,0x43},
1044 {0xbe,0x42},
1045 {0xbf,0x42},
1046 {0xc0,0x42},
1047 {0xc1,0x41},
1048 {0xc2,0x41},
1049 {0xc3,0x70},
1050 {0xc4,0x41},
1051 {0xc5,0x41},
1052 {0xc6,0x41},
1053 {0xca,0x70},
1054 {0xcb,0x0a},
1055 {0x14,0x20},
1056 {0x15,0x0f},
1057 {0xfd,0x00},
1058 #endif
1059 #if 0//9-12
1060
1061 {0xfd,0x00},                        
1062 {0x05,0x00},                        
1063 {0x06,0x00},                        
1064 {0x09,0x00},                        
1065 {0x0a,0xa7},                        
1066 {0xf0,0x3b},                        
1067 {0xf1,0x00},                        
1068 {0xf2,0x56},                        
1069 {0xf5,0x6f},                        
1070 {0xfd,0x01},                        
1071 {0x00,0xa9},                        
1072 {0x0f,0x57},                        
1073 {0x16,0x57},                        
1074 {0x17,0x99},                        
1075 {0x18,0xa1},                        
1076 {0x1b,0x57},                        
1077 {0x1c,0xa1},                        
1078 {0xb4,0x21},                        
1079 {0xb5,0x39},                        
1080 {0xb6,0x39},                        
1081 {0xb9,0x40},                        
1082 {0xba,0x4f},                        
1083 {0xbb,0x47},                        
1084 {0xbc,0x45},                        
1085 {0xbd,0x43},                        
1086 {0xbe,0x42},                        
1087 {0xbf,0x42},                        
1088 {0xc0,0x42},                        
1089 {0xc1,0x41},                        
1090 {0xc2,0x41},                        
1091 {0xc3,0x41},                        
1092 {0xc4,0x41},                        
1093 {0xc5,0x70},                        
1094 {0xc6,0x41},                        
1095 {0xca,0x70},                        
1096 {0xcb,0x0c},                        
1097 {0xfd,0x00},                                    
1098 #endif
1099
1100 #if 0//10-12
1101 {0xfd,0x00},      
1102 {0x05,0x00},      
1103 {0x06,0x00},      
1104 {0x09,0x00},      
1105 {0x0a,0xa7},      
1106 {0xf0,0x3b},      
1107 {0xf1,0x00},      
1108 {0xf2,0x56},      
1109 {0xf5,0x6f},      
1110 {0xfd,0x01},      
1111 {0x00,0xa7},      
1112 {0x0f,0x57},      
1113 {0x16,0x57},      
1114 {0x17,0x97},      
1115 {0x18,0x9f},      
1116 {0x1b,0x57},      
1117 {0x1c,0x9f},      
1118 {0xb4,0x21},      
1119 {0xb5,0x39},      
1120 {0xb6,0x39},      
1121 {0xb9,0x40},      
1122 {0xba,0x4f},      
1123 {0xbb,0x47},      
1124 {0xbc,0x45},      
1125 {0xbd,0x43},      
1126 {0xbe,0x42},      
1127 {0xbf,0x42},      
1128 {0xc0,0x42},      
1129 {0xc1,0x41},      
1130 {0xc2,0x41},      
1131 {0xc3,0x41},      
1132 {0xc4,0x70},      
1133 {0xc5,0x41},      
1134 {0xc6,0x41},      
1135 {0xca,0x70},      
1136 {0xcb,0x0b},      
1137 {0xfd,0x00},      
1138
1139 #endif
1140
1141 #if 1
1142
1143 //sensor AE settings:6-11fps                                      
1144 {0xfd,0x00},                                                      
1145 {0x05,0x00},                                                      
1146 {0x06,0x00},                                                      
1147 {0x09,0x01},                                                      
1148 {0x0a,0x05},                                                      
1149 {0xf0,0x36},                                                      
1150 {0xf1,0x00},                                                      
1151 {0xf2,0x53},                                                      
1152 {0xf5,0x6c},                                                      
1153 {0xfd,0x01},                                                      
1154 {0x00,0x9c},                                                      
1155 {0x0f,0x54},                                                      
1156 {0x16,0x54},                                                      
1157 {0x17,0x9c},                                                      
1158 {0x18,0x00},                                                      
1159 {0x1b,0x54},                                                      
1160 {0x1c,0x43},                                                      
1161 {0xb4,0x20},                                                      
1162 {0xb5,0x34},                                                      
1163 {0xb6,0x34},                                                      
1164 {0xb9,0x40},                                                      
1165 {0xba,0x4f},                                                      
1166 {0xbb,0x47},                                                      
1167 {0xbc,0x45},                                                      
1168 {0xbd,0x43},                                                      
1169 {0xbe,0x42},                                                      
1170 {0xbf,0x42},                                                      
1171 {0xc0,0x42},                                                      
1172 {0xc1,0x41},                                                      
1173 {0xc2,0x41},                                                      
1174 {0xc3,0x41},                                                      
1175 {0xc4,0x41},                                                      
1176 {0xc5,0x41},                                                      
1177 {0xc6,0x41},                                                      
1178 {0xca,0x60},                                                      
1179 {0xcb,0x10},                                                      
1180 {0xfd,0x00},                                                      
1181                                                  
1182 #endif
1183
1184 SensorEnd
1185 };
1186
1187 static  struct rk_sensor_reg sensor_SceneNight[] =
1188 {
1189 #if 0
1190         //caprure preview night 24M 50hz 20-6FPS maxgain:0x78                  
1191         {0xfd,0x00},
1192         {0x05,0x0 },
1193         {0x06,0x0 },
1194         {0x09,0x1 },
1195         {0x0a,0x76},
1196         {0xf0,0x62},
1197         {0xf1,0x0 },
1198         {0xf2,0x5f},
1199         {0xf5,0x78},
1200         {0xfd,0x01},
1201         {0x00,0xc0},
1202         {0x0f,0x60},
1203         {0x16,0x60},
1204         {0x17,0xa8},
1205         {0x18,0xb0},
1206         {0x1b,0x60},
1207         {0x1c,0xb0},
1208         {0xb4,0x20},
1209         {0xb5,0x3a},
1210         {0xb6,0x5e},
1211         {0xb9,0x40},
1212         {0xba,0x4f},
1213         {0xbb,0x47},
1214         {0xbc,0x45},
1215         {0xbd,0x43},
1216         {0xbe,0x42},
1217         {0xbf,0x42},
1218         {0xc0,0x42},
1219         {0xc1,0x41},
1220         {0xc2,0x41},
1221         {0xc3,0x41},
1222         {0xc4,0x41},
1223         {0xc5,0x41},
1224         {0xc6,0x41},
1225         {0xca,0x78},
1226         {0xcb,0x10},
1227         {0x14,0x20},
1228         {0x15,0x1f},
1229         {0xfd,0x00},
1230         #endif
1231         #if 0
1232         {0xfd,0x00},                                                               
1233         {0x05,0x00},                                                               
1234         {0x06,0x00},                                                               
1235         {0x09,0x00},                                                               
1236         {0x0a,0xa7},                                                               
1237         {0xf0,0x3b},                                                               
1238         {0xf1,0x00},                                                               
1239         {0xf2,0x56},                                                               
1240         {0xf5,0x6f},                                                               
1241         {0xfd,0x01},                                                               
1242         {0x00,0xaf},                                                               
1243         {0x0f,0x57},                                                               
1244         {0x16,0x57},                                                               
1245         {0x17,0x9f},                                                               
1246         {0x18,0xa7},                                                               
1247         {0x1b,0x57},                                                               
1248         {0x1c,0xa7},                                                               
1249         {0xb4,0x21},                                                               
1250         {0xb5,0x39},                                                               
1251         {0xb6,0x39},                                                               
1252         {0xb9,0x40},                                                               
1253         {0xba,0x4f},                                                               
1254         {0xbb,0x47},                                                               
1255         {0xbc,0x45},                                                               
1256         {0xbd,0x43},                                                               
1257         {0xbe,0x42},                                                               
1258         {0xbf,0x42},                                                               
1259         {0xc0,0x42},                                                               
1260         {0xc1,0x41},                                                               
1261         {0xc2,0x41},                                                               
1262         {0xc3,0x41},                                                               
1263         {0xc4,0x41},                                                               
1264         {0xc5,0x41},                                                               
1265
1266         #endif
1267         
1268 #if 1
1269         
1270 //sensor AE settings:6-11fps                                      
1271 {0xfd,0x00},                                                      
1272 {0x05,0x00},                                                      
1273 {0x06,0x00},                                                      
1274 {0x09,0x01},                                                      
1275 {0x0a,0x05},                                                      
1276 {0xf0,0x36},                                                      
1277 {0xf1,0x00},                                                      
1278 {0xf2,0x53},                                                      
1279 {0xf5,0x6c},                                                      
1280 {0xfd,0x01},                                                      
1281 {0x00,0x9c},                                                      
1282 {0x0f,0x54},                                                      
1283 {0x16,0x54},                                                      
1284 {0x17,0x9c},                                                      
1285 {0x18,0x00},                                                      
1286 {0x1b,0x54},                                                      
1287 {0x1c,0x43},                                                      
1288 {0xb4,0x20},                                                      
1289 {0xb5,0x34},                                                      
1290 {0xb6,0x34},                                                      
1291 {0xb9,0x40},                                                      
1292 {0xba,0x4f},                                                      
1293 {0xbb,0x47},                                                      
1294 {0xbc,0x45},                                                      
1295 {0xbd,0x43},                                                      
1296 {0xbe,0x42},                                                      
1297 {0xbf,0x42},                                                      
1298 {0xc0,0x42},                                                      
1299 {0xc1,0x41},                                                      
1300 {0xc2,0x41},                                                      
1301 {0xc3,0x41},                                                      
1302 {0xc4,0x41},                                                      
1303 {0xc5,0x41},                                                      
1304 {0xc6,0x41},                                                      
1305 {0xca,0x60},                                                      
1306 {0xcb,0x10},                                                      
1307 {0xfd,0x00},                                                      
1308                                                                  
1309         
1310 #endif
1311         
1312 SensorEnd
1313 };
1314
1315 static struct rk_sensor_reg *sensor_SceneSeqe[] = {sensor_SceneAuto, sensor_SceneNight,NULL,};
1316
1317 ///=========sp0838-modify by sp_yjp,20120529=================
1318 static struct rk_sensor_reg sensor_Zoom0[] =
1319 {
1320 SensorEnd
1321 };
1322
1323 static struct rk_sensor_reg sensor_Zoom1[] =
1324 {
1325 SensorEnd
1326 };
1327
1328 static struct rk_sensor_reg sensor_Zoom2[] =
1329 {
1330 SensorEnd
1331 };
1332
1333
1334 static struct rk_sensor_reg sensor_Zoom3[] =
1335 {
1336 SensorEnd
1337 };
1338 static struct rk_sensor_reg *sensor_ZoomSeqe[] = {sensor_Zoom0, sensor_Zoom1, sensor_Zoom2, sensor_Zoom3, NULL,};
1339
1340
1341 ///=========sp0838-modify by sp_yjp,20120529=================
1342 static struct v4l2_querymenu sensor_menus[] =
1343 {
1344 };
1345 /*
1346 * User could be add v4l2_queryctrl in sensor_controls by new_user_v4l2ctrl
1347 */
1348 static struct sensor_v4l2ctrl_usr_s sensor_controls[] =
1349 {
1350 };
1351
1352 //MUST define the current used format as the first item   
1353 static struct rk_sensor_datafmt sensor_colour_fmts[] = {
1354         {V4L2_MBUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG} 
1355 };
1356 //static struct soc_camera_ops sensor_ops;
1357
1358 /*
1359 **********************************************************
1360 * Following is local code:
1361
1362 * Please codeing your program here 
1363 **********************************************************
1364 */
1365
1366 /*
1367 **********************************************************
1368 * Following is callback
1369 * If necessary, you could coding these callback
1370 **********************************************************
1371 */
1372 /*
1373 * the function is called in open sensor  
1374 */
1375 static int sensor_activate_cb(struct i2c_client *client)
1376 {
1377
1378     SENSOR_DG("%s",__FUNCTION__);       
1379
1380         
1381         return 0;
1382 }
1383 /*
1384 * the function is called in close sensor
1385 */
1386 static int sensor_deactivate_cb(struct i2c_client *client)
1387 {
1388         //struct generic_sensor *sensor = to_generic_sensor(client);
1389
1390     SENSOR_DG("%s",__FUNCTION__);
1391     
1392         return 0;
1393 }
1394 /*
1395 * the function is called before sensor register setting in VIDIOC_S_FMT  
1396 */
1397 static int sensor_s_fmt_cb_th(struct i2c_client *client,struct v4l2_mbus_framefmt *mf, bool capture)
1398 {
1399     return 0;
1400 }
1401 /*
1402 * the function is called after sensor register setting finished in VIDIOC_S_FMT  
1403 */
1404 static int sensor_s_fmt_cb_bh (struct i2c_client *client,struct v4l2_mbus_framefmt *mf, bool capture)
1405 {
1406     return 0;
1407 }
1408 static int sensor_softrest_usr_cb(struct i2c_client *client,struct rk_sensor_reg *series)
1409 {
1410         
1411         return 0;
1412 }
1413 static int sensor_check_id_usr_cb(struct i2c_client *client,struct rk_sensor_reg *series)
1414 {
1415         return 0;
1416 }
1417 static int sensor_try_fmt_cb_th(struct i2c_client *client,struct v4l2_mbus_framefmt *mf)
1418 {
1419         return 0;
1420 }
1421
1422 static int sensor_suspend(struct soc_camera_device *icd, pm_message_t pm_msg)
1423 {
1424         //struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
1425
1426                 
1427         if (pm_msg.event == PM_EVENT_SUSPEND) {
1428                 SENSOR_DG("Suspend");
1429                 
1430         } else {
1431                 SENSOR_TR("pm_msg.event(0x%x) != PM_EVENT_SUSPEND\n",pm_msg.event);
1432                 return -EINVAL;
1433         }
1434         return 0;
1435 }
1436
1437 static int sensor_resume(struct soc_camera_device *icd)
1438 {
1439
1440         SENSOR_DG("Resume");
1441
1442         return 0;
1443
1444 }
1445 static int sensor_mirror_cb (struct i2c_client *client, int mirror)
1446 {
1447         int err = 0;
1448     
1449     SENSOR_DG("mirror: %d",mirror);
1450         
1451
1452         return err;    
1453 }
1454 /*
1455 * the function is v4l2 control V4L2_CID_HFLIP callback  
1456 */
1457 static int sensor_v4l2ctrl_mirror_cb(struct soc_camera_device *icd, struct sensor_v4l2ctrl_info_s *ctrl_info, 
1458                                                      struct v4l2_ext_control *ext_ctrl)
1459 {
1460         struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
1461
1462     if (sensor_mirror_cb(client,ext_ctrl->value) != 0)
1463                 SENSOR_TR("sensor_mirror failed, value:0x%x",ext_ctrl->value);
1464         
1465         SENSOR_DG("sensor_mirror success, value:0x%x",ext_ctrl->value);
1466         return 0;
1467 }
1468
1469 static int sensor_flip_cb(struct i2c_client *client, int flip)
1470 {
1471         int err = 0;    
1472
1473     SENSOR_DG("flip: %d",flip);
1474         
1475         return err;    
1476 }
1477 /*
1478 * the function is v4l2 control V4L2_CID_VFLIP callback  
1479 */
1480 static int sensor_v4l2ctrl_flip_cb(struct soc_camera_device *icd, struct sensor_v4l2ctrl_info_s *ctrl_info, 
1481                                                      struct v4l2_ext_control *ext_ctrl)
1482 {
1483         struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
1484
1485     if (sensor_flip_cb(client,ext_ctrl->value) != 0)
1486                 SENSOR_TR("sensor_flip failed, value:0x%x",ext_ctrl->value);
1487         
1488         SENSOR_DG("sensor_flip success, value:0x%x",ext_ctrl->value);
1489         return 0;
1490 }
1491 /*
1492 * the functions are focus callbacks
1493 */
1494 static int sensor_focus_init_usr_cb(struct i2c_client *client){
1495         return 0;
1496 }
1497
1498 static int sensor_focus_af_single_usr_cb(struct i2c_client *client){
1499         return 0;
1500 }
1501
1502 static int sensor_focus_af_near_usr_cb(struct i2c_client *client){
1503         return 0;
1504 }
1505
1506 static int sensor_focus_af_far_usr_cb(struct i2c_client *client){
1507         return 0;
1508 }
1509
1510 static int sensor_focus_af_specialpos_usr_cb(struct i2c_client *client,int pos){
1511         return 0;
1512 }
1513
1514 static int sensor_focus_af_const_usr_cb(struct i2c_client *client){
1515         return 0;
1516 }
1517 static int sensor_focus_af_const_pause_usr_cb(struct i2c_client *client)
1518 {
1519     return 0;
1520 }
1521 static int sensor_focus_af_close_usr_cb(struct i2c_client *client){
1522         return 0;
1523 }
1524
1525 static int sensor_focus_af_zoneupdate_usr_cb(struct i2c_client *client, int *zone_tm_pos){
1526         return 0;
1527 }
1528
1529 /*
1530 face defect call back
1531 */
1532 static int      sensor_face_detect_usr_cb(struct i2c_client *client,int on){
1533         return 0;
1534 }
1535
1536 /*
1537 *   The function can been run in sensor_init_parametres which run in sensor_probe, so user can do some
1538 * initialization in the function. 
1539 */
1540 static void sensor_init_parameters_user(struct specific_sensor* spsensor,struct soc_camera_device *icd)
1541 {
1542     return;
1543 }
1544 /*
1545
1546 #define CHIP_NAME   RK29_CAM_SENSOR_NAME_SP0838
1547 #define DBG_DIR "fcam"
1548 #include "./add-cam-inf.c"
1549
1550 * :::::WARNING:::::
1551 * It is not allowed to modify the following code
1552 */
1553
1554 sensor_init_parameters_default_code();
1555
1556 sensor_v4l2_struct_initialization();
1557
1558 sensor_probe_default_code();
1559
1560 sensor_remove_default_code();
1561
1562 sensor_driver_default_module_code();
1563