1 /*****************************************************************************
5 * OV56702NDmipi_Sensor.c
13 * Source code of Sensor driver
16 *------------------------------------------------------------------------------
17 * Upper this line, this part is controlled by CC/CQ. DO NOT MODIFY!!
18 *============================================================================
19 ****************************************************************************/
21 #include <linux/videodev2.h>
22 #include <linux/i2c.h>
23 #include <linux/platform_device.h>
24 #include <linux/delay.h>
25 #include <linux/cdev.h>
26 #include <linux/uaccess.h>
28 #include <asm/atomic.h>
29 #include <linux/xlog.h>
30 #include <asm/system.h>
32 #include "kd_camera_hw.h"
33 #include "kd_imgsensor.h"
34 #include "kd_imgsensor_define.h"
35 #include "kd_imgsensor_errcode.h"
37 #include "ov56702ndmipi_Sensor.h"
39 #include "ov56702ndmipiraw_Camera_Sensor_para.h"
40 #include "ov56702ndmipiraw_CameraCustomized.h"
41 static DEFINE_SPINLOCK(ov56702ndmipiraw_drv_lock
);
42 static int module_id
= 0;
44 #define OV56702ND_DEBUG
45 #ifdef OV56702ND_DEBUG
46 #define OV56702NDDB(fmt, arg...) xlog_printk(ANDROID_LOG_DEBUG, "[OV56702NDRaw] ", fmt, ##arg)
48 #define OV56702NDDB(fmt, arg...)
52 kal_uint32 OV56702ND_FeatureControl_PERIOD_PixelNum
=OV56702ND_PV_PERIOD_PIXEL_NUMS
;
53 kal_uint32 OV56702ND_FeatureControl_PERIOD_LineNum
=OV56702ND_PV_PERIOD_LINE_NUMS
;
55 UINT16 OV56702ND_VIDEO_MODE_TARGET_FPS
= 30;
57 MSDK_SCENARIO_ID_ENUM OV56702NDCurrentScenarioId
= MSDK_SCENARIO_ID_CAMERA_PREVIEW
;
58 MSDK_SENSOR_CONFIG_STRUCT OV56702NDSensorConfigData
;
59 static OV56702ND_PARA_STRUCT OV56702ND
;
60 kal_uint32 OV56702ND_FAC_SENSOR_REG
;
63 SENSOR_REG_STRUCT OV56702NDSensorCCT
[]=CAMERA_SENSOR_CCT_DEFAULT_VALUE
;
64 SENSOR_REG_STRUCT OV56702NDSensorReg
[ENGINEER_END
]=CAMERA_SENSOR_REG_DEFAULT_VALUE
;
67 #define OV56702ND_TEST_PATTERN_CHECKSUM 0xca3667da //0x5d8082f0 //0x75bef806 //0xa2230d9f //0xf5e2f1ce
68 kal_bool OV56702ND_During_testpattern
= KAL_FALSE
;
70 extern int iReadReg(u16 a_u2Addr
, u8
* a_puBuff
, u16 i2cId
);
71 extern int iWriteReg(u16 a_u2Addr
, u32 a_u4Data
, u32 a_u4Bytes
, u16 i2cId
);
73 #define OV56702ND_write_cmos_sensor(addr, para) iWriteReg((u16) addr , (u32) para , 1, OV56702NDMIPI_WRITE_ID)
75 kal_uint16
OV56702ND_read_cmos_sensor(kal_uint32 addr
)
77 kal_uint16 get_byte
=0;
78 iReadReg((u16
) addr
,(u8
*)&get_byte
,OV56702NDMIPI_WRITE_ID
);
83 void OV56702ND_Init_Para(void)
86 spin_lock(&ov56702ndmipiraw_drv_lock
);
87 OV56702ND
.sensorMode
= SENSOR_MODE_INIT
;
88 OV56702ND
.OV56702NDAutoFlickerMode
= KAL_FALSE
;
89 OV56702ND
.OV56702NDVideoMode
= KAL_FALSE
;
90 OV56702ND
.DummyLines
= 0;
91 OV56702ND
.DummyPixels
= 0;
92 OV56702ND
.pvPclk
= (10285);
93 OV56702ND
.videoPclk
= (10285);
94 OV56702ND
.capPclk
= (10285);
96 OV56702ND
.shutter
= 0x4C00;
97 OV56702ND
.ispBaseGain
= BASEGAIN
;
98 OV56702ND
.sensorGlobalGain
= 0x0200;
99 spin_unlock(&ov56702ndmipiraw_drv_lock
);
102 #define RG_Ratio_Typical 264
103 #define BG_Ratio_Typical 236
106 int flag
; // bit[7]: info, bit[6]:wb
107 int module_integrator_id
;
110 int production_month
;
117 static void otp_i2c_write( uint32_t addr
, kal_uint16 data
)
119 OV56702ND_write_cmos_sensor(addr
, data
);
122 static kal_uint16
otp_i2c_read(uint32_t addr
)
125 return OV56702ND_read_cmos_sensor(addr
);
130 // bit[7]: 0 no otp info, 1 valid otp info
131 // bit[6]: 0 no otp wb, 1 valib otp wb
132 static int read_otp(struct otp_struct
*otp_ptr
)
134 int otp_flag
, addr
, temp
, i
;
135 //set 0x5002[3] to “0”
138 temp1
= otp_i2c_read(0x5002);
139 otp_i2c_write(0x5002, (0x00 & 0x08) | (temp1
& (~0x08)));
141 // read OTP into buffer
142 otp_i2c_write(0x3d84, 0xC0);
143 otp_i2c_write(0x3d88, 0x70); // OTP start address
144 otp_i2c_write(0x3d89, 0x10);
145 otp_i2c_write(0x3d8A, 0x70); // OTP end address
146 otp_i2c_write(0x3d8B, 0x29);
147 otp_i2c_write(0x3d81, 0x01); // load otp into buffer
151 otp_flag
= otp_i2c_read(0x7010);
154 if((otp_flag
& 0xc0) == 0x40) {
155 addr
= 0x7011; // base address of info group 1
156 } else if((otp_flag
& 0x30) == 0x10) {
157 addr
= 0x7016; // base address of info group 2
158 }else if((otp_flag
& 0x0c) == 0x04) {
159 addr
= 0x701b; // base address of info group 3
163 (*otp_ptr
).flag
= 0x80; // valid base info in OTP
164 (*otp_ptr
).module_integrator_id
= otp_i2c_read( addr
);
165 (*otp_ptr
).lens_id
= otp_i2c_read( addr
+ 1);
166 (*otp_ptr
).production_year
= otp_i2c_read( addr
+ 2);
167 (*otp_ptr
).production_month
= otp_i2c_read( addr
+ 3);
168 (*otp_ptr
).production_day
= otp_i2c_read( addr
+ 4);
170 (*otp_ptr
).flag
= 0x00; // not info in OTP
171 (*otp_ptr
).module_integrator_id
= 0;
172 (*otp_ptr
).lens_id
= 0;
173 (*otp_ptr
).production_year
= 0;
174 (*otp_ptr
).production_month
= 0;
175 (*otp_ptr
).production_day
= 0;
178 module_id
= (*otp_ptr
).module_integrator_id
;
179 // OTP WB Calibration
180 otp_flag
= otp_i2c_read(0x7020);
183 if((otp_flag
& 0xc0) == 0x40) {
184 addr
= 0x7021; // base address of WB Calibration group 1
185 }else if((otp_flag
& 0x30) == 0x10) {
186 addr
= 0x7024; // base address of WB Calibration group 2
187 }else if((otp_flag
& 0x0c) == 0x04) {
188 addr
= 0x7027; // base address of WB Calibration group 3
192 (*otp_ptr
).flag
|= 0x40;
193 temp
= otp_i2c_read( addr
+ 2);
194 (*otp_ptr
).rg_ratio
= (otp_i2c_read(addr
)<<2) + ((temp
>>6) & 0x03);
195 (*otp_ptr
).bg_ratio
= (otp_i2c_read( addr
+ 1)<<2) + ((temp
>>4) & 0x03);
197 (*otp_ptr
).rg_ratio
= 0;
198 (*otp_ptr
).bg_ratio
= 0;
201 for(i
=0x7010;i
<=0x7029;i
++) {
202 otp_i2c_write(i
,0); // clear OTP buffer, recommended use continuous write to accelarate
205 //set 0x5002[3] to “1”
206 temp1
= otp_i2c_read(0x5002);
207 otp_i2c_write(0x5002, (0x02 & 0x08) | (temp1
& (~0x08)));
208 return (*otp_ptr
).flag
;
211 static int apply_otp(struct otp_struct
*otp_ptr
)
213 int rg
, bg
, R_gain
, G_gain
, B_gain
, Base_gain
;
215 // apply OTP WB Calibration
216 if ((*otp_ptr
).flag
& 0x40) {
217 rg
= (*otp_ptr
). rg_ratio
;
218 bg
= (*otp_ptr
).bg_ratio
;
220 R_gain
= (RG_Ratio_Typical
*1000) / rg
;
221 B_gain
= (BG_Ratio_Typical
*1000) / bg
;
224 if (R_gain
< 1000 || B_gain
< 1000)
236 R_gain
= 0x400 * R_gain
/ (Base_gain
);
237 B_gain
= 0x400 * B_gain
/ (Base_gain
);
238 G_gain
= 0x400 * G_gain
/ (Base_gain
);
239 // update sensor WB gain
241 otp_i2c_write(0x5032, R_gain
>>8);
242 otp_i2c_write(0x5033, R_gain
& 0x00ff);
245 otp_i2c_write(0x5034, G_gain
>>8);
246 otp_i2c_write(0x5035, G_gain
& 0x00ff);
249 otp_i2c_write(0x5036, B_gain
>>8);
250 otp_i2c_write(0x5037, B_gain
& 0x00ff);
253 return (*otp_ptr
).flag
;
256 void ov56702nd_otp_config()
258 struct otp_struct otp_info
;
261 apply_otp(&otp_info
) ;
263 kal_uint32
GetOV56702NDLineLength(void)
265 kal_uint32 OV56702ND_line_length
= 0;
266 if ( SENSOR_MODE_PREVIEW
== OV56702ND
.sensorMode
)
268 OV56702ND_line_length
= OV56702ND_PV_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
;
270 else if( SENSOR_MODE_VIDEO
== OV56702ND
.sensorMode
)
272 OV56702ND_line_length
= OV56702ND_VIDEO_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
;
276 OV56702ND_line_length
= OV56702ND_FULL_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
;
279 return OV56702ND_line_length
;
284 kal_uint32
GetOV56702NDFrameLength(void)
286 kal_uint32 OV56702ND_frame_length
= 0;
288 if ( SENSOR_MODE_PREVIEW
== OV56702ND
.sensorMode
)
290 OV56702ND_frame_length
= OV56702ND_PV_PERIOD_LINE_NUMS
+ OV56702ND
.DummyLines
;
292 else if( SENSOR_MODE_VIDEO
== OV56702ND
.sensorMode
)
294 OV56702ND_frame_length
= OV56702ND_VIDEO_PERIOD_LINE_NUMS
+ OV56702ND
.DummyLines
;
298 OV56702ND_frame_length
= OV56702ND_FULL_PERIOD_LINE_NUMS
+ OV56702ND
.DummyLines
;
301 return OV56702ND_frame_length
;
305 kal_uint32
OV56702ND_CalcExtra_For_ShutterMargin(kal_uint32 shutter_value
,kal_uint32 shutterLimitation
)
307 kal_uint32 extra_lines
= 0;
310 if (shutter_value
<4 ){
315 if (shutter_value
> shutterLimitation
)
317 extra_lines
= shutter_value
- shutterLimitation
;
327 kal_uint32
OV56702ND_CalcFrameLength_For_AutoFlicker(void)
330 kal_uint32 AutoFlicker_min_framelength
= 0;
332 switch(OV56702NDCurrentScenarioId
)
334 case MSDK_SCENARIO_ID_CAMERA_ZSD
:
335 case MSDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG
:
336 AutoFlicker_min_framelength
= (OV56702ND
.capPclk
*10000) /(OV56702ND_FULL_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
)/OV56702ND_AUTOFLICKER_OFFSET_25
*10 ;
338 case MSDK_SCENARIO_ID_VIDEO_PREVIEW
:
339 if(OV56702ND_VIDEO_MODE_TARGET_FPS
==30)
341 AutoFlicker_min_framelength
= (OV56702ND
.videoPclk
*10000) /(OV56702ND_VIDEO_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
)/OV56702ND_AUTOFLICKER_OFFSET_30
*10 ;
343 else if(OV56702ND_VIDEO_MODE_TARGET_FPS
==15)
345 AutoFlicker_min_framelength
= (OV56702ND
.videoPclk
*10000) /(OV56702ND_VIDEO_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
)/OV56702ND_AUTOFLICKER_OFFSET_15
*10 ;
349 AutoFlicker_min_framelength
= OV56702ND_VIDEO_PERIOD_LINE_NUMS
+ OV56702ND
.DummyLines
;
353 case MSDK_SCENARIO_ID_CAMERA_PREVIEW
:
355 AutoFlicker_min_framelength
= (OV56702ND
.pvPclk
*10000) /(OV56702ND_PV_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
)/OV56702ND_AUTOFLICKER_OFFSET_30
*10 ;
359 OV56702NDDB("AutoFlicker_min_framelength =%d,OV56702NDCurrentScenarioId =%d\n", AutoFlicker_min_framelength
,OV56702NDCurrentScenarioId
);
361 return AutoFlicker_min_framelength
;
366 void OV56702ND_write_shutter(kal_uint32 shutter
)
368 kal_uint32 min_framelength
= OV56702ND_PV_PERIOD_PIXEL_NUMS
, max_shutter
=0;
369 kal_uint32 line_length
= 0;
370 kal_uint32 frame_length
= 0;
374 //shutter = 0x7fc; //issue
377 line_length
= GetOV56702NDLineLength();
378 frame_length
= GetOV56702NDFrameLength();
380 max_shutter
= frame_length
-OV56702ND_SHUTTER_MARGIN
;
382 frame_length
= frame_length
+ OV56702ND_CalcExtra_For_ShutterMargin(shutter
,max_shutter
);
386 if(OV56702ND
.OV56702NDAutoFlickerMode
== KAL_TRUE
)
388 min_framelength
= OV56702ND_CalcFrameLength_For_AutoFlicker();
390 if(frame_length
< min_framelength
)
391 frame_length
= min_framelength
;
395 spin_lock_irqsave(&ov56702ndmipiraw_drv_lock
,flags
);
396 OV56702ND_FeatureControl_PERIOD_PixelNum
= line_length
;
397 OV56702ND_FeatureControl_PERIOD_LineNum
= frame_length
;
398 spin_unlock_irqrestore(&ov56702ndmipiraw_drv_lock
,flags
);
400 //Set total frame length //VTS
401 OV56702ND_write_cmos_sensor(0x380e, (frame_length
>> 8) & 0xFF);
402 OV56702ND_write_cmos_sensor(0x380f, frame_length
& 0xFF);
405 OV56702ND_write_cmos_sensor(0x3500, (shutter
>>12) & 0x0F);
406 OV56702ND_write_cmos_sensor(0x3501, (shutter
>>4) & 0xFF);
407 OV56702ND_write_cmos_sensor(0x3502, (shutter
<<4) & 0xF0); /* Don't use the fraction part. */
409 OV56702NDDB("ov56702nd write shutter=%x, line_length=%x, frame_length=%x\n", shutter
, line_length
, frame_length
);
414 static kal_uint16
OV56702NDReg2Gain(const kal_uint16 iReg
)
418 iGain
= iReg
*BASEGAIN
/OV56702ND_GAIN_BASE
;
423 static kal_uint16
OV56702NDGain2Reg(const kal_uint16 Gain
)
425 kal_uint32 iReg
= 0x0000;
426 kal_uint32 TempGain
= BASEGAIN
;
430 if(TempGain
< BASEGAIN
){
432 //OV56702NDDB("###ov56702nd write gain underflow### Gain =%x\n", Gain);
434 if(TempGain
> 16*BASEGAIN
){
435 TempGain
= 16*BASEGAIN
;
436 //OV56702NDDB("###ov56702nd write gain overflow### Gain =%x\n", Gain);
439 iReg
= (TempGain
*OV56702ND_GAIN_BASE
)/BASEGAIN
;
441 //iReg = ((TempGain /BASEGAIN)<<7)+((TempGain % BASEGAIN)<<7/BASEGAIN);
442 iReg
= iReg
& 0xFFFF;
444 //OV56702NDDB("###ov56702nd write Reg ### iReg =%x\n", iReg);
450 void write_OV56702ND_gain(kal_uint16 gain
)
453 kal_uint8 ChangeFlag
=0x01;
455 kal_uint16 read_gain
;
457 iGain
=(gain
/ OV56702ND_GAIN_BASE
);
474 OV56702ND_write_cmos_sensor(0x301d, 0xf0);
475 OV56702ND_write_cmos_sensor(0x3209, 0x00);
476 OV56702ND_write_cmos_sensor(0x320a, 0x01);
479 //group 0:delay 0x366a for one frame,then active with gain
480 OV56702ND_write_cmos_sensor(0x3208, 0x00);
481 OV56702ND_write_cmos_sensor(0x366a, ChangeFlag
);
482 OV56702ND_write_cmos_sensor(0x3208, 0x10);
484 //group 1:all other registers( gain)
485 OV56702ND_write_cmos_sensor(0x3208, 0x01);
486 OV56702ND_write_cmos_sensor(0x3508,(gain
>>8));
487 OV56702ND_write_cmos_sensor(0x3509,(gain
&0xff));
489 OV56702ND_write_cmos_sensor(0x3208, 0x11);
492 OV56702ND_write_cmos_sensor(0x320B, 0x15);
493 OV56702ND_write_cmos_sensor(0x3208, 0xA1);
495 //read_gain=(((OV56702ND_read_cmos_sensor(0x3508)&0x1F) << 8) | OV56702ND_read_cmos_sensor(0x3509));
496 //OV56702NDDB("[OV56702ND_SetGain]0x3508|0x3509=0x%x \n",read_gain);
497 //OV56702NDDB("[OV56702ND_SetGain]0x366a=%d \n",(OV56702ND_read_cmos_sensor(0x366a)));
503 void OV56702ND_SetGain(UINT16 iGain
)
506 spin_lock_irqsave(&ov56702ndmipiraw_drv_lock
,flags
);
508 OV56702NDDB("OV56702ND_SetGain iGain = %d :\n ",iGain
);
510 OV56702ND
.realGain
= iGain
;
511 OV56702ND
.sensorGlobalGain
= OV56702NDGain2Reg(iGain
);
512 spin_unlock_irqrestore(&ov56702ndmipiraw_drv_lock
,flags
);
514 write_OV56702ND_gain(OV56702ND
.sensorGlobalGain
);
515 OV56702NDDB(" [OV56702ND_SetGain]OV56702ND.sensorGlobalGain=0x%x,OV56702ND.realGain =%d",OV56702ND
.sensorGlobalGain
,
519 //OV56702ND_write_cmos_sensor(0x4d12,0x01);
520 //OV56702NDDB("Temperature read_reg 0x4d13 =%x \n",OV56702ND_read_cmos_sensor(0x4d13));
523 kal_uint16
read_OV56702ND_gain(void)
525 kal_uint16 read_gain
=0;
527 read_gain
=(((OV56702ND_read_cmos_sensor(0x3508)&0x1F) << 8) | OV56702ND_read_cmos_sensor(0x3509));
529 spin_lock(&ov56702ndmipiraw_drv_lock
);
530 OV56702ND
.sensorGlobalGain
= read_gain
;
531 OV56702ND
.realGain
= OV56702NDReg2Gain(OV56702ND
.sensorGlobalGain
);
532 spin_unlock(&ov56702ndmipiraw_drv_lock
);
534 OV56702NDDB("OV56702ND.sensorGlobalGain=0x%x,OV56702ND.realGain=%d\n",OV56702ND
.sensorGlobalGain
,OV56702ND
.realGain
);
536 return OV56702ND
.sensorGlobalGain
;
541 void OV56702ND_camera_para_to_sensor(void)
544 for(i
=0; 0xFFFFFFFF!=OV56702NDSensorReg
[i
].Addr
; i
++)
546 OV56702ND_write_cmos_sensor(OV56702NDSensorReg
[i
].Addr
, OV56702NDSensorReg
[i
].Para
);
548 for(i
=ENGINEER_START_ADDR
; 0xFFFFFFFF!=OV56702NDSensorReg
[i
].Addr
; i
++)
550 OV56702ND_write_cmos_sensor(OV56702NDSensorReg
[i
].Addr
, OV56702NDSensorReg
[i
].Para
);
552 for(i
=FACTORY_START_ADDR
; i
<FACTORY_END_ADDR
; i
++)
554 OV56702ND_write_cmos_sensor(OV56702NDSensorCCT
[i
].Addr
, OV56702NDSensorCCT
[i
].Para
);
558 void OV56702ND_sensor_to_camera_para(void)
560 kal_uint32 i
, temp_data
;
561 for(i
=0; 0xFFFFFFFF!=OV56702NDSensorReg
[i
].Addr
; i
++)
563 temp_data
= OV56702ND_read_cmos_sensor(OV56702NDSensorReg
[i
].Addr
);
564 spin_lock(&ov56702ndmipiraw_drv_lock
);
565 OV56702NDSensorReg
[i
].Para
=temp_data
;
566 spin_unlock(&ov56702ndmipiraw_drv_lock
);
568 for(i
=ENGINEER_START_ADDR
; 0xFFFFFFFF!=OV56702NDSensorReg
[i
].Addr
; i
++)
570 temp_data
= OV56702ND_read_cmos_sensor(OV56702NDSensorReg
[i
].Addr
);
571 spin_lock(&ov56702ndmipiraw_drv_lock
);
572 OV56702NDSensorReg
[i
].Para
= temp_data
;
573 spin_unlock(&ov56702ndmipiraw_drv_lock
);
577 kal_int32
OV56702ND_get_sensor_group_count(void)
579 return GROUP_TOTAL_NUMS
;
582 void OV56702ND_get_sensor_group_info(kal_uint16 group_idx
, kal_int8
* group_name_ptr
, kal_int32
* item_count_ptr
)
587 sprintf((char *)group_name_ptr
, "CCT");
591 sprintf((char *)group_name_ptr
, "CMMCLK Current");
594 case FRAME_RATE_LIMITATION
:
595 sprintf((char *)group_name_ptr
, "Frame Rate Limitation");
598 case REGISTER_EDITOR
:
599 sprintf((char *)group_name_ptr
, "Register Editor");
607 void OV56702ND_get_sensor_item_info(kal_uint16 group_idx
,kal_uint16 item_idx
, MSDK_SENSOR_ITEM_INFO_STRUCT
* info_ptr
)
609 kal_int16 temp_reg
=0;
610 kal_uint16 temp_gain
=0, temp_addr
=0, temp_para
=0;
618 sprintf((char *)info_ptr
->ItemNamePtr
,"Pregain-R");
619 temp_addr
= PRE_GAIN_R_INDEX
;
622 sprintf((char *)info_ptr
->ItemNamePtr
,"Pregain-Gr");
623 temp_addr
= PRE_GAIN_Gr_INDEX
;
626 sprintf((char *)info_ptr
->ItemNamePtr
,"Pregain-Gb");
627 temp_addr
= PRE_GAIN_Gb_INDEX
;
630 sprintf((char *)info_ptr
->ItemNamePtr
,"Pregain-B");
631 temp_addr
= PRE_GAIN_B_INDEX
;
634 sprintf((char *)info_ptr
->ItemNamePtr
,"SENSOR_BASEGAIN");
635 temp_addr
= SENSOR_BASEGAIN
;
641 temp_para
= OV56702NDSensorCCT
[temp_addr
].Para
;
642 //temp_gain= (temp_para/OV56702ND.sensorBaseGain) * 1000;
644 info_ptr
->ItemValue
=temp_gain
;
645 info_ptr
->IsTrueFalse
=KAL_FALSE
;
646 info_ptr
->IsReadOnly
=KAL_FALSE
;
647 info_ptr
->IsNeedRestart
=KAL_FALSE
;
648 info_ptr
->Min
= OV56702ND_MIN_ANALOG_GAIN
* 1000;
649 info_ptr
->Max
= OV56702ND_MAX_ANALOG_GAIN
* 1000;
655 sprintf((char *)info_ptr
->ItemNamePtr
,"Drv Cur[2,4,6,8]mA");
657 //temp_reg=MT9P017SensorReg[CMMCLK_CURRENT_INDEX].Para;
658 temp_reg
= ISP_DRIVING_2MA
;
659 if(temp_reg
==ISP_DRIVING_2MA
)
661 info_ptr
->ItemValue
=2;
663 else if(temp_reg
==ISP_DRIVING_4MA
)
665 info_ptr
->ItemValue
=4;
667 else if(temp_reg
==ISP_DRIVING_6MA
)
669 info_ptr
->ItemValue
=6;
671 else if(temp_reg
==ISP_DRIVING_8MA
)
673 info_ptr
->ItemValue
=8;
676 info_ptr
->IsTrueFalse
=KAL_FALSE
;
677 info_ptr
->IsReadOnly
=KAL_FALSE
;
678 info_ptr
->IsNeedRestart
=KAL_TRUE
;
686 case FRAME_RATE_LIMITATION
:
690 sprintf((char *)info_ptr
->ItemNamePtr
,"Max Exposure Lines");
691 info_ptr
->ItemValue
= 111;
692 info_ptr
->IsTrueFalse
=KAL_FALSE
;
693 info_ptr
->IsReadOnly
=KAL_TRUE
;
694 info_ptr
->IsNeedRestart
=KAL_FALSE
;
699 sprintf((char *)info_ptr
->ItemNamePtr
,"Min Frame Rate");
700 info_ptr
->ItemValue
=12;
701 info_ptr
->IsTrueFalse
=KAL_FALSE
;
702 info_ptr
->IsReadOnly
=KAL_TRUE
;
703 info_ptr
->IsNeedRestart
=KAL_FALSE
;
711 case REGISTER_EDITOR
:
715 sprintf((char *)info_ptr
->ItemNamePtr
,"REG Addr.");
716 info_ptr
->ItemValue
=0;
717 info_ptr
->IsTrueFalse
=KAL_FALSE
;
718 info_ptr
->IsReadOnly
=KAL_FALSE
;
719 info_ptr
->IsNeedRestart
=KAL_FALSE
;
721 info_ptr
->Max
=0xFFFF;
724 sprintf((char *)info_ptr
->ItemNamePtr
,"REG Value");
725 info_ptr
->ItemValue
=0;
726 info_ptr
->IsTrueFalse
=KAL_FALSE
;
727 info_ptr
->IsReadOnly
=KAL_FALSE
;
728 info_ptr
->IsNeedRestart
=KAL_FALSE
;
730 info_ptr
->Max
=0xFFFF;
743 kal_bool
OV56702ND_set_sensor_item_info(kal_uint16 group_idx
, kal_uint16 item_idx
, kal_int32 ItemValue
)
745 kal_uint16 temp_gain
=0,temp_addr
=0, temp_para
=0;
753 temp_addr
= PRE_GAIN_R_INDEX
;
756 temp_addr
= PRE_GAIN_Gr_INDEX
;
759 temp_addr
= PRE_GAIN_Gb_INDEX
;
762 temp_addr
= PRE_GAIN_B_INDEX
;
765 temp_addr
= SENSOR_BASEGAIN
;
771 temp_gain
=((ItemValue
*BASEGAIN
+500)/1000); //+500:get closed integer value
773 if(temp_gain
>=1*BASEGAIN
&& temp_gain
<=16*BASEGAIN
)
775 // temp_para=(temp_gain * OV56702ND.sensorBaseGain + BASEGAIN/2)/BASEGAIN;
780 spin_lock(&ov56702ndmipiraw_drv_lock
);
781 OV56702NDSensorCCT
[temp_addr
].Para
= temp_para
;
782 spin_unlock(&ov56702ndmipiraw_drv_lock
);
783 OV56702ND_write_cmos_sensor(OV56702NDSensorCCT
[temp_addr
].Addr
,temp_para
);
790 //no need to apply this item for driving current
796 case FRAME_RATE_LIMITATION
:
799 case REGISTER_EDITOR
:
803 spin_lock(&ov56702ndmipiraw_drv_lock
);
804 OV56702ND_FAC_SENSOR_REG
=ItemValue
;
805 spin_unlock(&ov56702ndmipiraw_drv_lock
);
808 OV56702ND_write_cmos_sensor(OV56702ND_FAC_SENSOR_REG
,ItemValue
);
822 static void OV56702ND_SetDummy( const kal_uint32 iPixels
, const kal_uint32 iLines
)
824 kal_uint32 line_length
= 0;
825 kal_uint32 frame_length
= 0;
827 if ( SENSOR_MODE_PREVIEW
== OV56702ND
.sensorMode
)
829 line_length
= OV56702ND_PV_PERIOD_PIXEL_NUMS
+ iPixels
;
830 frame_length
= OV56702ND_PV_PERIOD_LINE_NUMS
+ iLines
;
832 else if( SENSOR_MODE_VIDEO
== OV56702ND
.sensorMode
)
834 line_length
= OV56702ND_VIDEO_PERIOD_PIXEL_NUMS
+ iPixels
;
835 frame_length
= OV56702ND_VIDEO_PERIOD_LINE_NUMS
+ iLines
;
839 line_length
= OV56702ND_FULL_PERIOD_PIXEL_NUMS
+ iPixels
;
840 frame_length
= OV56702ND_FULL_PERIOD_LINE_NUMS
+ iLines
;
843 spin_lock(&ov56702ndmipiraw_drv_lock
);
844 OV56702ND_FeatureControl_PERIOD_PixelNum
= line_length
;
845 OV56702ND_FeatureControl_PERIOD_LineNum
= frame_length
;
846 spin_unlock(&ov56702ndmipiraw_drv_lock
);
848 //Set total frame length
849 OV56702ND_write_cmos_sensor(0x380e, (frame_length
>> 8) & 0xFF);
850 OV56702ND_write_cmos_sensor(0x380f, frame_length
& 0xFF);
851 //Set total line length
852 OV56702ND_write_cmos_sensor(0x380c, (line_length
>> 8) & 0xFF);
853 OV56702ND_write_cmos_sensor(0x380d, line_length
& 0xFF);
858 void OV56702NDPreviewSetting(void)
860 OV56702NDDB(" OV56702NDPreviewSetting_2lane enter\n");
864 //@@PV_Quarter_size_30fps_800Mbps/lane
867 //;;PCLK=HTS*VTS*fps=0x68c*0x7fd*30=1676*2045*30=102.85M
869 OV56702ND_write_cmos_sensor(0x0100, 0x00); //
871 OV56702ND_write_cmos_sensor(0x3501, 0x3d); //
872 OV56702ND_write_cmos_sensor(0x366e, 0x08); //
873 OV56702ND_write_cmos_sensor(0x370b, 0x1b); //
874 OV56702ND_write_cmos_sensor(0x3808, 0x05); //
875 OV56702ND_write_cmos_sensor(0x3809, 0x10); //
876 OV56702ND_write_cmos_sensor(0x380a, 0x03); //
877 OV56702ND_write_cmos_sensor(0x380b, 0xc0); //
878 OV56702ND_write_cmos_sensor(0x380c, 0x06); //
879 OV56702ND_write_cmos_sensor(0x380d, 0x8c); //
880 OV56702ND_write_cmos_sensor(0x380e, 0x07); //;03
881 OV56702ND_write_cmos_sensor(0x380f, 0xfd); //;e0
882 OV56702ND_write_cmos_sensor(0x3814, 0x03); //
883 OV56702ND_write_cmos_sensor(0x3820, 0x90); //
884 OV56702ND_write_cmos_sensor(0x3821, 0x47); //
885 OV56702ND_write_cmos_sensor(0x382a, 0x03); //
886 OV56702ND_write_cmos_sensor(0x4009, 0x05); //
887 OV56702ND_write_cmos_sensor(0x4502, 0x48); //
888 OV56702ND_write_cmos_sensor(0x4508, 0x55); //
889 OV56702ND_write_cmos_sensor(0x4509, 0x55); //
890 OV56702ND_write_cmos_sensor(0x4600, 0x00); //
891 OV56702ND_write_cmos_sensor(0x4601, 0x81); //
892 OV56702ND_write_cmos_sensor(0x4017, 0x10); //; threshold = 4LSB for Binning sum format.
893 OV56702ND_write_cmos_sensor(0x400a, 0x02); //;
894 OV56702ND_write_cmos_sensor(0x400b, 0x00); //;
896 OV56702ND_write_cmos_sensor(0x0100, 0x01); //
899 //@@PV_Quarter_size_30fps_800Mbps/lane_1296x972
902 //;;PCLK=HTS*VTS*fps=0x68c*0x7fd*30=1676*2045*30=102.85M
904 OV56702ND_write_cmos_sensor(0x0100, 0x00); //
906 OV56702ND_write_cmos_sensor(0x3501, 0x73); //
907 OV56702ND_write_cmos_sensor(0x3502, 0x00); //
908 OV56702ND_write_cmos_sensor(0x3508, 0x01); //
909 OV56702ND_write_cmos_sensor(0x3509, 0x80); //
910 OV56702ND_write_cmos_sensor(0x366e, 0x08); //
911 OV56702ND_write_cmos_sensor(0x370b, 0x1b); //
912 OV56702ND_write_cmos_sensor(0x3808, 0x05); //
913 OV56702ND_write_cmos_sensor(0x3809, 0x10); //
914 OV56702ND_write_cmos_sensor(0x380a, 0x03); //
915 OV56702ND_write_cmos_sensor(0x380b, 0xcc); //;c0
916 OV56702ND_write_cmos_sensor(0x380c, 0x06); //
917 OV56702ND_write_cmos_sensor(0x380d, 0x8c); //
918 OV56702ND_write_cmos_sensor(0x380e, 0x07); //;03
919 OV56702ND_write_cmos_sensor(0x380f, 0xfd); //;e0
920 OV56702ND_write_cmos_sensor(0x3814, 0x03); //
921 OV56702ND_write_cmos_sensor(0x3820, 0x90); //
922 OV56702ND_write_cmos_sensor(0x3821, 0x47); //
923 OV56702ND_write_cmos_sensor(0x382a, 0x03); //
924 OV56702ND_write_cmos_sensor(0x3845, 0x02); //
925 OV56702ND_write_cmos_sensor(0x4009, 0x05); //
926 OV56702ND_write_cmos_sensor(0x4502, 0x48); //
927 OV56702ND_write_cmos_sensor(0x4508, 0x55); //
928 OV56702ND_write_cmos_sensor(0x4509, 0x55); //
929 OV56702ND_write_cmos_sensor(0x4600, 0x00); //
930 OV56702ND_write_cmos_sensor(0x4601, 0x81); //
931 OV56702ND_write_cmos_sensor(0x4017, 0x10); //; threshold = 4LSB for Binning
932 OV56702ND_write_cmos_sensor(0x400a, 0x02); //;
933 OV56702ND_write_cmos_sensor(0x400b, 0x00); //;
935 OV56702ND_write_cmos_sensor(0x0100, 0x01); //
939 void OV56702NDVideoSetting(void)
941 OV56702NDDB(" OV56702NDvideoSetting_2lane enter:video/preview sync\n");
943 OV56702NDPreviewSetting();
948 void OV56702NDCaptureSetting(void)
950 OV56702NDDB("OV56702NDCaptureSetting_2lane enter\n");
952 OV56702ND_write_cmos_sensor(0x0100, 0x00);
954 OV56702ND_write_cmos_sensor(0x3501, 0x5f); //long exposure
955 OV56702ND_write_cmos_sensor(0x3502, 0xd0); //long exposure
957 OV56702ND_write_cmos_sensor(0x3508, 0x03); //gain
958 OV56702ND_write_cmos_sensor(0x3509, 0x00); //gain
960 OV56702ND_write_cmos_sensor(0x366e, 0x10);
961 OV56702ND_write_cmos_sensor(0x370b, 0x1b);
962 OV56702ND_write_cmos_sensor(0x3808, 0x0a);
963 OV56702ND_write_cmos_sensor(0x3809, 0x20);
964 OV56702ND_write_cmos_sensor(0x380a, 0x07);
965 OV56702ND_write_cmos_sensor(0x380b, 0x98);
966 OV56702ND_write_cmos_sensor(0x380c, 0x07); //;06
967 OV56702ND_write_cmos_sensor(0x380d, 0xdc); //;8c
968 OV56702ND_write_cmos_sensor(0x380e, 0x07);
969 OV56702ND_write_cmos_sensor(0x380f, 0xfd);
970 OV56702ND_write_cmos_sensor(0x3814, 0x01);
971 OV56702ND_write_cmos_sensor(0x3820, 0x80);
972 OV56702ND_write_cmos_sensor(0x3821, 0x46);
973 OV56702ND_write_cmos_sensor(0x382a, 0x01);
975 OV56702ND_write_cmos_sensor(0x3845, 0x00); //v_offset for auto size mode
977 OV56702ND_write_cmos_sensor(0x4009, 0x0d);
978 OV56702ND_write_cmos_sensor(0x4502, 0x40);
979 OV56702ND_write_cmos_sensor(0x4508, 0xaa);
980 OV56702ND_write_cmos_sensor(0x4509, 0xaa);
981 OV56702ND_write_cmos_sensor(0x4600, 0x01);
982 OV56702ND_write_cmos_sensor(0x4601, 0x03);
983 OV56702ND_write_cmos_sensor(0x4017, 0x08); //threshold= 2LSB for full size
984 OV56702ND_write_cmos_sensor(0x400a, 0x02); //
985 OV56702ND_write_cmos_sensor(0x400b, 0x00); //
987 OV56702ND_write_cmos_sensor(0x0100, 0x01);
992 static void OV56702ND_Sensor_Init(void)
994 OV56702NDDB("OV56702ND_Sensor_Init_2lane enter\n");
996 OV56702ND_write_cmos_sensor(0x0103,0x01);// ; software reset
998 OV56702ND_write_cmos_sensor(0x0100, 0x00);// ; software standby
999 OV56702ND_write_cmos_sensor(0x0100, 0x00);
1000 OV56702ND_write_cmos_sensor(0x0300, 0x04);
1001 OV56702ND_write_cmos_sensor(0x0301, 0x00);
1002 OV56702ND_write_cmos_sensor(0x0302, 0x64); //;78
1003 OV56702ND_write_cmos_sensor(0x0303, 0x00);
1004 OV56702ND_write_cmos_sensor(0x0304, 0x03);
1005 OV56702ND_write_cmos_sensor(0x0305, 0x01);
1006 OV56702ND_write_cmos_sensor(0x0306, 0x01);
1007 OV56702ND_write_cmos_sensor(0x030a, 0x00);
1008 OV56702ND_write_cmos_sensor(0x030b, 0x00);
1009 OV56702ND_write_cmos_sensor(0x030c, 0x00);
1010 OV56702ND_write_cmos_sensor(0x030d, 0x1e);
1011 OV56702ND_write_cmos_sensor(0x030e, 0x00);
1012 OV56702ND_write_cmos_sensor(0x030f, 0x06);
1013 OV56702ND_write_cmos_sensor(0x0312, 0x01);
1014 OV56702ND_write_cmos_sensor(0x3000, 0x00);
1015 OV56702ND_write_cmos_sensor(0x3002, 0x21);
1016 OV56702ND_write_cmos_sensor(0x3005, 0xf0);
1017 OV56702ND_write_cmos_sensor(0x3007, 0x00);
1018 OV56702ND_write_cmos_sensor(0x3015, 0x0f);
1019 OV56702ND_write_cmos_sensor(0x3018, 0x32);
1020 OV56702ND_write_cmos_sensor(0x301a, 0xf0);
1021 OV56702ND_write_cmos_sensor(0x301b, 0xf0);
1022 OV56702ND_write_cmos_sensor(0x301c, 0xf0);
1023 OV56702ND_write_cmos_sensor(0x301d, 0xf0);
1024 OV56702ND_write_cmos_sensor(0x301e, 0xf0);
1025 OV56702ND_write_cmos_sensor(0x3030, 0x00);
1026 OV56702ND_write_cmos_sensor(0x3031, 0x0a);
1027 OV56702ND_write_cmos_sensor(0x303c, 0xff);
1028 OV56702ND_write_cmos_sensor(0x303e, 0xff);
1029 OV56702ND_write_cmos_sensor(0x3040, 0xf0);
1030 OV56702ND_write_cmos_sensor(0x3041, 0x00);
1031 OV56702ND_write_cmos_sensor(0x3042, 0xf0);
1032 OV56702ND_write_cmos_sensor(0x3106, 0x11);
1033 OV56702ND_write_cmos_sensor(0x3500, 0x00);
1034 OV56702ND_write_cmos_sensor(0x3501, 0x7b);
1035 OV56702ND_write_cmos_sensor(0x3502, 0x00);
1036 OV56702ND_write_cmos_sensor(0x3503, 0x04);
1037 OV56702ND_write_cmos_sensor(0x3504, 0x03);
1038 OV56702ND_write_cmos_sensor(0x3505, 0x83);
1039 OV56702ND_write_cmos_sensor(0x3508, 0x07);
1040 OV56702ND_write_cmos_sensor(0x3509, 0x80);
1041 OV56702ND_write_cmos_sensor(0x350e, 0x04);
1042 OV56702ND_write_cmos_sensor(0x350f, 0x00);
1043 OV56702ND_write_cmos_sensor(0x3510, 0x00);
1044 OV56702ND_write_cmos_sensor(0x3511, 0x02);
1045 OV56702ND_write_cmos_sensor(0x3512, 0x00);
1046 OV56702ND_write_cmos_sensor(0x3601, 0xc8);
1047 OV56702ND_write_cmos_sensor(0x3610, 0x88);
1048 OV56702ND_write_cmos_sensor(0x3612, 0x48);
1049 OV56702ND_write_cmos_sensor(0x3614, 0x5b);
1050 OV56702ND_write_cmos_sensor(0x3615, 0x96);
1051 OV56702ND_write_cmos_sensor(0x3621, 0xd0);
1052 OV56702ND_write_cmos_sensor(0x3622, 0x00);
1053 OV56702ND_write_cmos_sensor(0x3623, 0x00);
1054 OV56702ND_write_cmos_sensor(0x3633, 0x13);
1055 OV56702ND_write_cmos_sensor(0x3634, 0x13);
1056 OV56702ND_write_cmos_sensor(0x3635, 0x13);
1057 OV56702ND_write_cmos_sensor(0x3636, 0x13);
1058 OV56702ND_write_cmos_sensor(0x3645, 0x13);
1059 OV56702ND_write_cmos_sensor(0x3646, 0x82);
1060 OV56702ND_write_cmos_sensor(0x3650, 0x00);
1061 OV56702ND_write_cmos_sensor(0x3652, 0xff);
1062 OV56702ND_write_cmos_sensor(0x3655, 0x20);
1063 OV56702ND_write_cmos_sensor(0x3656, 0xff);
1064 OV56702ND_write_cmos_sensor(0x365a, 0xff);
1065 OV56702ND_write_cmos_sensor(0x365e, 0xff);
1066 OV56702ND_write_cmos_sensor(0x3668, 0x00);
1067 OV56702ND_write_cmos_sensor(0x366a, 0x07);
1068 OV56702ND_write_cmos_sensor(0x366e, 0x10);
1069 OV56702ND_write_cmos_sensor(0x366d, 0x00);
1070 OV56702ND_write_cmos_sensor(0x366f, 0x80);
1071 OV56702ND_write_cmos_sensor(0x3700, 0x28);
1072 OV56702ND_write_cmos_sensor(0x3701, 0x10);
1073 OV56702ND_write_cmos_sensor(0x3702, 0x3a);
1074 OV56702ND_write_cmos_sensor(0x3703, 0x19);
1075 OV56702ND_write_cmos_sensor(0x3704, 0x10);
1076 OV56702ND_write_cmos_sensor(0x3705, 0x00);
1077 OV56702ND_write_cmos_sensor(0x3706, 0x66);
1078 OV56702ND_write_cmos_sensor(0x3707, 0x08);
1079 OV56702ND_write_cmos_sensor(0x3708, 0x34);
1080 OV56702ND_write_cmos_sensor(0x3709, 0x40);
1081 OV56702ND_write_cmos_sensor(0x370a, 0x01);
1082 OV56702ND_write_cmos_sensor(0x370b, 0x1b);
1083 OV56702ND_write_cmos_sensor(0x3714, 0x24);
1084 OV56702ND_write_cmos_sensor(0x371a, 0x3e);
1085 OV56702ND_write_cmos_sensor(0x3733, 0x00);
1086 OV56702ND_write_cmos_sensor(0x3734, 0x00);
1087 OV56702ND_write_cmos_sensor(0x373a, 0x05);
1088 OV56702ND_write_cmos_sensor(0x373b, 0x06);
1089 OV56702ND_write_cmos_sensor(0x373c, 0x0a);
1090 OV56702ND_write_cmos_sensor(0x373f, 0xa0);
1091 OV56702ND_write_cmos_sensor(0x3755, 0x00);
1092 OV56702ND_write_cmos_sensor(0x3758, 0x00);
1093 OV56702ND_write_cmos_sensor(0x375b, 0x0e);
1094 OV56702ND_write_cmos_sensor(0x3766, 0x5f);
1095 OV56702ND_write_cmos_sensor(0x3768, 0x00);
1096 OV56702ND_write_cmos_sensor(0x3769, 0x22);
1097 OV56702ND_write_cmos_sensor(0x3773, 0x08);
1098 OV56702ND_write_cmos_sensor(0x3774, 0x1f);
1099 OV56702ND_write_cmos_sensor(0x3776, 0x06);
1100 OV56702ND_write_cmos_sensor(0x37a0, 0x88);
1101 OV56702ND_write_cmos_sensor(0x37a1, 0x5c);
1102 OV56702ND_write_cmos_sensor(0x37a7, 0x88);
1103 OV56702ND_write_cmos_sensor(0x37a8, 0x70);
1104 OV56702ND_write_cmos_sensor(0x37aa, 0x88);
1105 OV56702ND_write_cmos_sensor(0x37ab, 0x48);
1106 OV56702ND_write_cmos_sensor(0x37b3, 0x66);
1107 OV56702ND_write_cmos_sensor(0x37c2, 0x04);
1108 OV56702ND_write_cmos_sensor(0x37c5, 0x00);
1109 OV56702ND_write_cmos_sensor(0x37c8, 0x00);
1110 OV56702ND_write_cmos_sensor(0x3800, 0x00);
1111 OV56702ND_write_cmos_sensor(0x3801, 0x0c);
1112 OV56702ND_write_cmos_sensor(0x3802, 0x00);
1113 OV56702ND_write_cmos_sensor(0x3803, 0x04);
1114 OV56702ND_write_cmos_sensor(0x3804, 0x0a);
1115 OV56702ND_write_cmos_sensor(0x3805, 0x33);
1116 OV56702ND_write_cmos_sensor(0x3806, 0x07);
1117 OV56702ND_write_cmos_sensor(0x3807, 0xa3);
1118 OV56702ND_write_cmos_sensor(0x3808, 0x0a);
1119 OV56702ND_write_cmos_sensor(0x3809, 0x20);
1120 OV56702ND_write_cmos_sensor(0x380a, 0x07);
1121 OV56702ND_write_cmos_sensor(0x380b, 0x98);
1122 OV56702ND_write_cmos_sensor(0x380c, 0x07); // ;06
1123 OV56702ND_write_cmos_sensor(0x380d, 0xdc); // ;8c
1124 OV56702ND_write_cmos_sensor(0x380e, 0x07);
1125 OV56702ND_write_cmos_sensor(0x380f, 0xb8);
1126 OV56702ND_write_cmos_sensor(0x3811, 0x04);
1127 OV56702ND_write_cmos_sensor(0x3813, 0x02);
1128 OV56702ND_write_cmos_sensor(0x3814, 0x01);
1129 OV56702ND_write_cmos_sensor(0x3815, 0x01);
1130 OV56702ND_write_cmos_sensor(0x3816, 0x00);
1131 OV56702ND_write_cmos_sensor(0x3817, 0x00);
1132 OV56702ND_write_cmos_sensor(0x3818, 0x00);
1133 OV56702ND_write_cmos_sensor(0x3819, 0x00);
1134 OV56702ND_write_cmos_sensor(0x3820, 0x80);
1135 OV56702ND_write_cmos_sensor(0x3821, 0x46);
1136 OV56702ND_write_cmos_sensor(0x3822, 0x48);
1137 OV56702ND_write_cmos_sensor(0x3826, 0x00);
1138 OV56702ND_write_cmos_sensor(0x3827, 0x08);
1139 OV56702ND_write_cmos_sensor(0x382a, 0x01);
1140 OV56702ND_write_cmos_sensor(0x382b, 0x01);
1141 OV56702ND_write_cmos_sensor(0x3830, 0x08);
1142 OV56702ND_write_cmos_sensor(0x3836, 0x02);
1143 OV56702ND_write_cmos_sensor(0x3837, 0x00);
1144 OV56702ND_write_cmos_sensor(0x3838, 0x10);
1145 OV56702ND_write_cmos_sensor(0x3841, 0xff);
1146 OV56702ND_write_cmos_sensor(0x3846, 0x48);
1147 OV56702ND_write_cmos_sensor(0x3861, 0x00);
1148 OV56702ND_write_cmos_sensor(0x3862, 0x04);//x00);
1149 OV56702ND_write_cmos_sensor(0x3863, 0x06);//0x18);
1150 OV56702ND_write_cmos_sensor(0x3a11, 0x01);
1151 OV56702ND_write_cmos_sensor(0x3a12, 0x78);
1152 OV56702ND_write_cmos_sensor(0x3b00, 0x00);
1153 OV56702ND_write_cmos_sensor(0x3b02, 0x00);
1154 OV56702ND_write_cmos_sensor(0x3b03, 0x00);
1155 OV56702ND_write_cmos_sensor(0x3b04, 0x00);
1156 OV56702ND_write_cmos_sensor(0x3b05, 0x00);
1157 OV56702ND_write_cmos_sensor(0x3c00, 0x89);
1158 OV56702ND_write_cmos_sensor(0x3c01, 0xab);
1159 OV56702ND_write_cmos_sensor(0x3c02, 0x01);
1160 OV56702ND_write_cmos_sensor(0x3c03, 0x00);
1161 OV56702ND_write_cmos_sensor(0x3c04, 0x00);
1162 OV56702ND_write_cmos_sensor(0x3c05, 0x03);
1163 OV56702ND_write_cmos_sensor(0x3c06, 0x00);
1164 OV56702ND_write_cmos_sensor(0x3c07, 0x05);
1165 OV56702ND_write_cmos_sensor(0x3c0c, 0x00);
1166 OV56702ND_write_cmos_sensor(0x3c0d, 0x00);
1167 OV56702ND_write_cmos_sensor(0x3c0e, 0x00);
1168 OV56702ND_write_cmos_sensor(0x3c0f, 0x00);
1169 OV56702ND_write_cmos_sensor(0x3c40, 0x00);
1170 OV56702ND_write_cmos_sensor(0x3c41, 0xa3);
1171 OV56702ND_write_cmos_sensor(0x3c43, 0x7d);
1172 OV56702ND_write_cmos_sensor(0x3c45, 0xd7);
1173 OV56702ND_write_cmos_sensor(0x3c47, 0xfc);
1174 OV56702ND_write_cmos_sensor(0x3c50, 0x05);
1175 OV56702ND_write_cmos_sensor(0x3c52, 0xaa);
1176 OV56702ND_write_cmos_sensor(0x3c54, 0x71);
1177 OV56702ND_write_cmos_sensor(0x3c56, 0x80);
1178 OV56702ND_write_cmos_sensor(0x3d85, 0x17);
1179 OV56702ND_write_cmos_sensor(0x3f03, 0x00);
1180 OV56702ND_write_cmos_sensor(0x3f0a, 0x00);
1181 OV56702ND_write_cmos_sensor(0x3f0b, 0x00);
1182 OV56702ND_write_cmos_sensor(0x4001, 0x60);
1183 OV56702ND_write_cmos_sensor(0x4009, 0x0d);
1184 OV56702ND_write_cmos_sensor(0x4020, 0x00);
1185 OV56702ND_write_cmos_sensor(0x4021, 0x00);
1186 OV56702ND_write_cmos_sensor(0x4022, 0x00);
1187 OV56702ND_write_cmos_sensor(0x4023, 0x00);
1188 OV56702ND_write_cmos_sensor(0x4024, 0x00);
1189 OV56702ND_write_cmos_sensor(0x4025, 0x00);
1190 OV56702ND_write_cmos_sensor(0x4026, 0x00);
1191 OV56702ND_write_cmos_sensor(0x4027, 0x00);
1192 OV56702ND_write_cmos_sensor(0x4028, 0x00);
1193 OV56702ND_write_cmos_sensor(0x4029, 0x00);
1194 OV56702ND_write_cmos_sensor(0x402a, 0x00);
1195 OV56702ND_write_cmos_sensor(0x402b, 0x00);
1196 OV56702ND_write_cmos_sensor(0x402c, 0x00);
1197 OV56702ND_write_cmos_sensor(0x402d, 0x00);
1198 OV56702ND_write_cmos_sensor(0x402e, 0x00);
1199 OV56702ND_write_cmos_sensor(0x402f, 0x00);
1200 OV56702ND_write_cmos_sensor(0x4040, 0x00);
1201 OV56702ND_write_cmos_sensor(0x4041, 0x03);//0x00);
1202 OV56702ND_write_cmos_sensor(0x4042, 0x00);
1203 OV56702ND_write_cmos_sensor(0x4043, 0x7a);//0x80);
1204 OV56702ND_write_cmos_sensor(0x4044, 0x00);
1205 OV56702ND_write_cmos_sensor(0x4045, 0x7a);//0x80);
1206 OV56702ND_write_cmos_sensor(0x4046, 0x00);
1207 OV56702ND_write_cmos_sensor(0x4047, 0x7a);//0x80);
1208 OV56702ND_write_cmos_sensor(0x4048, 0x00);
1209 OV56702ND_write_cmos_sensor(0x4049, 0x7a);//0x80);
1210 OV56702ND_write_cmos_sensor(0x4303, 0x00);
1211 OV56702ND_write_cmos_sensor(0x4307, 0x30);
1212 OV56702ND_write_cmos_sensor(0x4500, 0x58);
1213 OV56702ND_write_cmos_sensor(0x4501, 0x04);
1214 OV56702ND_write_cmos_sensor(0x4502, 0x40);
1215 OV56702ND_write_cmos_sensor(0x4503, 0x10);
1216 OV56702ND_write_cmos_sensor(0x4508, 0xaa);
1217 OV56702ND_write_cmos_sensor(0x4509, 0xaa);
1218 OV56702ND_write_cmos_sensor(0x450a, 0x00);
1219 OV56702ND_write_cmos_sensor(0x450b, 0x00);
1220 OV56702ND_write_cmos_sensor(0x4600, 0x01);
1221 OV56702ND_write_cmos_sensor(0x4601, 0x03);
1222 OV56702ND_write_cmos_sensor(0x4700, 0xa4);
1223 OV56702ND_write_cmos_sensor(0x4800, 0x4c);
1224 OV56702ND_write_cmos_sensor(0x4816, 0x53);
1225 OV56702ND_write_cmos_sensor(0x481f, 0x40);
1226 OV56702ND_write_cmos_sensor(0x4837, 0x14); // ;11
1227 OV56702ND_write_cmos_sensor(0x5000, 0x56);//0x16);
1228 OV56702ND_write_cmos_sensor(0x5001, 0x01);
1229 OV56702ND_write_cmos_sensor(0x5002, 0x28);//0xa8);
1230 OV56702ND_write_cmos_sensor(0x5004, 0x0c);
1231 OV56702ND_write_cmos_sensor(0x5006, 0x0c);
1232 OV56702ND_write_cmos_sensor(0x5007, 0xe0);
1233 OV56702ND_write_cmos_sensor(0x5008, 0x01);
1234 OV56702ND_write_cmos_sensor(0x5009, 0xb0);
1235 OV56702ND_write_cmos_sensor(0x5901, 0x00);
1236 OV56702ND_write_cmos_sensor(0x5a01, 0x00);
1237 OV56702ND_write_cmos_sensor(0x5a03, 0x00);
1238 OV56702ND_write_cmos_sensor(0x5a04, 0x0c);
1239 OV56702ND_write_cmos_sensor(0x5a05, 0xe0);
1240 OV56702ND_write_cmos_sensor(0x5a06, 0x09);
1241 OV56702ND_write_cmos_sensor(0x5a07, 0xb0);
1242 OV56702ND_write_cmos_sensor(0x5a08, 0x06);
1243 OV56702ND_write_cmos_sensor(0x5e00, 0x00);
1245 OV56702ND_write_cmos_sensor(0x3734, 0x40);
1246 OV56702ND_write_cmos_sensor(0x5b00, 0x01);
1247 OV56702ND_write_cmos_sensor(0x5b01, 0x10);
1248 OV56702ND_write_cmos_sensor(0x5b02, 0x01);
1249 OV56702ND_write_cmos_sensor(0x5b03, 0xdb);
1250 OV56702ND_write_cmos_sensor(0x3d8c, 0x71);
1251 OV56702ND_write_cmos_sensor(0x3d8d, 0xea);
1252 OV56702ND_write_cmos_sensor(0x4017, 0x08);
1254 OV56702ND_write_cmos_sensor(0x3618, 0x2a);
1257 OV56702ND_write_cmos_sensor(0x3734, 0x40); // ;; Improve HFPN
1258 OV56702ND_write_cmos_sensor(0x5b00, 0x01); // ;; [2:0] otp start addr[10:8]
1259 OV56702ND_write_cmos_sensor(0x5b01, 0x10); // ;; [7:0] otp start addr[7:0]
1260 OV56702ND_write_cmos_sensor(0x5b02, 0x01); // ;; [2:0] otp end addr[10:8]
1261 OV56702ND_write_cmos_sensor(0x5b03, 0xDB); // ;; [7:0] otp end addr[7:0]
1262 OV56702ND_write_cmos_sensor(0x3d8c, 0x71); //; Header address high byte
1263 OV56702ND_write_cmos_sensor(0x3d8d, 0xEA); //; Header address low byte
1264 OV56702ND_write_cmos_sensor(0x4017, 0x08); // ; threshold= 2LSB for full size
1267 OV56702ND_write_cmos_sensor(0x5780, 0x3e);
1268 OV56702ND_write_cmos_sensor(0x5781, 0x0f);
1269 OV56702ND_write_cmos_sensor(0x5782, 0x44);
1270 OV56702ND_write_cmos_sensor(0x5783, 0x02);
1271 OV56702ND_write_cmos_sensor(0x5784, 0x01);
1272 OV56702ND_write_cmos_sensor(0x5785, 0x00);
1273 OV56702ND_write_cmos_sensor(0x5786, 0x00);
1274 OV56702ND_write_cmos_sensor(0x5787, 0x04);
1275 OV56702ND_write_cmos_sensor(0x5788, 0x02);
1276 OV56702ND_write_cmos_sensor(0x5789, 0x0f);
1277 OV56702ND_write_cmos_sensor(0x578a, 0xfd);
1278 OV56702ND_write_cmos_sensor(0x578b, 0xf5);
1279 OV56702ND_write_cmos_sensor(0x578c, 0xf5);
1280 OV56702ND_write_cmos_sensor(0x578d, 0x03);
1281 OV56702ND_write_cmos_sensor(0x578e, 0x08);
1282 OV56702ND_write_cmos_sensor(0x578f, 0x0c);
1283 OV56702ND_write_cmos_sensor(0x5790, 0x08);
1284 OV56702ND_write_cmos_sensor(0x5791, 0x04);
1285 OV56702ND_write_cmos_sensor(0x5792, 0x00);
1286 OV56702ND_write_cmos_sensor(0x5793, 0x52);
1287 OV56702ND_write_cmos_sensor(0x5794, 0xa3);
1289 OV56702ND_write_cmos_sensor(0x380e, 0x07); //; fps fine adjustment
1290 OV56702ND_write_cmos_sensor(0x380f, 0xfd); //; fps fine adjustment
1291 OV56702ND_write_cmos_sensor(0x3503, 0x00); //; real gain [2] gain no delay, shutter no delay
1293 OV56702ND_write_cmos_sensor(0x3d85, 0x17);
1294 OV56702ND_write_cmos_sensor(0x3655, 0x20);
1296 OV56702ND_write_cmos_sensor(0x0100, 0x01); //;01
1298 ov56702nd_otp_config();
1302 UINT32
OV56702NDOpen(void)
1305 volatile signed int i
;
1306 kal_uint16 sensor_id
= 0;
1308 OV56702NDDB("OV56702ND Open enter :\n ");
1309 OV56702ND_write_cmos_sensor(0x0103,0x01);// Reset sensor
1314 sensor_id
= (OV56702ND_read_cmos_sensor(0x300B)<<8)|OV56702ND_read_cmos_sensor(0x300C);
1315 OV56702NDDB("OV56702ND READ ID :%x",sensor_id
);
1316 if(sensor_id
!= OV5670MIPI_SENSOR_ID
)
1318 return ERROR_SENSOR_CONNECT_FAIL
;
1323 OV56702ND_Sensor_Init();
1324 OV56702ND_Init_Para();
1325 OV56702NDDB("OV56702NDOpen exit :\n ");
1330 void OV56702NDGetModuleID(void)
1332 struct otp_struct otp_info
;
1334 OV56702ND_write_cmos_sensor(0x0100, 0x01); //stream on
1335 read_otp(&otp_info
);
1336 OV56702ND_write_cmos_sensor(0x0100, 0x00); //stream off
1339 UINT32
OV56702NDGetSensorID(UINT32
*sensorID
)
1343 OV56702NDDB("OV56702NDGetSensorID enter :\n ");
1347 *sensorID
= (OV56702ND_read_cmos_sensor(0x300B)<<8)|OV56702ND_read_cmos_sensor(0x300C);
1348 if (*sensorID
== OV56702NDMIPI_SENSOR_ID
)
1350 OV56702NDDB("Sensor ID = 0x%04x\n", *sensorID
);
1351 OV56702NDGetModuleID();
1354 OV56702NDDB("Read Sensor ID Fail = 0x%04x\n", *sensorID
);
1356 } while (retry
> 0);
1358 if (*sensorID
!= OV56702NDMIPI_SENSOR_ID
) {
1359 OV56702NDDB("Read Sensor ID Fail = 0x%04x\n", *sensorID
);
1361 *sensorID
= 0xFFFFFFFF;
1362 return ERROR_SENSOR_CONNECT_FAIL
;
1364 OV56702NDDB("alexadd %s module_id=%d", __func__
, module_id
);
1365 if (module_id
!= 0x44) {
1366 *sensorID
= 0xFFFFFFFF;
1367 return ERROR_SENSOR_CONNECT_FAIL
;
1374 void OV56702ND_SetShutter(kal_uint32 iShutter
)
1377 spin_lock(&ov56702ndmipiraw_drv_lock
);
1378 OV56702ND
.shutter
= iShutter
;
1379 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1381 OV56702ND_write_shutter(iShutter
);
1387 UINT32
OV56702ND_read_shutter(void)
1390 kal_uint16 temp_reg1
, temp_reg2
,temp_reg3
;
1392 temp_reg1
= OV56702ND_read_cmos_sensor(0x3500); // AEC[b19~b16]
1393 temp_reg2
= OV56702ND_read_cmos_sensor(0x3501); // AEC[b15~b8]
1394 temp_reg3
= OV56702ND_read_cmos_sensor(0x3502); // AEC[b7~b0]
1396 shutter
= (temp_reg1
<<12)| (temp_reg2
<<4)|(temp_reg3
>>4);
1401 void OV56702ND_NightMode(kal_bool bEnable
)
1406 UINT32
OV56702NDClose(void)
1413 void OV56702NDSetFlipMirror(kal_int32 imgMirror
)
1415 kal_int16 mirror
=0,flip
=0;
1416 mirror
= OV56702ND_read_cmos_sensor(0x3820);
1417 flip
= OV56702ND_read_cmos_sensor(0x3821);
1421 case IMAGE_H_MIRROR
://IMAGE_NORMAL:
1422 OV56702ND_write_cmos_sensor(0x3820, (mirror
& (0xF9)));//Set normal
1423 OV56702ND_write_cmos_sensor(0x3821, (flip
& (0xF9))); //Set normal
1425 case IMAGE_NORMAL
://IMAGE_V_MIRROR:
1426 OV56702ND_write_cmos_sensor(0x3820, (mirror
& (0xF9)));//Set flip
1427 OV56702ND_write_cmos_sensor(0x3821, (flip
| (0x06))); //Set flip
1429 case IMAGE_HV_MIRROR
://IMAGE_H_MIRROR:
1430 OV56702ND_write_cmos_sensor(0x3820, (mirror
|(0x06))); //Set mirror
1431 OV56702ND_write_cmos_sensor(0x3821, (flip
& (0xF9))); //Set mirror
1433 case IMAGE_V_MIRROR
://IMAGE_HV_MIRROR:
1434 OV56702ND_write_cmos_sensor(0x3820, (mirror
|(0x06))); //Set mirror & flip
1435 OV56702ND_write_cmos_sensor(0x3821, (flip
|(0x06))); //Set mirror & flip
1442 UINT32
OV56702NDPreview(MSDK_SENSOR_EXPOSURE_WINDOW_STRUCT
*image_window
,
1443 MSDK_SENSOR_CONFIG_STRUCT
*sensor_config_data
)
1446 OV56702NDDB("OV56702NDPreview enter:");
1448 //OV56702NDPreviewSetting();
1449 OV56702NDCaptureSetting();
1450 spin_lock(&ov56702ndmipiraw_drv_lock
);
1451 OV56702ND
.sensorMode
= SENSOR_MODE_PREVIEW
;
1452 OV56702ND
.DummyPixels
= 0;
1453 OV56702ND
.DummyLines
= 0 ;
1454 OV56702ND_FeatureControl_PERIOD_PixelNum
=OV56702ND_PV_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
;
1455 OV56702ND_FeatureControl_PERIOD_LineNum
=OV56702ND_PV_PERIOD_LINE_NUMS
+OV56702ND
.DummyLines
;
1456 OV56702ND
.imgMirror
= sensor_config_data
->SensorImageMirror
;
1457 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1459 //OV56702NDSetFlipMirror(sensor_config_data->SensorImageMirror);
1461 mdelay(40);//THIS DELAY SHOULD BE NEED BY CTS OR MONKEY
1462 OV56702NDDB("OV56702NDPreview exit:\n");
1469 UINT32
OV56702NDVideo(MSDK_SENSOR_EXPOSURE_WINDOW_STRUCT
*image_window
,
1470 MSDK_SENSOR_CONFIG_STRUCT
*sensor_config_data
)
1473 OV56702NDDB("OV56702NDVideo enter:");
1475 OV56702NDVideoSetting();
1477 spin_lock(&ov56702ndmipiraw_drv_lock
);
1478 OV56702ND
.sensorMode
= SENSOR_MODE_VIDEO
;
1479 OV56702ND_FeatureControl_PERIOD_PixelNum
=OV56702ND_VIDEO_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
;
1480 OV56702ND_FeatureControl_PERIOD_LineNum
=OV56702ND_VIDEO_PERIOD_LINE_NUMS
+OV56702ND
.DummyLines
;
1481 OV56702ND
.imgMirror
= sensor_config_data
->SensorImageMirror
;
1482 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1484 //OV56702NDSetFlipMirror(sensor_config_data->SensorImageMirror);
1486 mdelay(40);//THIS DELAY SHOULD BE NEED BY CTS OR MONKEY
1487 OV56702NDDB("OV56702NDVideo exit:\n");
1492 UINT32
OV56702NDCapture(MSDK_SENSOR_EXPOSURE_WINDOW_STRUCT
*image_window
,
1493 MSDK_SENSOR_CONFIG_STRUCT
*sensor_config_data
)
1496 //kal_uint32 shutter = OV56702ND.shutter;
1498 if( SENSOR_MODE_CAPTURE
== OV56702ND
.sensorMode
)
1500 OV56702NDDB("OV56702NDCapture BusrtShot / ZSD!!!\n");
1504 OV56702NDDB("OV56702NDCapture enter:\n");
1506 OV56702NDCaptureSetting();
1507 mdelay(40);//THIS DELAY SHOULD BE NEED BY CTS OR MONKEY
1509 spin_lock(&ov56702ndmipiraw_drv_lock
);
1510 OV56702ND
.sensorMode
= SENSOR_MODE_CAPTURE
;
1511 OV56702ND
.imgMirror
= sensor_config_data
->SensorImageMirror
;
1512 OV56702ND
.DummyPixels
= 0;
1513 OV56702ND
.DummyLines
= 0 ;
1514 OV56702ND_FeatureControl_PERIOD_PixelNum
= OV56702ND_FULL_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
;
1515 OV56702ND_FeatureControl_PERIOD_LineNum
= OV56702ND_FULL_PERIOD_LINE_NUMS
+ OV56702ND
.DummyLines
;
1516 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1518 //OV56702NDSetFlipMirror(sensor_config_data->SensorImageMirror);
1520 OV56702NDDB("OV56702NDCapture exit:\n");
1523 if(OV56702ND_During_testpattern
== KAL_TRUE
)
1525 OV56702ND_write_cmos_sensor(0x4303,0x80);
1533 UINT32
OV56702NDGetResolution(MSDK_SENSOR_RESOLUTION_INFO_STRUCT
*pSensorResolution
)
1536 OV56702NDDB("OV56702NDGetResolution!!\n");
1538 pSensorResolution
->SensorPreviewWidth
= OV56702ND_IMAGE_SENSOR_FULL_WIDTH
;
1539 pSensorResolution
->SensorPreviewHeight
= OV56702ND_IMAGE_SENSOR_FULL_HEIGHT
;
1541 pSensorResolution
->SensorFullWidth
= OV56702ND_IMAGE_SENSOR_FULL_WIDTH
;
1542 pSensorResolution
->SensorFullHeight
= OV56702ND_IMAGE_SENSOR_FULL_HEIGHT
;
1544 pSensorResolution
->SensorVideoWidth
= OV56702ND_IMAGE_SENSOR_VIDEO_WIDTH
;
1545 pSensorResolution
->SensorVideoHeight
= OV56702ND_IMAGE_SENSOR_VIDEO_HEIGHT
;
1549 UINT32
OV56702NDGetInfo(MSDK_SCENARIO_ID_ENUM ScenarioId
,
1550 MSDK_SENSOR_INFO_STRUCT
*pSensorInfo
,
1551 MSDK_SENSOR_CONFIG_STRUCT
*pSensorConfigData
)
1554 spin_lock(&ov56702ndmipiraw_drv_lock
);
1555 OV56702ND
.imgMirror
= pSensorConfigData
->SensorImageMirror
;
1556 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1558 pSensorInfo
->SensorOutputDataFormat
= SENSOR_OUTPUT_FORMAT_RAW_B
;
1560 pSensorInfo
->SensorClockPolarity
=SENSOR_CLOCK_POLARITY_LOW
;
1561 pSensorInfo
->SensorClockFallingPolarity
=SENSOR_CLOCK_POLARITY_LOW
;
1562 pSensorInfo
->SensorHsyncPolarity
= SENSOR_CLOCK_POLARITY_LOW
;
1563 pSensorInfo
->SensorVsyncPolarity
= SENSOR_CLOCK_POLARITY_LOW
;
1565 pSensorInfo
->SensroInterfaceType
=SENSOR_INTERFACE_TYPE_MIPI
;
1567 pSensorInfo
->CaptureDelayFrame
= 2;
1568 pSensorInfo
->PreviewDelayFrame
= 2;
1569 pSensorInfo
->VideoDelayFrame
= 2;
1571 pSensorInfo
->SensorDrivingCurrent
= ISP_DRIVING_8MA
;
1572 pSensorInfo
->AEShutDelayFrame
= 0;
1573 pSensorInfo
->AESensorGainDelayFrame
= 0;
1574 pSensorInfo
->AEISPGainDelayFrame
= 2;
1578 case MSDK_SCENARIO_ID_CAMERA_PREVIEW
:
1579 pSensorInfo
->SensorClockFreq
=24;
1580 pSensorInfo
->SensorClockRisingCount
= 0;
1582 pSensorInfo
->SensorGrabStartX
= OV56702ND_PV_X_START
;
1583 pSensorInfo
->SensorGrabStartY
= OV56702ND_PV_Y_START
;
1585 pSensorInfo
->SensorMIPILaneNumber
= SENSOR_MIPI_2_LANE
;
1587 pSensorInfo
->MIPIDataLowPwr2HighSpeedTermDelayCount
= 0;
1588 pSensorInfo
->MIPIDataLowPwr2HighSpeedSettleDelayCount
= 14;
1589 pSensorInfo
->MIPICLKLowPwr2HighSpeedTermDelayCount
= 0;
1590 pSensorInfo
->SensorPacketECCOrder
= 1;
1592 case MSDK_SCENARIO_ID_VIDEO_PREVIEW
:
1593 pSensorInfo
->SensorClockFreq
=24;
1594 pSensorInfo
->SensorClockRisingCount
= 0;
1596 pSensorInfo
->SensorGrabStartX
= OV56702ND_VIDEO_X_START
;
1597 pSensorInfo
->SensorGrabStartY
= OV56702ND_VIDEO_Y_START
;
1599 pSensorInfo
->SensorMIPILaneNumber
= SENSOR_MIPI_2_LANE
;
1601 pSensorInfo
->MIPIDataLowPwr2HighSpeedTermDelayCount
= 0;
1602 pSensorInfo
->MIPIDataLowPwr2HighSpeedSettleDelayCount
= 14;
1603 pSensorInfo
->MIPICLKLowPwr2HighSpeedTermDelayCount
= 0;
1604 pSensorInfo
->SensorPacketECCOrder
= 1;
1606 case MSDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG
:
1607 case MSDK_SCENARIO_ID_CAMERA_ZSD
:
1608 pSensorInfo
->SensorClockFreq
=24;
1609 pSensorInfo
->SensorClockRisingCount
= 0;
1611 pSensorInfo
->SensorGrabStartX
= OV56702ND_FULL_X_START
;
1612 pSensorInfo
->SensorGrabStartY
= OV56702ND_FULL_Y_START
;
1614 pSensorInfo
->SensorMIPILaneNumber
= SENSOR_MIPI_2_LANE
;
1616 pSensorInfo
->MIPIDataLowPwr2HighSpeedTermDelayCount
= 0;
1617 pSensorInfo
->MIPIDataLowPwr2HighSpeedSettleDelayCount
= 14;
1618 pSensorInfo
->MIPICLKLowPwr2HighSpeedTermDelayCount
= 0;
1619 pSensorInfo
->SensorPacketECCOrder
= 1;
1622 pSensorInfo
->SensorClockFreq
=24;
1623 pSensorInfo
->SensorClockRisingCount
= 0;
1625 pSensorInfo
->SensorGrabStartX
= OV56702ND_PV_X_START
;
1626 pSensorInfo
->SensorGrabStartY
= OV56702ND_PV_Y_START
;
1628 pSensorInfo
->SensorMIPILaneNumber
= SENSOR_MIPI_2_LANE
;
1630 pSensorInfo
->MIPIDataLowPwr2HighSpeedTermDelayCount
= 0;
1631 pSensorInfo
->MIPIDataLowPwr2HighSpeedSettleDelayCount
= 14;
1632 pSensorInfo
->MIPICLKLowPwr2HighSpeedTermDelayCount
= 0;
1633 pSensorInfo
->SensorPacketECCOrder
= 1;
1637 memcpy(pSensorConfigData
, &OV56702NDSensorConfigData
, sizeof(MSDK_SENSOR_CONFIG_STRUCT
));
1640 } /* OV56702NDGetInfo() */
1644 UINT32
OV56702NDControl(MSDK_SCENARIO_ID_ENUM ScenarioId
, MSDK_SENSOR_EXPOSURE_WINDOW_STRUCT
*pImageWindow
,
1645 MSDK_SENSOR_CONFIG_STRUCT
*pSensorConfigData
)
1647 spin_lock(&ov56702ndmipiraw_drv_lock
);
1648 OV56702NDCurrentScenarioId
= ScenarioId
;
1649 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1651 OV56702NDDB("OV56702NDCurrentScenarioId=%d\n",OV56702NDCurrentScenarioId
);
1655 case MSDK_SCENARIO_ID_CAMERA_PREVIEW
:
1656 OV56702NDPreview(pImageWindow
, pSensorConfigData
);
1658 case MSDK_SCENARIO_ID_VIDEO_PREVIEW
:
1659 OV56702NDDB("OV56702ND video_preiew sync\n");
1660 OV56702NDVideo(pImageWindow
, pSensorConfigData
);
1662 case MSDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG
:
1663 case MSDK_SCENARIO_ID_CAMERA_ZSD
:
1664 OV56702NDCapture(pImageWindow
, pSensorConfigData
);
1668 return ERROR_INVALID_SCENARIO_ID
;
1672 } /* OV56702NDControl() */
1676 kal_uint32
OV56702ND_SET_FrameLength_ByVideoMode(UINT16 Video_TargetFps
)
1678 UINT32 frameRate
= 0;
1679 kal_uint32 MIN_FrameLength
=0;
1681 if(OV56702ND
.OV56702NDAutoFlickerMode
== KAL_TRUE
)
1683 if (Video_TargetFps
==30)
1684 frameRate
= OV56702ND_AUTOFLICKER_OFFSET_30
;
1685 else if(Video_TargetFps
==15)
1686 frameRate
= OV56702ND_AUTOFLICKER_OFFSET_15
;
1688 frameRate
=Video_TargetFps
*10;
1690 MIN_FrameLength
= (OV56702ND
.videoPclk
*10000)/(OV56702ND_VIDEO_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
)/frameRate
*10;
1693 MIN_FrameLength
= (OV56702ND
.videoPclk
*10000) /(OV56702ND_VIDEO_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
)/Video_TargetFps
;
1695 return MIN_FrameLength
;
1701 UINT32
OV56702NDSetVideoMode(UINT16 u2FrameRate
)
1704 kal_uint32 MIN_Frame_length
=0,frameRate
=0,extralines
=0;
1705 OV56702NDDB("[OV56702NDSetVideoMode] frame rate = %d\n", u2FrameRate
);
1707 spin_lock(&ov56702ndmipiraw_drv_lock
);
1708 OV56702ND_VIDEO_MODE_TARGET_FPS
=u2FrameRate
;
1709 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1713 OV56702NDDB("Disable Video Mode or dynimac fps\n");
1716 if(u2FrameRate
>30 || u2FrameRate
<5)
1717 OV56702NDDB("abmornal frame rate seting,pay attention~\n");
1719 if(OV56702ND
.sensorMode
== SENSOR_MODE_VIDEO
)//video ScenarioId recording
1722 MIN_Frame_length
= OV56702ND_SET_FrameLength_ByVideoMode(u2FrameRate
);
1724 if((MIN_Frame_length
<=OV56702ND_VIDEO_PERIOD_LINE_NUMS
))
1726 MIN_Frame_length
= OV56702ND_VIDEO_PERIOD_LINE_NUMS
;
1727 OV56702NDDB("[OV56702NDSetVideoMode]current fps = %d\n", (OV56702ND
.videoPclk
*10000) /(OV56702ND_VIDEO_PERIOD_PIXEL_NUMS
)/OV56702ND_VIDEO_PERIOD_LINE_NUMS
);
1729 OV56702NDDB("[OV56702NDSetVideoMode]current fps (10 base)= %d\n", (OV56702ND
.videoPclk
*10000)*10/(OV56702ND_VIDEO_PERIOD_PIXEL_NUMS
+ OV56702ND
.DummyPixels
)/MIN_Frame_length
);
1730 extralines
= MIN_Frame_length
- OV56702ND_VIDEO_PERIOD_LINE_NUMS
;
1732 spin_lock(&ov56702ndmipiraw_drv_lock
);
1733 OV56702ND
.DummyPixels
= 0;//define dummy pixels and lines
1734 OV56702ND
.DummyLines
= extralines
;
1735 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1737 OV56702ND_SetDummy(OV56702ND
.DummyPixels
,extralines
);
1740 OV56702NDDB("[OV56702NDSetVideoMode]MIN_Frame_length=%d,OV56702ND.DummyLines=%d\n",MIN_Frame_length
,OV56702ND
.DummyLines
);
1746 UINT32
OV56702NDSetAutoFlickerMode(kal_bool bEnable
, UINT16 u2FrameRate
)
1750 spin_lock(&ov56702ndmipiraw_drv_lock
);
1751 OV56702ND
.OV56702NDAutoFlickerMode
= KAL_TRUE
;
1752 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1753 OV56702NDDB("OV56702ND Enable Auto flicker\n");
1755 spin_lock(&ov56702ndmipiraw_drv_lock
);
1756 OV56702ND
.OV56702NDAutoFlickerMode
= KAL_FALSE
;
1757 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1758 OV56702NDDB("OV56702ND Disable Auto flicker\n");
1765 UINT32
OV56702NDSetTestPatternMode(kal_bool bEnable
)
1767 OV56702NDDB("[OV56702NDSetTestPatternMode] Test pattern enable:%d\n", bEnable
);
1768 if(bEnable
== KAL_TRUE
)
1770 OV56702ND_During_testpattern
= KAL_TRUE
;
1772 //OV56702ND_write_cmos_sensor(0x5000,0x16);// ; LENC off, MWB on, BPC on, WPC on
1774 OV56702ND_write_cmos_sensor(0x4303,0x08);
1778 OV56702ND_During_testpattern
= KAL_FALSE
;
1779 //OV56702ND_write_cmos_sensor(0x5000,0x96);// ; LENC on, MWB on, BPC on, WPC on
1780 OV56702ND_write_cmos_sensor(0x4303,0x00);
1787 /*************************************************************************
1790 * INTERFACE FUNCTION, FOR USER TO SET MAX FRAMERATE;
1792 *************************************************************************/
1793 UINT32
OV56702NDMIPISetMaxFramerateByScenario(MSDK_SCENARIO_ID_ENUM scenarioId
, MUINT32 frameRate
) {
1795 kal_int16 dummyLine
;
1796 kal_uint16 lineLength
,frameHeight
;
1798 OV56702NDDB("OV56702NDMIPISetMaxFramerateByScenario: scenarioId = %d, frame rate = %d\n",scenarioId
,frameRate
);
1799 switch (scenarioId
) {
1800 case MSDK_SCENARIO_ID_CAMERA_PREVIEW
:
1801 pclk
= OV56702ND_PREVIEW_PCLK
;
1802 lineLength
= OV56702ND_PV_PERIOD_PIXEL_NUMS
;
1803 frameHeight
= (10 * pclk
)/frameRate
/lineLength
;
1804 dummyLine
= frameHeight
- OV56702ND_PV_PERIOD_LINE_NUMS
;
1807 spin_lock(&ov56702ndmipiraw_drv_lock
);
1808 OV56702ND
.sensorMode
= SENSOR_MODE_PREVIEW
;
1809 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1810 OV56702ND_SetDummy(0, dummyLine
);
1812 case MSDK_SCENARIO_ID_VIDEO_PREVIEW
:
1813 pclk
= OV56702ND_VIDEO_PCLK
;
1814 lineLength
= OV56702ND_VIDEO_PERIOD_PIXEL_NUMS
;
1815 frameHeight
= (10 * pclk
)/frameRate
/lineLength
;
1816 dummyLine
= frameHeight
- OV56702ND_VIDEO_PERIOD_LINE_NUMS
;
1819 spin_lock(&ov56702ndmipiraw_drv_lock
);
1820 OV56702ND
.sensorMode
= SENSOR_MODE_VIDEO
;
1821 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1822 OV56702ND_SetDummy(0, dummyLine
);
1825 case MSDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG
:
1826 case MSDK_SCENARIO_ID_CAMERA_ZSD
:
1827 pclk
= OV56702ND_CAPTURE_PCLK
;
1828 lineLength
= OV56702ND_FULL_PERIOD_PIXEL_NUMS
;
1829 frameHeight
= (10 * pclk
)/frameRate
/lineLength
;
1830 dummyLine
= frameHeight
- OV56702ND_FULL_PERIOD_LINE_NUMS
;
1833 spin_lock(&ov56702ndmipiraw_drv_lock
);
1834 OV56702ND
.sensorMode
= SENSOR_MODE_CAPTURE
;
1835 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1836 OV56702ND_SetDummy(0, dummyLine
);
1838 case MSDK_SCENARIO_ID_CAMERA_3D_PREVIEW
:
1840 case MSDK_SCENARIO_ID_CAMERA_3D_VIDEO
:
1842 case MSDK_SCENARIO_ID_CAMERA_3D_CAPTURE
:
1851 UINT32
OV56702NDMIPIGetDefaultFramerateByScenario(MSDK_SCENARIO_ID_ENUM scenarioId
, MUINT32
*pframeRate
)
1854 switch (scenarioId
) {
1855 case MSDK_SCENARIO_ID_CAMERA_PREVIEW
:
1856 case MSDK_SCENARIO_ID_VIDEO_PREVIEW
:
1857 *pframeRate
= OV56702ND_MAX_FPS_PREVIEW
;
1859 case MSDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG
:
1860 case MSDK_SCENARIO_ID_CAMERA_ZSD
:
1861 *pframeRate
= OV56702ND_MAX_FPS_CAPTURE
;
1863 case MSDK_SCENARIO_ID_CAMERA_3D_PREVIEW
: //added
1864 case MSDK_SCENARIO_ID_CAMERA_3D_VIDEO
:
1865 case MSDK_SCENARIO_ID_CAMERA_3D_CAPTURE
: //added
1866 *pframeRate
= OV56702ND_MAX_FPS_CAPTURE
;
1875 /* Sensor output window information */
1877 /* SZ TCT xuejian.zhong add for CTS test*/
1879 static void OV56702NDGetAFMaxNumFocusAreas(UINT32
*pFeatureReturnPara32
)
1881 *pFeatureReturnPara32
= 0;
1882 // SENSORDB("OV56702NDGetAFMaxNumFocusAreas *pFeatureReturnPara32 = %d¥n", *pFeatureReturnPara32);
1885 static void OV56702NDGetAEMaxNumMeteringAreas(UINT32
*pFeatureReturnPara32
)
1887 *pFeatureReturnPara32
= 0;
1888 // SENSORDB("OV56702NDGetAEMaxNumMeteringAreas *pFeatureReturnPara32 = %d¥n", *pFeatureReturnPara32);
1891 static void OV56702NDGetExifInfo(UINT32 exifAddr
)
1893 SENSOR_EXIF_INFO_STRUCT
* pExifInfo
= (SENSOR_EXIF_INFO_STRUCT
*)exifAddr
;
1894 pExifInfo
->FNumber
= 28;
1895 pExifInfo
->AEISOSpeed
= AE_ISO_100
;
1896 pExifInfo
->AWBMode
= AWB_MODE_AUTO
;
1897 pExifInfo
->CapExposureTime
= 0;
1898 pExifInfo
->FlashLightTimeus
= 0;
1899 pExifInfo
->RealISOValue
= AE_ISO_100
;
1902 /* SZ TCT xuejian.zhong end */
1905 UINT32
OV56702NDFeatureControl(MSDK_SENSOR_FEATURE_ENUM FeatureId
,
1906 UINT8
*pFeaturePara
,UINT32
*pFeatureParaLen
)
1908 UINT16
*pFeatureReturnPara16
=(UINT16
*) pFeaturePara
;
1909 UINT16
*pFeatureData16
=(UINT16
*) pFeaturePara
;
1910 UINT32
*pFeatureReturnPara32
=(UINT32
*) pFeaturePara
;
1911 UINT32
*pFeatureData32
=(UINT32
*) pFeaturePara
;
1912 UINT32 SensorRegNumber
;
1914 PNVRAM_SENSOR_DATA_STRUCT pSensorDefaultData
=(PNVRAM_SENSOR_DATA_STRUCT
) pFeaturePara
;
1915 MSDK_SENSOR_CONFIG_STRUCT
*pSensorConfigData
=(MSDK_SENSOR_CONFIG_STRUCT
*) pFeaturePara
;
1916 MSDK_SENSOR_REG_INFO_STRUCT
*pSensorRegData
=(MSDK_SENSOR_REG_INFO_STRUCT
*) pFeaturePara
;
1917 MSDK_SENSOR_GROUP_INFO_STRUCT
*pSensorGroupInfo
=(MSDK_SENSOR_GROUP_INFO_STRUCT
*) pFeaturePara
;
1918 MSDK_SENSOR_ITEM_INFO_STRUCT
*pSensorItemInfo
=(MSDK_SENSOR_ITEM_INFO_STRUCT
*) pFeaturePara
;
1919 MSDK_SENSOR_ENG_INFO_STRUCT
*pSensorEngInfo
=(MSDK_SENSOR_ENG_INFO_STRUCT
*) pFeaturePara
;
1923 case SENSOR_FEATURE_GET_RESOLUTION
:
1924 *pFeatureReturnPara16
++= OV56702ND_IMAGE_SENSOR_FULL_WIDTH
;
1925 *pFeatureReturnPara16
= OV56702ND_IMAGE_SENSOR_FULL_HEIGHT
;
1928 case SENSOR_FEATURE_GET_PERIOD
:
1929 *pFeatureReturnPara16
++= OV56702ND_FeatureControl_PERIOD_PixelNum
;
1930 *pFeatureReturnPara16
= OV56702ND_FeatureControl_PERIOD_LineNum
;
1933 case SENSOR_FEATURE_GET_PIXEL_CLOCK_FREQ
:
1934 switch(OV56702NDCurrentScenarioId
)
1936 case MSDK_SCENARIO_ID_CAMERA_PREVIEW
:
1937 *pFeatureReturnPara32
= OV56702ND_PREVIEW_PCLK
;
1940 case MSDK_SCENARIO_ID_VIDEO_PREVIEW
:
1941 *pFeatureReturnPara32
= OV56702ND_VIDEO_PCLK
;
1944 case MSDK_SCENARIO_ID_CAMERA_CAPTURE_JPEG
:
1945 case MSDK_SCENARIO_ID_CAMERA_ZSD
:
1946 *pFeatureReturnPara32
= OV56702ND_CAPTURE_PCLK
;
1950 *pFeatureReturnPara32
= OV56702ND_PREVIEW_PCLK
;
1956 case SENSOR_FEATURE_SET_ESHUTTER
:
1957 OV56702ND_SetShutter(*pFeatureData16
);
1959 case SENSOR_FEATURE_SET_NIGHTMODE
:
1960 OV56702ND_NightMode((BOOL
) *pFeatureData16
);
1962 case SENSOR_FEATURE_SET_GAIN
:
1963 OV56702ND_SetGain((UINT16
) *pFeatureData16
);
1965 case SENSOR_FEATURE_SET_FLASHLIGHT
:
1967 case SENSOR_FEATURE_SET_ISP_MASTER_CLOCK_FREQ
:
1968 //OV56702ND_isp_master_clock=*pFeatureData32;
1970 case SENSOR_FEATURE_SET_REGISTER
:
1971 OV56702ND_write_cmos_sensor(pSensorRegData
->RegAddr
, pSensorRegData
->RegData
);
1973 case SENSOR_FEATURE_GET_REGISTER
:
1974 pSensorRegData
->RegData
= OV56702ND_read_cmos_sensor(pSensorRegData
->RegAddr
);
1976 case SENSOR_FEATURE_SET_CCT_REGISTER
:
1977 SensorRegNumber
=FACTORY_END_ADDR
;
1978 for (i
=0;i
<SensorRegNumber
;i
++)
1980 spin_lock(&ov56702ndmipiraw_drv_lock
);
1981 OV56702NDSensorCCT
[i
].Addr
=*pFeatureData32
++;
1982 OV56702NDSensorCCT
[i
].Para
=*pFeatureData32
++;
1983 spin_unlock(&ov56702ndmipiraw_drv_lock
);
1986 case SENSOR_FEATURE_GET_CCT_REGISTER
:
1987 SensorRegNumber
=FACTORY_END_ADDR
;
1988 if (*pFeatureParaLen
<(SensorRegNumber
*sizeof(SENSOR_REG_STRUCT
)+4))
1990 *pFeatureData32
++=SensorRegNumber
;
1991 for (i
=0;i
<SensorRegNumber
;i
++)
1993 *pFeatureData32
++=OV56702NDSensorCCT
[i
].Addr
;
1994 *pFeatureData32
++=OV56702NDSensorCCT
[i
].Para
;
1997 case SENSOR_FEATURE_SET_ENG_REGISTER
:
1998 SensorRegNumber
=ENGINEER_END
;
1999 for (i
=0;i
<SensorRegNumber
;i
++)
2001 spin_lock(&ov56702ndmipiraw_drv_lock
);
2002 OV56702NDSensorReg
[i
].Addr
=*pFeatureData32
++;
2003 OV56702NDSensorReg
[i
].Para
=*pFeatureData32
++;
2004 spin_unlock(&ov56702ndmipiraw_drv_lock
);
2007 case SENSOR_FEATURE_GET_ENG_REGISTER
:
2008 SensorRegNumber
=ENGINEER_END
;
2009 if (*pFeatureParaLen
<(SensorRegNumber
*sizeof(SENSOR_REG_STRUCT
)+4))
2011 *pFeatureData32
++=SensorRegNumber
;
2012 for (i
=0;i
<SensorRegNumber
;i
++)
2014 *pFeatureData32
++=OV56702NDSensorReg
[i
].Addr
;
2015 *pFeatureData32
++=OV56702NDSensorReg
[i
].Para
;
2018 case SENSOR_FEATURE_GET_REGISTER_DEFAULT
:
2019 if (*pFeatureParaLen
>=sizeof(NVRAM_SENSOR_DATA_STRUCT
))
2021 pSensorDefaultData
->Version
=NVRAM_CAMERA_SENSOR_FILE_VERSION
;
2022 pSensorDefaultData
->SensorId
=OV56702NDMIPI_SENSOR_ID
;
2023 memcpy(pSensorDefaultData
->SensorEngReg
, OV56702NDSensorReg
, sizeof(SENSOR_REG_STRUCT
)*ENGINEER_END
);
2024 memcpy(pSensorDefaultData
->SensorCCTReg
, OV56702NDSensorCCT
, sizeof(SENSOR_REG_STRUCT
)*FACTORY_END_ADDR
);
2028 *pFeatureParaLen
=sizeof(NVRAM_SENSOR_DATA_STRUCT
);
2030 case SENSOR_FEATURE_GET_CONFIG_PARA
:
2031 memcpy(pSensorConfigData
, &OV56702NDSensorConfigData
, sizeof(MSDK_SENSOR_CONFIG_STRUCT
));
2032 *pFeatureParaLen
=sizeof(MSDK_SENSOR_CONFIG_STRUCT
);
2034 case SENSOR_FEATURE_CAMERA_PARA_TO_SENSOR
:
2035 OV56702ND_camera_para_to_sensor();
2038 case SENSOR_FEATURE_SENSOR_TO_CAMERA_PARA
:
2039 OV56702ND_sensor_to_camera_para();
2041 case SENSOR_FEATURE_GET_GROUP_COUNT
:
2042 *pFeatureReturnPara32
++=OV56702ND_get_sensor_group_count();
2045 case SENSOR_FEATURE_GET_GROUP_INFO
:
2046 OV56702ND_get_sensor_group_info(pSensorGroupInfo
->GroupIdx
, pSensorGroupInfo
->GroupNamePtr
, &pSensorGroupInfo
->ItemCount
);
2047 *pFeatureParaLen
=sizeof(MSDK_SENSOR_GROUP_INFO_STRUCT
);
2049 case SENSOR_FEATURE_GET_ITEM_INFO
:
2050 OV56702ND_get_sensor_item_info(pSensorItemInfo
->GroupIdx
,pSensorItemInfo
->ItemIdx
, pSensorItemInfo
);
2051 *pFeatureParaLen
=sizeof(MSDK_SENSOR_ITEM_INFO_STRUCT
);
2054 case SENSOR_FEATURE_SET_ITEM_INFO
:
2055 OV56702ND_set_sensor_item_info(pSensorItemInfo
->GroupIdx
, pSensorItemInfo
->ItemIdx
, pSensorItemInfo
->ItemValue
);
2056 *pFeatureParaLen
=sizeof(MSDK_SENSOR_ITEM_INFO_STRUCT
);
2059 case SENSOR_FEATURE_GET_ENG_INFO
:
2060 pSensorEngInfo
->SensorId
= 129;
2061 pSensorEngInfo
->SensorType
= CMOS_SENSOR
;
2062 pSensorEngInfo
->SensorOutputDataFormat
=SENSOR_OUTPUT_FORMAT_RAW_B
;
2063 *pFeatureParaLen
=sizeof(MSDK_SENSOR_ENG_INFO_STRUCT
);
2065 case SENSOR_FEATURE_GET_LENS_DRIVER_ID
:
2066 // get the lens driver ID from EEPROM or just return LENS_DRIVER_ID_DO_NOT_CARE
2067 // if EEPROM does not exist in camera module.
2068 *pFeatureReturnPara32
=LENS_DRIVER_ID_DO_NOT_CARE
;
2072 case SENSOR_FEATURE_INITIALIZE_AF
:
2074 case SENSOR_FEATURE_CONSTANT_AF
:
2076 case SENSOR_FEATURE_MOVE_FOCUS_LENS
:
2078 case SENSOR_FEATURE_SET_VIDEO_MODE
:
2079 OV56702NDSetVideoMode(*pFeatureData16
);
2081 case SENSOR_FEATURE_CHECK_SENSOR_ID
:
2082 OV56702NDGetSensorID(pFeatureReturnPara32
);
2084 case SENSOR_FEATURE_SET_AUTO_FLICKER_MODE
:
2085 OV56702NDSetAutoFlickerMode((BOOL
)*pFeatureData16
, *(pFeatureData16
+1));
2087 case SENSOR_FEATURE_SET_MAX_FRAME_RATE_BY_SCENARIO
:
2088 OV56702NDMIPISetMaxFramerateByScenario((MSDK_SCENARIO_ID_ENUM
)*pFeatureData32
, *(pFeatureData32
+1));
2090 case SENSOR_FEATURE_GET_DEFAULT_FRAME_RATE_BY_SCENARIO
:
2091 OV56702NDMIPIGetDefaultFramerateByScenario((MSDK_SCENARIO_ID_ENUM
)*pFeatureData32
, (MUINT32
*)(*(pFeatureData32
+1)));
2093 case SENSOR_FEATURE_SET_TEST_PATTERN
:
2094 OV56702NDSetTestPatternMode((BOOL
)*pFeatureData16
);
2096 case SENSOR_FEATURE_GET_TEST_PATTERN_CHECKSUM_VALUE
://for factory mode auto testing
2097 *pFeatureReturnPara32
=OV56702ND_TEST_PATTERN_CHECKSUM
;
2100 /*SZ TCT xuejian.zhong add for CTS test */
2101 case SENSOR_FEATURE_GET_AF_MAX_NUM_FOCUS_AREAS
:
2102 OV56702NDGetAFMaxNumFocusAreas(pFeatureData32
);
2106 case SENSOR_FEATURE_GET_AE_MAX_NUM_METERING_AREAS
:
2107 OV56702NDGetAEMaxNumMeteringAreas(pFeatureData32
);
2110 case SENSOR_FEATURE_GET_EXIF_INFO
:
2111 // SENSORDB("SENSOR_FEATURE_GET_EXIF_INFO¥n");
2112 // SENSORDB("EXIF addr = 0x%x¥n",*pFeatureData32);
2114 OV56702NDGetExifInfo(*pFeatureData32
);
2116 /* xuejian.zhong add end */
2124 SENSOR_FUNCTION_STRUCT SensorFuncOV56702ND
=
2128 OV56702NDGetResolution
,
2129 OV56702NDFeatureControl
,
2134 UINT32
OV56702ND_MIPI_RAW_SensorInit(PSENSOR_FUNCTION_STRUCT
*pfFunc
)
2137 *pfFunc
=&SensorFuncOV56702ND
;