|
一、驱动源码包结构OV13850摄像头在MTK6592平台,驱动移植方法,拿到的驱动源码包解压后得到hal和kernel两个目录文件,源码目录结构如下所示:
0 A& Z& ]0 f! u. x4 J4 z13850-6592-driver-10-28.7z5 M6 @9 x/ ]/ B* D7 M5 J
|--hal8 u# |: [3 u& ~/ f; r
| |--camera_AE_PLineTable_ov13850mipiraw.h0 |3 Y' Z7 ~9 I3 q7 z
| |--camera_calibration_cam_cal.cpp* E8 s% b/ n! Q- m: s# F0 S
| |--camera_flicker_para_ov13850mipiraw.cpp
' c) a) j5 v8 h U) W8 ?4 Z| |--camera_info_ov13850mipiraw.h$ {. m$ h5 d+ I9 `% m6 S" H
| |--camera_isp_lsc_ov13850mipiraw.h# u. h6 F( h5 r
| |--camera_isp_pca_ov13850mipiraw.h+ Y, e8 Y+ C7 e
| |--camera_isp_regs_ov13850mipiraw.h
6 o* } \3 b& ]4 V v) @0 A) ?| |--camera_tsf_data_ov13850mipiraw.h# {/ x; ~2 K: [6 X5 C3 H
| |--camera_tsf_para_ov13850mipiraw.h
4 F* d0 B6 D C/ ?+ ~+ p0 b6 _* v| |--camera_tuning_para_ov13850mipiraw.cpp9 O8 Q& M# y: o; D* W8 o( k1 ]
| |--config.ftbl.ov13850_mipi_raw.h+ p; p- y3 {% Z/ S2 l5 g: z O5 F
|--kernel; O3 E6 q" w3 R! f' c1 m$ H
| |--ov13850mipiraw_Camera_Sensor_para.h
1 M3 C8 m i( [$ D. F- t| |--ov13850mipiraw_CameraCustomized.h
: O1 }! E) N# M0 V| |--ov13850mipiraw_Sensor.c4 {5 G) J2 h$ q) ^4 S! N4 d
| |--ov13850mipiraw_Sensor.h: l1 \% d: _3 x. b" }; a
% x$ f( O3 F' g5 q9 b( \' H
; t1 I6 J" ]8 I" [) V2 g二、ov13850驱动移植记录3 s2 _8 }$ g7 j: M' r9 d
1、kernel; L7 c/ u1 H% {0 R- e) \( {" W
Sensor: 5 y( C8 k+ G9 d
- 在mediatek\custom\common\kernel\imgsensor\目录下增加ov13850_mipi_raw文件夹,把驱动源码kernel目录中所有文件copy进来。
- 修改mediatek\custom\common\kernel\imgsensor\inc\kd_imgsensor.h文件,增加ov13850 SENSOR_ID和SENSOR_DRVNAME定义
) I ~! r. S0 C8 Y
8 h/ i0 T! V" }8 R' r
- @* u7 w7 y8 D5 s5 F
- #define OV13850_SENSOR_ID 0xD850
- #define SENSOR_DRVNAME_OV13850_MIPI_RAW "ov13850mipiraw" 8 t Y% w" R! }' [7 c3 s' L
t9 X2 f* @1 C& u: Q3 k% }
$ K3 j& V. `0 S
; {$ @& A! ?7 ~: x5 Q5 m" u- 修改mediatek\custom\common\kernel\imgsensor\src\kd_sensorlist.h4 N. a, ^8 L- E, B" x9 h
) u+ w8 e, G' _- T
1 z9 t, ]: R# a% ? T e$ M
增加OV13850_MIPI_RAW_SensorInit函数声明$ J9 p+ a5 K1 q% ?/ J' `
1 v2 d' ?- b0 N4 \3 `/ \; b
- UINT32 OV13850_MIPI_RAW_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc); . U. g6 B. o! E o0 t
% `0 P5 e( M+ I0 Q. a: ]3 C# v; b! Y4 C3 T9 A* C3 U, ?) Q {2 Q
在kdSensorList数组中增加OV13850配置. }/ J: G& ~( R0 @1 R2 }
; W8 |1 {( m- i4 d6 w$ c7 Q' m; S: @" E, W' L6 q" q: [2 n
- ACDK_KD_SENSOR_INIT_FUNCTION_STRUCT kdSensorList[MAX_NUM_OF_SUPPORT_SENSOR+1] =
- {
- ...
- #if defined(OV13850_MIPI_RAW)
- {OV13850_SENSOR_ID, SENSOR_DRVNAME_OV13850_MIPI_RAW, OV13850_MIPI_RAW_SensorInit},
- #endif
- ...
- }
$ O4 K0 r% U7 @% Z! w
# T/ d( D2 ?6 z5 ?3 ^, { }+ T2 M8 i" z
- 在mediatek\custom\wind92_wet_tdd\kernel\camera\camera\kd_camera_hw.c里,增加对OV13850的供电配置,参考OV12830和datasheet。由于OV12830和OV13850供电配置一样,所以copy12830,更改下名字即可。. O7 q$ h) E% r/ G& p) D \+ f* l
$ l0 T# \! ^2 n9 v! m( `% j5 t
: C( i2 l _* }9 v7 N; p) s- int kdCISModulePowerOn(CAMERA_DUAL_CAMERA_SENSOR_ENUM SensorIdx, char *currSensorName, BOOL On, char* mode_name)
- {
- //...
- else if (currSensorName && (0 == strcmp(SENSOR_DRVNAME_OV13850_MIPI_RAW,currSensorName)))
- {
- printk("MYCAT kdCISModulePowerOn SENSOR_DRVNAME_OV13850_MIPI_RAW \n");
- printk("MYCAT OV13850_RAW idx:%d \n",SensorIdx);
- #ifdef __MAINSENSOR_USE_LDO_1_2V__
-
- if (mt_set_gpio_pull_enable(CAMERA_POWER_VCAM_D_LDO_PIN, GPIO_PULL_DISABLE)) {PK_DBG("[CAMERA SENSOR] CAMERA_POWER_VCAM_D_LDO_PIN pull failed! \n"); }
- if (mt_set_gpio_mode(CAMERA_POWER_VCAM_D_LDO_PIN, GPIO_MODE_00)){PK_DBG("[CAMERA SENSOR] CAMERA_POWER_VCAM_D_LDO_PIN mode failed! \n");}
- if (mt_set_gpio_dir(CAMERA_POWER_VCAM_D_LDO_PIN,GPIO_DIR_OUT)) {PK_DBG("[CAMERA SENSOR] CAMERA_POWER_VCAM_D_LDO_PIN dir failed! \n");}
- if (mt_set_gpio_out(CAMERA_POWER_VCAM_D_LDO_PIN,GPIO_OUT_ONE)) {PK_DBG("[CAMERA SENSOR] CAMERA_POWER_VCAM_D_LDO_PIN out failed! \n");}
-
- #else
-
- // printk("MYCAT S5KH2_RAW POWER ON LDO D\n");
- if (TRUE != hwPowerOn(CAMERA_POWER_VCAM_D, VOL_1200,mode_name))
- {
- PK_DBG("[CAMERA SENSOR] Fail to enable digital power\n");
- //return -EIO;
- goto _kdCISModulePowerOn_exit_;
- }
-
-
- #endif
-
- //printk("MYCAT S5KH2_RAW POWER ON LDO A\n");
-
- if (TRUE != hwPowerOn(CAMERA_POWER_VCAM_A, VOL_2800,mode_name))
- {
- <span style="white-space:pre"> </span> PK_DBG("[CAMERA SENSOR] Fail to enable analog power\n");
- //return -EIO;
- goto _kdCISModulePowerOn_exit_;
- }
-
- //printk("MYCAT S5KH2_RAW POWER ON LDO D2\n");
-
- if (TRUE != hwPowerOn(CAMERA_POWER_VCAM_D2, VOL_1800,mode_name))
- {
- PK_DBG("[CAMERA SENSOR] Fail to enable digital power\n");
- //return -EIO;
- goto _kdCISModulePowerOn_exit_;
- }
- //printk("MYCAT S5KH2_RAW POWER ON LDO A2\n");
- if (TRUE != hwPowerOn(CAMERA_POWER_VCAM_A2, VOL_2800,mode_name))
- {
- PK_DBG("[CAMERA SENSOR] Fail to enable analog power\n");
- //return -EIO;
- goto _kdCISModulePowerOn_exit_;
- }
- msleep(5);
-
- //disable inactive sensor
- if (pinSetIdx == 0 || pinSetIdx == 2)
- {//disable sub
- <span style="white-space:pre"> </span>if (GPIO_CAMERA_INVALID != pinSet[1][IDX_PS_CMRST])
- {
- if (mt_set_gpio_mode(pinSet[1][IDX_PS_CMRST],pinSet[1][IDX_PS_CMRST+IDX_PS_MODE])){PK_DBG("[CAMERA SENSOR] set gpio mode failed!! \n");}
- if (mt_set_gpio_mode(pinSet[1][IDX_PS_CMPDN],pinSet[1][IDX_PS_CMPDN+IDX_PS_MODE])){PK_DBG("[CAMERA LENS] set gpio mode failed!! \n");}
- if (mt_set_gpio_dir(pinSet[1][IDX_PS_CMRST],GPIO_DIR_OUT)){PK_DBG("[CAMERA SENSOR] set gpio dir failed!! \n");}
- if (mt_set_gpio_dir(pinSet[1][IDX_PS_CMPDN],GPIO_DIR_OUT)){PK_DBG("[CAMERA LENS] set gpio dir failed!! \n");}
- if (mt_set_gpio_out(pinSet[1][IDX_PS_CMRST],pinSet[1][IDX_PS_CMRST+IDX_PS_OFF])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");} //low == reset sensor
- if (mt_set_gpio_out(pinSet[1][IDX_PS_CMPDN],pinSet[1][IDX_PS_CMPDN+IDX_PS_OFF])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} //high == power down lens module
- }
- }
- else
- {
- if (GPIO_CAMERA_INVALID != pinSet[0][IDX_PS_CMRST])
- {
- if (mt_set_gpio_mode(pinSet[0][IDX_PS_CMRST],pinSet[0][IDX_PS_CMRST+IDX_PS_MODE])){PK_DBG("[CAMERA SENSOR] set gpio mode failed!! \n");}
- if (mt_set_gpio_mode(pinSet[0][IDX_PS_CMPDN],pinSet[0][IDX_PS_CMPDN+IDX_PS_MODE])){PK_DBG("[CAMERA LENS] set gpio mode failed!! \n");}
- if (mt_set_gpio_dir(pinSet[0][IDX_PS_CMRST],GPIO_DIR_OUT)){PK_DBG("[CAMERA SENSOR] set gpio dir failed!! \n");}
- if (mt_set_gpio_dir(pinSet[0][IDX_PS_CMPDN],GPIO_DIR_OUT)){PK_DBG("[CAMERA LENS] set gpio dir failed!! \n");}
- if (mt_set_gpio_out(pinSet[0][IDX_PS_CMRST],pinSet[0][IDX_PS_CMRST+IDX_PS_OFF])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");} //low == reset sensor
- if (mt_set_gpio_out(pinSet[0][IDX_PS_CMPDN],pinSet[0][IDX_PS_CMPDN+IDX_PS_OFF])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} //high == power down lens module
- }
- if (GPIO_CAMERA_INVALID != pinSet[2][IDX_PS_CMRST])
- {
-
- }
- }
- //PDN/STBY pin
- if (GPIO_CAMERA_INVALID != pinSet[pinSetIdx][IDX_PS_CMRST])
- {
- if (mt_set_gpio_mode(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_MODE])){PK_DBG("[CAMERA SENSOR] set gpio mode failed!! \n");}
- if (mt_set_gpio_dir(pinSet[pinSetIdx][IDX_PS_CMRST],GPIO_DIR_OUT)){PK_DBG("[CAMERA SENSOR] set gpio dir failed!! \n");}
- if (mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_OFF])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");}
- //PDN pin
- if (mt_set_gpio_mode(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_MODE])){PK_DBG("[CAMERA LENS] set gpio mode failed!! \n");}
- if (mt_set_gpio_dir(pinSet[pinSetIdx][IDX_PS_CMPDN],GPIO_DIR_OUT)){PK_DBG("[CAMERA LENS] set gpio dir failed!! \n");}
- if (mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_OFF])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");}
- msleep(1);
- if (mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_ON])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");}
- msleep(1);
- if (mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_ON])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");}
- msleep(1);
- printk("OV13850 PWN RST\n");
- }
- }
- //...
5 C; r7 D5 `! t u/ I4 a- I! n6 c3 x7 @, I) W
8 k# Y4 p& f' E1 Y
# v& g" i. e- Z9 t/ Q6 L
Lens:
/ K. ?( |4 v5 d+ c% e l$ m- 在mediatek\custom\common\kernel\lens\目录下参照ov12830af,增加ov13850af 目录和驱动源码OV13850AF.c。
- mediatek\custom\common\kernel\lens\inc\目录下参照ov12830af,增加ov13850af目录和OV13850AF.h头文件
) a/ g! }6 Z* D& V% o w9 F6 w/ \
& I: |5 D9 G o( h! Q
2、HAL$ }9 C- N& J: d+ M8 l0 s5 Z
Sensor: " a: h6 A7 n) R$ ], x! Y' b4 e
- 在mediatek\custom\mt6592\hal\imgsensor\目录下增加ov13850_mipi_raw文件夹,将OV13850驱动源码包中的hal下文件,copy到该文件夹下。
- 修改mediatek\custom\common\hal\imgsensor\src\sensorlist.cpp增加OV13850的SensorList描述项。. r0 `/ d h7 l- F; U; Y* A
) q5 }1 C& C$ s4 }6 W+ i( S& b: X7 b; E8 m' v
- MSDK_SENSOR_INIT_FUNCTION_STRUCT SensorList[] =
- {
- ...
- #if defined(OV13850_MIPI_RAW)
- RAW_INFO(OV13850_SENSOR_ID, SENSOR_DRVNAME_OV13850_MIPI_RAW,NULL),
- #endif
- ...
- } $ E$ u7 s6 `. L5 X1 v. x
8 P/ B- f# b& ]: J' }. Z
Lens: ) q. h, J9 ~4 ~
- 在mediatek\custom\common\hal\lens\下,增加ov13850af目录,参照ov12830增加lens_para_OV13850AF.cpp
- 修改mediatek\custom\out\wind92_wet_tdd\hal\lens\src\Lenslist.cpp在LensList数组项里增加OV13850AF描述项。
0 c! J" F! V' C Q8 J
( W) j* K% P. s: X
1 C8 m/ h5 b* y/ S
; e" X6 Q6 B7 `# @- #if defined(OV13850AF)
- extern PFUNC_GETLENSDEFAULT pOV13850AF_getDefaultData;
- #endif $ t& p9 n) A- D2 a
" A/ O# r3 P$ R- A8 x2 u7 J MSDK_LENS_INIT_FUNCTION_STRUCT LensList[MAX_NUM_OF_SUPPORT_LENS] =
7 D. @$ A' ]% u3 x/ ~" z+ M9 e: S; M3 z5 m5 a
- {
- ...
- #if defined(OV13850AF)
- {OV13850_SENSOR_ID, OV13850AF_LENS_ID, "OV13850AF", pOV13850AF_getDefaultData},
- #endif
- ...
- } 2 f" T+ \7 g4 t5 P+ L
7 u( E5 i3 a# z0 K, `; `/ `
- 修改camera_custom_lens.h,增加OV13850_LENS_ID,这里根据序号累加。* G" i: g5 t5 j+ B2 Q1 X( a
7 q5 y& c8 z4 l8 @- {9 k0 }2 t+ A( J& J4 a$ `1 T
' f0 `1 e! H2 h3 d1 Q; D- #define OV13850AF_LENS_ID 0x0008
3 S1 a) I8 p& I! a8 A 3 {6 x w8 P, j c; D+ Y6 N2 M, o
3、修改ProductConfig.mk
8 s. k4 t9 ~3 Q1 n# O- CUSTOM_HAL_IMGSENSOR= ov13850_mipi_raw ov5648_mipi_raw
- CUSTOM_HAL_LENS= ov13850af dummy_lens
- CUSTOM_HAL_MAIN_IMGSENSOR= ov13850_mipi_raw
- CUSTOM_HAL_MAIN_LENS= ov13850af
- CUSTOM_KERNEL_IMGSENSOR= ov13850_mipi_raw ov5648_mipi_raw
- CUSTOM_KERNEL_LENS= ov13850af dummy_lens
- CUSTOM_KERNEL_MAIN_IMGSENSOR= ov13850_mipi_raw
- CUSTOM_KERNEL_MAIN_LENS= ov13850af 7 | H6 L1 p$ ]5 E
: k* V" m2 G* w* h3 \5 S; F d: l( g+ P4 o/ m/ |; w7 @
4、最后要修改init.rc 更改OV13850AF设备文件的权限,否则在open的时候会失败。
* \8 Z( f3 \* V |
|