拿到的驱动源码包解压后得到hal和kernel两个目录文件,源码目录结构如下所示
13850-6592-driver-10-28.7z
|--hal
| |--camera_AE_PLineTable_ov13850mipiraw.h
| |--camera_calibration_cam_cal.cpp
| |--camera_flicker_para_ov13850mipiraw.cpp
| |--camera_info_ov13850mipiraw.h
| |--camera_isp_lsc_ov13850mipiraw.h
| |--camera_isp_pca_ov13850mipiraw.h
| |--camera_isp_regs_ov13850mipiraw.h
| |--camera_tsf_data_ov13850mipiraw.h
| |--camera_tsf_para_ov13850mipiraw.h
| |--camera_tuning_para_ov13850mipiraw.cpp
| |--config.ftbl.ov13850_mipi_raw.h
|--kernel
| |--ov13850mipiraw_Camera_Sensor_para.h
| |--ov13850mipiraw_CameraCustomized.h
| |--ov13850mipiraw_Sensor.c
| |--ov13850mipiraw_Sensor.h
Sensor:
- #define OV13850_SENSOR_ID 0xD850
- #define SENSOR_DRVNAME_OV13850_MIPI_RAW "ov13850mipiraw"
增加OV13850_MIPI_RAW_SensorInit函数声明
- UINT32 OV13850_MIPI_RAW_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);
在kdSensorList数组中增加OV13850配置
- 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
- ...
- }
- 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))
- {
- "white-space:pre"> 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
- "white-space:pre"> 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");
- }
- }
- //...
Lens:
mediatek\custom\common\kernel\lens\inc\目录下参照ov12830af,增加ov13850af目录和OV13850AF.h头文件
Sensor:
- MSDK_SENSOR_INIT_FUNCTION_STRUCT SensorList[] =
- {
- ...
- #if defined(OV13850_MIPI_RAW)
- RAW_INFO(OV13850_SENSOR_ID, SENSOR_DRVNAME_OV13850_MIPI_RAW,NULL),
- #endif
- ...
- }
Lens:
MSDK_LENS_INIT_FUNCTION_STRUCT LensList[MAX_NUM_OF_SUPPORT_LENS] =
- #if defined(OV13850AF)
- extern PFUNC_GETLENSDEFAULT pOV13850AF_getDefaultData;
- #endif
- {
- ...
- #if defined(OV13850AF)
- {OV13850_SENSOR_ID, OV13850AF_LENS_ID, "OV13850AF", pOV13850AF_getDefaultData},
- #endif
- ...
- }
- #define OV13850AF_LENS_ID 0x0008
3、修改ProductConfig.mk
4、最后要修改init.rc 更改OV13850AF设备文件的权限,否则在open的时候会失败。
- 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