summaryrefslogtreecommitdiff
path: root/drivers/media/video/wmt_v4l2/sensors/gc0307/gc0307.h
blob: 9c58f202c73b6bff1e3bcd6aa403092d28fa9124 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
#ifndef GC0307_H
#define GC0307_H


// Scene Mode
uint8_t gc0307_scene_mode_auto[] = {

};

uint8_t gc0307_scene_mode_night[] = {

};


// White Balance
uint8_t gc0307_wb_auto [] = {
	0xf0,0x00,
//	0x41,0x2b,
	0xc7,0x4c,
	0xc8,0x40,
	0xc9,0x4a,
};

uint8_t gc0307_wb_incandescent [] = {
	//bai re guang
	0xf0,0x00,
//	0x41,0x2b,	
	0xc7,0x48,
	0xc8,0x40,
	0xc9,0x5c,
};

uint8_t gc0307_wb_fluorescent [] = {
	//ri guang deng
	0xf0,0x00,
//	0x41,0x2b,
	0xc7,0x40,
	0xc8,0x42,
	0xc9,0x50,
};

uint8_t gc0307_wb_daylight [] = {
	//tai yang guang
	0xf0,0x00,
//	0x41,0x2b,	
	0xc7,0x50,
	0xc8,0x45,
	0xc9,0x40,
};

uint8_t gc0307_wb_cloudy [] = {
	0xf0,0x00,
//	0x41,0x2b,
	0xc7,0x5a,
	0xc8,0x42,
	0xc9,0x40,
};


// Exposure
uint8_t gc0307_exposure_neg6[] = {
	0xf0,0x00,
	0x7a,0xd0,                   
	0xd1,0x38,                      	
};

uint8_t gc0307_exposure_neg3[] = {
	0xf0,0x00,
	0x7a,0xe0,                   
	0xd1,0x48,                   	
};

uint8_t gc0307_exposure_zero[] = {
	0xf0,0x00,
	0x7a,0x00,                   
	0xd1,0x50,                   	
};

uint8_t gc0307_exposure_pos3[] = {
	0xf0,0x00,
	0x7a,0x20,                   
	0xd1,0x58,                   	
};

uint8_t gc0307_exposure_pos6[] = {
	0xf0,0x00,
	0x7a,0x40,                   
	0xd1,0x68,                   
};


// Resolution
uint8_t gc0307_320x240[]= {
	0x05,0x00,
	0x06,0x78,
	0x07,0x00,
	0x08,0xa0,
	0x09,0x00,
	0x0a,0xf8,
	0x0b,0x01,
	0x0c,0x48,
	0x45,0x24,		// bit[7:2]=001001
	0x48,0x04,		// bit[7]= 0
	0xe0,0x02,
	0xe1,0x01,
	0xe2,0x13,
	0xe3,0x0f,
	0xe8,0x1c,
	0xe9,0x35,
	0xea,0x17,
	0xeb,0x29,
	0xec,0x39,
};

uint8_t gc0307_640x480[] = {
#if 0
	0x05,0x00,                         
	0x06,0x00,                         
	0x07,0x00,                         
	0x08,0x00,                         
	0x09,0x01,                         
	0x0a,0xe8,                         
	0x0b,0x02,                         
	0x0c,0x80,                         
	0x45,0x26,		// bit[7:2]=001001   
	0x48,0x84,		// bit[7]=1          
	0xe0,0x03,                         
	0xe1,0x02,                         
	0xe2,0x27,                         
	0xe3,0x1e,                         
	0xe8,0x3b,                         
	0xe9,0x6e,                         
	0xea,0x2c,                         
	0xeb,0x50,                         
	0xec,0x73,  
#endif
};

uint8_t gc0307_default_regs_init[] = {

	     // Initail Sequence Write In.
	    //========= close output
	0x43,0x00,
	0x44,0xa2,
	    
	         //========= close some functions
	          // open them after configure their parmameters
	0x40,0x10,
	0x41,0x00,          
	0x42,0x10,                      
	0x47,0x00,//mode1,                  
	0x48,0xc1,//mode2,
	0x49,0x00,//dither_mode         
	0x4a,0x00,//clock_gating_en
	0x4b,0x00,//mode_reg3
	0x4E,0x23,//sync mode
	0x4F,0x01,//AWB, AEC, every N frame 
	     
	                        //========= frame timing
	0x01,0x6a,//HB
	0x02,0x70,//VB//0c
	0x1C,0x00,//Vs_st
	0x1D,0x00,//Vs_et
	0x10,0x00,//high 4 bits of VB, HB
	0x11,0x05,//row_tail,  AD_pipe_number
	     
	0x03,0x01,//row_start
	0x04,0x2c,
	     
	              //========= windowing
	0x05,0x00,//row_start
	0x06,0x00,
	0x07,0x00,//col start
	0x08,0x00,
	0x09,0x01,//win height
	0x0A,0xE8,
	0x0B,0x02,//win width, pixel array only 640
	0x0C,0x80,
	     
	                      //========= analog
	0x0D,0x22,//rsh_width
	0x0E,0x02,//CISCTL mode2,  
	0x0F,0xb2,//CISCTL mode1
	     
	     
	0x12,0x70,//7 hrst, 6_4 darsg,
	0x13,0x00,//7 CISCTL_restart, 0 apwd
	0x14,0x00,//NA
	0x15,0xba,//7_4 vref
	0x16,0x13,//5to4 _coln_r,  __1to0__da18
	0x17,0x52,//opa_r, ref_r, sRef_r
	//0x18,0xc0,//analog_mode, best case for left band.
	0x18,0x00,
	      
	0x1E,0x0d,//tsp_width          
	0x1F,0x32,//sh_delay
	     
	                          //========= offset
	0x47,0x00, //7__test_image, __6__fixed_pga, //__5__auto_DN,__4__CbCr_fix, 
	                   //__3to2__dark_sequence, __1__allow_pclk_vcync, __0__LSC_test_image
	0x19,0x06, //pga_o           
	0x1a,0x06, //pga_e           
	     
	0x31,0x00, //4  //pga_oFFset ,   high 8bits of 11bits
	0x3B,0x00, //global_oFFset, low 8bits of 11bits
	     
	0x59,0x0f, //offset_mode    
	0x58,0x88, //DARK_VALUE_RATIO_G,  DARK_VALUE_RATIO_RB
	0x57,0x08, //DARK_CURRENT_RATE
	0x56,0x77, //PGA_OFFSET_EVEN_RATIO, PGA_OFFSET_ODD_RATIO
	      
	             //========= blk
	0x35,0xd8, //blk_mode
	     
	0x36,0x40, 
	    
	0x3C,0x00,
	0x3D,0x00,
	0x3E,0x00,
	0x3F,0x00,
	     
	0xb5,0x70,
	0xb6,0x40,
	0xb7,0x00,
	0xb8,0x38,
	0xb9,0xc3,        
	0xba,0x0f,
	     
	0x7e,0x45,
	0x7f,0x66,
	     
	0x5c,0x48,//78
	0x5d,0x58,//88
	      
	      
	               //========= manual_gain 
	0x61,0x80,//manual_gain_g1  
	0x63,0x80,//manual_gain_r
	0x65,0x98,//manual_gai_b, 0xa0=1.25, 0x98=1.1875
	0x67,0x80,//manual_gain_g2
	0x68,0x18,//global_manual_gain   2.4bits
	     
	                 //=========CC _R
	0x69,0x58, //54//58
	0x6A,0xf6, //ff
	0x6B,0xfb, //fe
	0x6C,0xf4, //ff
	0x6D,0x5a, //5f
	0x6E,0xe6, //e1
	      
	0x6f,0x00,  
	      
	           //=========lsc                            
	0x70,0x14,
	0x71,0x1c,
	0x72,0x20,
	      
	0x73,0x10,  
	0x74,0x3c,//480/8
	0x75,0x52,// 640/8
	     
	                 //=========dn                                                                            
	0x7d,0x2f, //dn_mode    
	0x80,0x0c,//when auto_dn, check 7e,7f
	0x81,0x0c,
	0x82,0x44,
	                  
	                   //dd                                                                           
	0x83,0x18, //DD_TH1                       
	0x84,0x18, //DD_TH2                       
	0x85,0x04, //DD_TH3                                                                                               
	0x87,0x34, //32 b DNDD_low_range X16,  DNDD_low_range_C_weight_center                   
	     
	     
	               //=========intp-ee                                                                         
	0x88,0x04,                                                     
	0x89,0x01,                                        
	0x8a,0x50,//60                                          
	0x8b,0x50,//60                                          
	0x8c,0x07,                                                                
	                
	0x50,0x0c,                                  
	0x5f,0x3c,                                                                                   
	                 
	0x8e,0x02,                                                            
	0x86,0x02,                                                                
	              
	0x51,0x20,                                                              
	0x52,0x08, 
	0x53,0x00,
	      
	      
	              //========= YCP 
	                   //contrast_center                                                                             
	0x77,0x80,//contrast_center                                                                   
	0x78,0x00,//fixed_Cb                                                                          
	0x79,0x00,//fixed_Cr                                                                          
	0x7a,0x00,//luma_offset                                                                                                                                                             
	0x7b,0x40,//hue_cos                                                                           
	0x7c,0x00,//hue_sin                                                                           
	                       
	            //saturation                                                                                  
	0xa0,0x40,//global_saturation
	0xa1,0x40,//luma_contrast                                                                     
	0xa2,0x34,//saturation_Cb//0x34                                                                   
	0xa3,0x32,// 34  saturation_Cr//0x34
	          
	0xa4,0xc8,                                                                
	0xa5,0x02,
	0xa6,0x28,                                                                            
	0xa7,0x02,
	     
	          //skin                                                                                                
	0xa8,0xee,                                                            
	0xa9,0x12,                                                            
	0xaa,0x01,                                                        
	0xab,0x20,                                                    
	0xac,0xf0,                                                        
	0xad,0x10,                                                            
	     
	             //========= ABS
	0xae,0x18,//  black_pixel_target_number 
	0xaf,0x74,
	0xb0,0xe0,    
	0xb1,0x20,
	0xb2,0x6c,
	0xb3,0x40,
	0xb4,0x04,
	     
	               //========= AWB 
	0xbb,0x42,
	0xbc,0x60,
	0xbd,0x50,
	0xbe,0x50,
	     
	0xbf,0x0c,
	0xc0,0x06,
	0xc1,0x60,
	0xc2,0xf1, //f4
	0xc3,0x40,
	0xc4,0x1c,//18
	0xc5,0x56,
	0xc6,0x1d,  

	0xca,0x70,//0x70
	0xcb,0x70,//0x70
	0xcc,0x78,//0x78

	0xcd,0x80,//R_ratio                                      
	0xce,0x80,//G_ratio  , cold_white white                                    
	0xcf,0x80,//B_ratio     

	                   //=========  aecT  
	0x20,0x06,//02
	0x21,0xc0,
	0x22,0x40,   
	0x23,0x88,
	0x24,0x96,
	0x25,0x30,
	0x26,0xd0,
	0x27,0x00,
	     
	     
	    /////23 M  
	0x28,0x02,//AEC_exp_level_1bit11to8   
	0x29,0x58,//AEC_exp_level_1bit7to0    
	0x2a,0x02,//AEC_exp_level_2bit11to8   
	0x2b,0x58,//AEC_exp_level_2bit7to0           
	0x2c,0x02,//AEC_exp_level_3bit11to8   659 - 8FPS,  8ca - 6FPS  //    
	0x2d,0x58,//AEC_exp_level_3bit7to0           
	0x2e,0x02,//AEC_exp_level_4bit11to8   4FPS 
	0x2f,0xee,//AEC_exp_level_4bit7to0   
	    
	0x30,0x20,                        
	0x31,0x00,                     
	0x32,0x1c,
	0x33,0x90,            
	0x34,0x10,  
	     
	0xd0,0x34,//[2]  1  before gamma,  0 after gamma
	     
	0xd1,0x50,//AEC_target_Y//0x50                         
	0xd2,0x61,//f2     
	0xd4,0x4b,//96
	0xd5,0x01,// 10 
	0xd6,0x4b,//antiflicker_step //96                      
	0xd7,0x03,//AEC_exp_time_min //10              
	0xd8,0x02,
	      
	0xdd,0x12,
	     
	         //========= measure window                                      
	0xe0,0x03,                       
	0xe1,0x02,                           
	0xe2,0x27,                               
	0xe3,0x1e,               
	0xe8,0x3b,                   
	0xe9,0x6e,                       
	0xea,0x2c,                   
	0xeb,0x50,                   
	0xec,0x73,       
	      
	              //========= close_frame                                                 
	0xed,0x00,//close_frame_num1 ,can be use to reduce FPS               
	0xee,0x00,//close_frame_num2  
	0xef,0x00,//close_frame_num
	     
	        // page1
	0xf0,0x01,//select page1 
	      
	0x00,0x20,                            
	0x01,0x20,                            
	0x02,0x20,                                  
	0x03,0x20,                          
	0x04,0x78,
	0x05,0x78,                   
	0x06,0x78,                                
	0x07,0x78,                                   
	     
	     
	     
	0x10,0x04,                        
	0x11,0x04,                            
	0x12,0x04,                        
	0x13,0x04,                            
	0x14,0x01,                            
	0x15,0x01,                            
	0x16,0x01,                       
	0x17,0x01,                       
	      
	      
	0x20,0x00,                    
	0x21,0x00,                    
	0x22,0x00,                        
	0x23,0x00,                        
	0x24,0x00,                    
	0x25,0x00,                        
	0x26,0x00,                    
	0x27,0x00,                        
	     
	0x40,0x11,
	     
	       //=============================lscP 
	0x45,0x06,   
	0x46,0x06,           
	0x47,0x05,
	     
	0x48,0x04,  
	0x49,0x03,       
	0x4a,0x03,
	     
	     
	0x62,0xd8,
	0x63,0x24,
	0x64,0x24,
	0x65,0x24,
	0x66,0xd8,
	0x67,0x24,
	    
	0x5a,0x00,
	0x5b,0x00,
	0x5c,0x00,
	0x5d,0x00,
	0x5e,0x00,
	0x5f,0x00,
	     
	     
	           //============================= ccP 
	     
	0x69,0x03,//cc_mode
	     
	           //CC_G
	0x70,0x5d,
	0x71,0xed,
	0x72,0xff,
	0x73,0xe5,
	0x74,0x5f,
	0x75,0xe6,
	      
	         //CC_B
	0x76,0x41,
	0x77,0xef,
	0x78,0xff,
	0x79,0xff,
	0x7a,0x5f,
	0x7b,0xfa,   
	     
	     
	          //============================= AGP
	     
	0x7e,0x00, 
	0x7f,0x30,   //  00    select gamma  
	0x80,0x48, //  c8
	0x81,0x06, 
	0x82,0x08, 
	      
	             
	0x83,0x23, 
	0x84,0x38, 
	0x85,0x4F, 
	0x86,0x61, 
	0x87,0x72, 
	0x88,0x80, 
	0x89,0x8D, 
	0x8a,0xA2, 
	0x8b,0xB2, 
	0x8c,0xC0, 
	0x8d,0xCA, 
	0x8e,0xD3, 
	0x8f,0xDB, 
	0x90,0xE2, 
	0x91,0xED, 
	0x92,0xF6, 
	0x93,0xFD,
	        /*
	0x83,0x13, 
	0x84,0x23, 
	0x85,0x35, 
	0x86,0x44, 
	0x87,0x53, 
	0x88,0x60, 
	0x89,0x6D, 
	0x8a,0x84, 
	0x8b,0x98, 
	0x8c,0xaa, 
	0x8d,0xb8, 
	0x8e,0xc6, 
	0x8f,0xd1, 
	0x90,0xdb, 
	0x91,0xea, 
	0x92,0xf5, 
	0x93,0xFb,
	     */ 
	            //about gamma1 is hex r oct
	0x94,0x04, 
	0x95,0x0E, 
	0x96,0x1B, 
	0x97,0x28, 
	0x98,0x35, 
	0x99,0x41, 
	0x9a,0x4E, 
	0x9b,0x67, 
	0x9c,0x7E, 
	0x9d,0x94, 
	0x9e,0xA7, 
	0x9f,0xBA, 
	0xa0,0xC8, 
	0xa1,0xD4, 
	0xa2,0xE7, 
	0xa3,0xF4, 
	0xa4,0xFA,
	      
	            //========= open functions  
	0xf0,0x00,//set back to page0  
	     
	0x40,0x7e,
	0x41,0x2f,
	0x43,0x40,
	0x44,0xE2,

	0x0f,0x82,
	0x45,0x24,
	0x47,0x20,
	0x4e,0x26,

};
#endif