mtk camera 移植步骤:
1, Kernel层驱动代码文件添加
/mediatek/custom/doov92_wet_tdd/kernel/imgsensor/下添加imx179_mipi_raw_
2lane/ 目录如下:
imx179_mipi_raw_2lane
- imx179mipiraw_Camera_Sensor_para_2lane.h
- imx179mipiraw_CameraCustomized_2lane.h
- imx179mipiraw_Sensor_2lane.c
- imx179mipiraw_Sensor_2lane.h
看了一下, 基本上所有的驱动文件都是这样的格式.
2, HAL层效果参数文件添加
/mediatek/custom/mt6592/hal/imgsensor/下添加imx179_mipi_raw_2lane目录,该目录list如下:
imx179_mipi_raw_2lane
- camera_AE_PLineTable_imx179raw_2lane.h
- camera_calibration_cam_cal_2lane.cpp
- camera_flicker_para_imx179raw_2lane.cpp
- camera_info_imx179raw_2lane.h
- camera_isp_lsc_imx179raw_2lane.h
- camera_isp_pca_imx179raw_2lane.h
- camera_isp_regs_imx179raw_2lane.h
- camera_tsf_data_imx179raw_2lane.h
- camera_tsf_para_imx179raw_2lane.h
- camera_tuning_para_imx179raw_2lane.cpp
- config.ftbl.imx179_mipi_raw_2lane.h
根据具体的sensor, 文件会有所增减.
3, 驱动结构添加
./mediatek/custom/common/kernel/imgsensor/src/kd_sensorlist.H:
1)UINT32 IMX179_MIPI_RAW_2lane_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);
2) ACDK_KD_SENSOR_INIT_FUNCTION_STRUCT kdSensorList[MAX_NUM_OF_SUPPORT_SENSOR+1] =
{
#if defined(IMX179_MIPI_RAW_2LANE)//addimx179sensor(front), jintao_20140114_camera_front +++
{IMX179_SENSOR_2LANE_ID, SENSOR_DRVNAME_IMX179_MIPI_RAW, IMX179_MIPI_RAW_2lane_SensorInit},
#endif
......
}
4, 定义ID和drv name
./mediatek/custom/common/kernel/imgsensor/inc/kd_imgsensor.h:
#define IMX179_SENSOR_2LANE_ID 0x0179
#define SENSOR_DRVNAME_IMX179_MIPI_RAW "imx179mipiraw_2lane"
5, HAL层ID与drv name的衔接
./mediatek/custom/common/hal/imgsensor/src/sensorlist.cpp
MSDK_SENSOR_INIT_FUNCTION_STRUCT SensorList[] =
{
#if defined(IMX179_MIPI_RAW_2LANE)//add imx179 sensor(front), jintao_20140114_camera_front +++
RAW_INFO(IMX179_SENSOR_2LANE_ID, SENSOR_DRVNAME_IMX179_MIPI_RAW, NULL),
#endif
......
}
6, Camera Sensor宏配置
/mediatek/config/doov92_wet_tdd/ProjectConfig.mk ==配置
CUSTOM_HAL_IMGSENSOR=imx135_mipi_raw imx179_mipi_raw_2lane
CUSTOM_HAL_SUB_IMGSENSOR=imx179_mipi_raw_2lane
CUSTOM_KERNEL_IMGSENSOR=imx135_mipi_raw imx179_mipi_raw_2lane
CUSTOM_KERNEL_SUB_IMGSENSOR=imx179_mipi_raw_2lane
7,时序配置
./mediatek/custom/doov92_wet_tdd/kernel/camera/camera/kd_camera_hw.c
else if (currSensorName && (0 == strcmp(currSensorName,"imx179mipiraw_2lane")))
分别配置上电/下电. 原理图上的PIN脚收集如下.
Main Sensor 控制脚:
CMRST_MAIN CMPDN_MAIN
VCAM_AF AF_EN
VCAMD VCAMA
VCAMIO
SCL SDA
CMMCLK
MIPI-RDP0 MIPI-RDN0
MIPI-RDP1 MIPI-RDN1
MIPI-RDP2 MIPI-RDN2
MIPI-RDP3 MIPI-RDN3
MIPI-RCP MIPI-RCN
F-LED+
F-LED1-
F-LED2-
8,Camera预览/拍照储存照片的方向改变
./mediatek/custom/doov92_wet_tdd/hal/imgsensor/src/cfg_setting_imgsensor.cpp //改的是这个
SensorOrientation_T const&
getSensorOrientation()
{
static SensorOrientation_T const inst = {
u4Degree_0 : 270, // main sensor in degree (0, 90, 180, 270), 后摄的方向配置.
u4Degree_1 : 270, // sub sensor in degree (0, 90, 180, 270), 前摄的方向配置.
u4Degree_2 : 90, // main2 sensor in degree (0, 90, 180, 270), 主设2的方向配置.
};
return inst;
}