MTK Camera文件架构

MTK Camera文件架构
Interface path:
.\mediatek\hardware\include\mtkcam\ => 展开如下
- acdk
- exif
- ExtImgProc
- hal
- utils
- v1
.\mediatek\platform\mt6592\hardware\mtkcam\inc => 展开如下
- acdk
- algorithm //关于MTK算法的, 里面有很多目录, 比如:lib3a, libasd, libautopano, libcore, libeis, libfb, libfdft, libflicker等等
- campipe
- camshot
- common
- config
- drv
- featureio
- hwscenario
- imageio
- vssimgtrans
Base-release source path:
.\mediatek\hardware\mtkcam => 展开如下
common
- camutils
- ExtImgProc
- paramsmgr
client
- CamClient
- DisplayClient
device
- CamDevice
- CamDeviceManager
exif
- camera
- common
.\mediatek\platform\mt6592\hardware\mtkcam => 展开如下
acdk
- inc
- src
- acdk
- cct
- surfaceview
common
- camutils
- ExtImgProcHw
- paramsmgr
core
- campipe
- camshot
- drv
- featureio
- hwscenario
- imageio
- vssimgtrans
custom //for custom
- cam_cal
- camera
- eeprom
- flashlight
- imgsensor
- lens
device
- adapter
- client
hal
- adapter
- client
inc

Custom HAL层客制化目录list展开 ==>
.\mediatek\custom\mt6592\hal
aal
camera
- camera
- inc
camerashot
imgsensor //HAL层客制化的sensor设备的效果参数
- imx135_mipi_raw
- ov5648_mipi_raw
- src
……
inc
- aaa
- debug_exif
- isp_tuning
les //HAL层客制化的AF设备的效果参数
- dw9718af
- fm50af
- dummy_lens
……
关于算法的东西看资料好像是放在./mediatek/protect/下的, 但实际没有看到.

MTK Camera驱动移植
A. Kernel层驱动代码文件添加
./mediatek/custom/doov92_wet_tdd/kernel/imgsensor/下添加imx179_mipi_raw_
2lane目录, 该目录list如下:
imx179_mipi_raw_2lane
- imx179mipiraw_Camera_Sensor_para_2lane.h
- imx179mipiraw_CameraCustomized_2lane.h
- imx179mipiraw_Sensor_2lane.c
- imx179mipiraw_Sensor_2lane.h
看了一下, 基本上所有的驱动文件都是这样的格式.
B. 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, 文件会有所增减.
C. 驱动结构添加
./mediatek/custom/common/kernel/imgsensor/src/kd_sensorlist.h:
C.1 UINT32 IMX179_MIPI_RAW_2lane_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);
C.2 ACDK_KD_SENSOR_INIT_FUNCTION_STRUCT kdSensorList[MAX_NUM_OF_
SUPPORT_SENSOR+1] =
{
#if defined(IMX179_MIPI_RAW_2LANE)//add imx179 sensor(front), jintao_20140114_camera_front +++
{IMX179_SENSOR_2LANE_ID, SENSOR_DRVNAME_IMX179_MIPI_RAW, IMX179_MIPI_RAW_2lane_SensorInit},
#endif
……
}
D. 定义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”
E. 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
……
}
F. 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
G. 时序配置
./mediatek/custom/doov92_wet_tdd/kernel/camera/camera/kd_camera_hw.c
else if (currSensorName && (0 == strcmp(currSensorName,”imx179mipiraw_2lane”)))
分别配置上电/下电.
原理图上的PIN脚收集如下.
Main Sensor 控制脚:
CMPDN_MAIN ==>EINT10 ==>Y22 ==>MODE0:GPIO10, MODE1:NONE, MODE2:SCL2
CMRST_MAIN==> EINT9==> Y23==> MODE0:GPIO09, MODE1:NONE, MODE2:SDA2
AF_EN ==> SPI_MO ==> AC9 ==> MODE0:GPIO83, MODE1:SPI_MO
CMMCLK ==> CMMCLK ==> B2 for MCLK
MAINCAM_ID ==> AUX_IN1 ==> AD19 for ID
VCAM_AF ==> VCAM_AF ==> N7 for AF_VDD
VCAMA_PMU ==> VCAMA ==> P3 AVDD 2.8V
VCAMD ==> 对相机输入 ==>for DVDD, VCAMD_LDO_EN控制, 由MTK的PCM_TX(U24)控制
VCAMD_IO_PMU ==> VCAM_IO ==> L13 DOVDD, IOVDD 1.8V
IMX135 规范上的管脚:
VANA==>VDDSUBD, VDDHCM1/2, VDDHSN1/2, VDDHAN, VDDHCP==>2.7V==> AVDD
VIF ==> VDDMCO ==> 1.8V ==> IOVDD
VDIG ==> VDDLCN1/2, VDDLSC1/2/3/4/5, VDDLIO1/2 ==> 1.05V ==> DVDD
IMX179 规范上的管脚:
VANA==>VDDSUBD/VDDHCP/VDDHCM1,2/VDDHAN/VDDHPL/VDDHSN1-3==>2.7V ==> AVDD
VDIG ==> VDDMCO ==> 1.8V ==> IOVDD
VDDL==> VDDLSC1-4/VDDLCN1,2/VDDLIO1,2 ==> 1.2V ==> DVDD
Sub Sensor 控制脚:
SUB_CMPDN ==> EINT18 ==> AD10==> MODE0:GPIO18,MODE1:URTS0,
MODE2:BSI_B_DATA0 PWDN
SUB_CMRST ==> EINT16 ==> AE10 ==> MODE0:GPIO16, MODE1:NONE,
MODE2:DAC_CK Reset
CMMCLK ==> CMMCLK ==> B2 for MCLK
SUB_CAM_ID ==> AUX_XP ==> AE18 ==> for ID
VCAM_AF ==> VCAM_AF ==> N7 ==> for AF_VDD
VCAMA_CON ==> VCAMA ==> P3 ==> AVDD 2.8V, 与main sensor
的VCAMA_PMU共用
VCAMD_PMU ==> VCAMD ==> K14 ==> for DVDD
VCAMD_IO_PMU ==> VCAM_IO ==> L13 ==> for DOVDD, IOVDD 1.8V,
与main sensor的VCAMD_IO_PMU共用
S5K3H7YX 规范上的管脚:
VDDA ==> AVDD 2.8v
VDDIO ==> IOVDD 1.8v
VDDD ==> DVDD 1.2v
H. 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;
}
I. 后摄闪光灯移植
原理图上的FlashLight PIN脚收集如下==>
FlashLight Main:
ENF ==> GPIO12 ==> AG10 ==> GPIO12, MODE0: GPIO12
ENM ==> GPIO13 ==> AF9 ==> GPIO13, MODE0: GPIO13
FlahsLight Sub:
ENF ==> SUBFLASH_EN ==> AD7 ==> SPI_CK, MODE0: GPIO81, MODE1:SPI_CK
ENM==> SUBTORCH_EN ==> AC13==>KPROW0,MODE0:GPIO74,MODE1:KROW0
后摄配置管脚就可以点亮了, 但前摄目前还没有解决, 可能需要单独添加驱动文件.

你可能感兴趣的:(camera)