MTK 移植camera说明


1、 裁剪模块

修改文件:config/tf902/ProjectConfig.mk

Eg\

config/tf902/ProjectConfig.mk

````````````````````````````````````````````

 CUSTOM_HAL_EEPROM = dummy_eeprom

 CUSTOM_HAL_FLASHLIGHT = constant_flashlight

 CUSTOM_HAL_FMRADIO = mt6628

-CUSTOM_HAL_IMGSENSOR = ov8825_mipi_raw s5k8aayx_mipi_yuv

+CUSTOM_HAL_IMGSENSOR = gc2235mipi_raw gc0313mipi_yuv#ov8825_mipi_raw s5k8aayx_mipi_yuv  #添加摄像头模块,定义hal

 CUSTOM_HAL_LENS = ov8825af dummy_lens

 CUSTOM_HAL_MAIN2_IMGSENSOR = 

 CUSTOM_HAL_MAIN_BACKUP_IMGSENSOR = 

 CUSTOM_HAL_MAIN_BACKUP_LENS = dummy_lens

-CUSTOM_HAL_MAIN_IMGSENSOR = ov8825_mipi_raw 

+CUSTOM_HAL_MAIN_IMGSENSOR = gc2235mipi_raw #ov8825_mipi_raw  #主摄像头在hal层的修改

 CUSTOM_HAL_MAIN_LENS = ov8825af

 CUSTOM_HAL_MSENSORLIB = mmc328x akm8975 ami304 yamaha530 mag3110 akmd8963 bmm050

 CUSTOM_HAL_SENSORS = sensor

 CUSTOM_HAL_SUB_BACKUP_IMGSENSOR = 

 CUSTOM_HAL_SUB_BACKUP_LENS = dummy_lens

-CUSTOM_HAL_SUB_IMGSENSOR = s5k8aayx_mipi_yuv

+CUSTOM_HAL_SUB_IMGSENSOR = gc0313mipi_yuv #s5k8aayx_mipi_yuv   #副摄像头在hal层的定义

CUSTOM_HAL_SUB_LENS = dummy_lens

 CUSTOM_KERNEL_ACCELEROMETER = bma050

 CUSTOM_KERNEL_ALSPS = cm36283

@@ -79,7 +79,7 @@ CUSTOM_KERNEL_FLASHLIGHT = constant_flashlight

 CUSTOM_KERNEL_FM = mt6628

 CUSTOM_KERNEL_HDMI = 

 CUSTOM_KERNEL_HEADSET = accdet

-CUSTOM_KERNEL_IMGSENSOR = ov8825_mipi_raw s5k8aayx_mipi_yuv

+CUSTOM_KERNEL_IMGSENSOR = gc2235mipi_raw gc0313mipi_yuv#ov8825_mipi_raw s5k8aayx_mipi_yuv   #添加摄像头在kernal 模块

 

 CUSTOM_KERNEL_KPD = kpd

 CUSTOM_KERNEL_LCM = bi097xn02_xga_dpi

 CUSTOM_KERNEL_LEDS = mt65xx

+CUSTOM_KERNEL_MAIN_IMGSENSOR = gc2235mipi_raw #ov8825_mipi_raw #在底层定义主摄像头

 CUSTOM_KERNEL_MAIN_LENS = ov8825af

 CUSTOM_KERNEL_RTC = rtc

 CUSTOM_KERNEL_SOUND = amp_6320pmic_spk

 CUSTOM_KERNEL_SSW = ssw_generic

 CUSTOM_KERNEL_SUB_BACKUP_IMGSENSOR = 

 CUSTOM_KERNEL_SUB_BACKUP_LENS = dummy_lens

-CUSTOM_KERNEL_SUB_IMGSENSOR = s5k8aayx_mipi_yuv

+CUSTOM_KERNEL_SUB_IMGSENSOR = gc0313mipi_yuv#s5k8aayx_mipi_yuv  #在底层定义副摄像头

 CUSTOM_KERNEL_SUB_LENS = dummy_lens

 CUSTOM_KERNEL_TOUCHPANEL = GT82X #cy8ctma300 GT818B-fpga

 CUSTOM_KERNEL_USB = mt6577

 

上面的修改是在平台没有默认AF(自动对焦)的功能(mtk6517mtk6577\mtk6572的平台没有默认AF功能),mtk6589的平台默认就支持AF功能。如果移植的摄像头没有AF功能就必须将默认的AF功能屏蔽掉(否则在DMA操作数据的时候很多的算法受影响,将在切换的时候很卡)!

在没有AF功能,就将全部设置成dummy_lensov8825af 指的是自动对焦功能。

 

config/tf902/ProjectConfig.mk

·························

CUSTOM_HAL_EEPROM = dummy_eeprom

 CUSTOM_HAL_FLASHLIGHT = constant_flashlight

 CUSTOM_HAL_FMRADIO = mt6628

 CUSTOM_HAL_IMGSENSOR = gc2235mipi_raw gc0313mipi_yuv#ov8825_mipi_raw s5k8aayx_mipi_yuv

-CUSTOM_HAL_LENS = ov8825af dummy_lens

+CUSTOM_HAL_LENS = dummy_lens #ov8825af #hal层的副摄像头自动对焦设置

 CUSTOM_HAL_MAIN2_IMGSENSOR = 

 CUSTOM_HAL_MAIN_BACKUP_IMGSENSOR = 

 CUSTOM_HAL_MAIN_BACKUP_LENS = dummy_lens

 CUSTOM_HAL_MAIN_IMGSENSOR = gc2235mipi_raw #ov8825_mipi_raw

-CUSTOM_HAL_MAIN_LENS = ov8825af

+CUSTOM_HAL_MAIN_LENS =dummy_lens # ov8825af  #hal层主摄像头的自动对焦功能

 CUSTOM_HAL_MSENSORLIB = mmc328x akm8975 ami304 yamaha530 mag3110 akmd8963 bmm050

 CUSTOM_HAL_SENSORS = sensor

 CUSTOM_HAL_SUB_BACKUP_IMGSENSOR = 

··························

 CUSTOM_KERNEL_IMGSENSOR = gc2235mipi_raw gc0313mipi_yuv#ov8825_mipi_raw s5k8aayx

 CUSTOM_KERNEL_KPD = kpd

 CUSTOM_KERNEL_LCM = bi097xn02_xga_dpi

 CUSTOM_KERNEL_LEDS = mt65xx

-CUSTOM_KERNEL_LENS = ov8825af dummy_lens  

+CUSTOM_KERNEL_LENS =  dummy_lens #ov8825af   # KERNEL中副摄像头的自动对焦功能

 CUSTOM_KERNEL_MAGNETOMETER =

 CUSTOM_KERNEL_MAIN2_BACKUP_IMGSENSOR = 

 CUSTOM_KERNEL_MAIN2_IMGSENSOR = 

 CUSTOM_KERNEL_MAIN_BACKUP_IMGSENSOR = 

 CUSTOM_KERNEL_MAIN_BACKUP_LENS = dummy_lens

 CUSTOM_KERNEL_MAIN_IMGSENSOR = gc2235mipi_raw #ov8825_mipi_raw

-CUSTOM_KERNEL_MAIN_LENS = ov8825af

+CUSTOM_KERNEL_MAIN_LENS = dummy_lens #ov8825af  #KERNEL中主摄像头的自动对焦功能

 CUSTOM_KERNEL_RTC = rtc

 

2、  将custom/common/hal/imgsensor/中添加相应模块的hal层代码

在custom/common/kernel/imgsensor/中添加相应模块的Kernal层的代码

3、  SensorList[]的数据通过宏定义的判断,查看目前可能的摄像头的数量。同时框架层也是通过这个变量来获取摄像头的数量。

custom/common/hal/imgsensor/src/sensorlist.cpp

··········································

 MSDK_SENSOR_INIT_FUNCTION_STRUCT SensorList[] =

     RAW_INFO(IMX073_SENSOR_ID, SENSOR_DRVNAME_IMX073_MIPI_RAW,CAM_CALGetCalData),

 #endif

 

+#if defined(GC2235MIPI_RAW)

+    RAW_INFO(GC2235MIPI_SENSOR_ID, SENSOR_DRVNAME_GC2235MIPI_RAW, NULL), 

+#endif

+

+#if defined(GC0313MIPI_YUV)

+    RAW_INFO(GC0313MIPI_SENSOR_ID, SENSOR_DRVNAME_GC0313MIPI_YUV, NULL), 

+#endif

+

 #if defined(OV8825_MIPI_RAW)

     RAW_INFO(OV8825_SENSOR_ID, SENSOR_DRVNAME_OV8825_MIPI_RAW,CAM_CALGetCalData), 

 #endif

4、  custom/common/kernel/imgsensor/inc/kd_imgsensor.h 定义设备ID,定义一个摄像头的名字,这个名字对移植的成功与否问题不大

custom/common/kernel/imgsensor/inc/kd_imgsensor.h

·······································

 #define OV8830_SENSOR_ID                         0x8830

 #define OV9726_SENSOR_ID                          0x9726

 #define A5141MIPI_SENSOR_ID                     0x4800

-

+#define GC2235MIPI_SENSOR_ID        0X2235

+#define GC0313MIPI_SENSOR_ID        0XD0

 /* CAMERA DRIVER NAME */

 #define CAMERA_HW_DEVNAME            "kd_camera_hw"

 

·······································

 #define SENSOR_DRVNAME_HI542_RAW   "hi542raw"

 #define SENSOR_DRVNAME_HI542MIPI_RAW   "hi542mipiraw"

 

+#define SENSOR_DRVNAME_GC2235MIPI_RAW "gc2235mipiraw"

+#define SENSOR_DRVNAME_GC0313MIPI_YUV "gc0313mipiyuv"

+

 #define SENSOR_DRVNAME_OV5647MIPI_RAW          "ov5647mipiraw"

 #define SENSOR_DRVNAME_HM3451_RAW              "hm3451raw"

 

5、  为系统提供驱动调用的接口

其中必须注意上下的顺序必须一致!

 custom/common/kernel/imgsensor/src/kd_sensorlist.h

@@ -53,7 +53,8 @@ UINT32 OV12830_MIPI_RAW_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);

 UINT32 S5K3H7Y_MIPI_RAW_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);

 UINT32 S5K8AAYX_MIPI_YUV_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);

 UINT32 OV9740_MIPI_YUV_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);

-

//一定要注意下面定义时 要和硬件的数据格式匹配

+UINT32 GC0313MIPI_YUV_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);

+UINT32 GC2235MIPISensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);

 //! Add Sensor Init function here

 //! Note:

 //! 1. Add by the resolution from ""large to small"", due to large sensor

@@ -62,6 +63,13 @@ UINT32 OV9740_MIPI_YUV_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);

 //! 2. This file should be the same as mediatek\custom\common\hal\imgsensor\src\sensorlist.cpp

 ACDK_KD_SENSOR_INIT_FUNCTION_STRUCT kdSensorList[MAX_NUM_OF_SUPPORT_SENSOR+1] =

 {

//和上面定义顺序一致

+#if defined(GC2235MIPI_RAW)

+    {GC2235MIPI_SENSOR_ID, SENSOR_DRVNAME_GC2235MIPI_RAW, GC2235MIPISensorInit}, 

+#endif

+

+#if defined(GC0313MIPI_YUV)

+    {GC0313MIPI_SENSOR_ID, SENSOR_DRVNAME_GC0313MIPI_YUV, GC0313MIPI_YUV_SensorInit}, 

+#endif

 #if defined(OV8830_RAW)

     {OV8830_SENSOR_ID, SENSOR_DRVNAME_OV8830_RAW, OV8830SensorInit}, 

 #endif

 

6、  修改电源

参考datasheet上的时序。注意顺序,注意电源的大小,注意要关闭电源,注意时序。

7、  配置GPIO

数据口和时钟口通常采用默认;

电源引脚在代码里面进行设置,不需要直接配置。

 

8、  

9、 

 

 

 

 

 

你可能感兴趣的:(mtk,驱动)