|
发表于 2020-8-8 11:55:39
3598 浏览 3 回复
MTK CAMERA PORTING
本帖最后由 chenzq 于 2020-8-11 13:48 编辑
MTK平台添加一个新的camera的流程:MTK camera移植主要分为三个部分:配置文件的添加、kernel驱动代码、hal代码,不同平台代码路径可能不一致,但是大体上是相同的,以下说明仅供参考:
配置文件中添加需要点亮的摄像头型号
Config file path:
alps-xxx-xx.xxx-Vx.x\kernel-x.xx\arch\arm64(arm)\configs\xxx_defconfig
alps\device\mediatek\$project\ProjectConfig.mk
添加对应摄像头型号hal效果文件
hal file path:
project:
alps-xxx-xx.xxx-Vx.x\vendor\mediatek\proprietary\custom\(platform)\hal\imgsensor\ver1
alps-xxx-xx.xxx-Vx.x\vendor\mediatek\proprietary\custom\(platform)\hal\imgsensor_src
common:
alps-xxx-xx.xxx-Vx.x\vendor\mediatek\proprietary\custom\common\hal\imgsensor_metadata
alps-xxx-xx.xxx-Vx.x\device\mediatek\common\kernel-headers
添加对应摄像头型号驱动文件
kernel file path:
alps-xxx-xx.xxx-Vx.x\kernel-xxx\drivers\misc\mediatek\imgsensor\src\common\v1_1
alps-xxx-xx.xxx-Vx.x\kernel-xxx\drivers\misc\mediatek\imgsensor\src\mtxxx
配置摄像头I2C通道和摄像头对应的vcam LDO电压
dws file path
alps-xxx-xx.xxx-Vx.x\kernel-xxx\drivers\misc\mediatek\dws\mtxxx\(project).dws
alps-xxx-xx.xxx-Vx.x\vendor\mediatek\proprietary\bootable\bootloader\preloader\custom\xxxx_bsp\dct\dct\(project).dws
dts file path
alps-xxx-xx.xxx-Vx.x\kernel-xxx\arch\arm64\boot\dts\mediatek\(project).dts
camera hw ptah
alps-xxx-xx.xxx-Vx.x\kernel-xxx\drivers\misc\mediatek\imgsensor\src\(platform)\camera_hw
|
|
|
|
|
|
|
|
楼主|
发表于 2020-8-8 12:35:51
本帖最后由 chenzq 于 2020-8-11 11:53 编辑
摄像头配置文件说明:
path:alps\device\mediatek\$project\ProjectConfig.mk:
示例:
CUSTOM_HAL_IMGSENSOR = imx230_mipi_raw
CUSTOM_HAL_MAIN_IMGSENSOR = imx230_mipi_raw
CUSTOM_KERNEL_IMGSENSOR = imx230_mipi_raw
CUSTOM_KERNEL_MAIN_IMGSENSOR = imx230_mipi_raw
path:alps-xxx-xx.xxx-Vx.x\kernel-x.xx\arch\arm64(arm)\configs\xxx_defconfig:
示例:
CONFIG_CUSTOM_KERNEL_IMGSENSOR="imx230_mipi_raw"
驱动文件添加说明:
path:alps-xxx-xx.xxx-Vx.x\kernel-xxx\drivers\misc\mediatek\imgsensor\src\common\v1_1在该目录下添加对应的驱动文件:
imx230_mipi_raw驱动文件
path:alps-release-q0.mp1-V8.4\kernel-4.14\drivers\misc\mediatek\imgsensor\inc\kd_imgsensor.h,定义sensor ID和sensor name:
#define SENSOR_DRVNAME_IMX230_MIPI_RAW "imx230_mipi_raw"
#define IMX230_SENSOR_ID 0x0230
path:alps-release-q0.mp1-V8.4\kernel-4.14\drivers\misc\mediatek\imgsensor\src\common\v1_1\imgsensor_sensor_list.c,数组gimgsensor_sensor_list[]中加入对应的摄像头传感器:
#if defined(IMX230_MIPI_RAW)
{IMX230_SENSOR_ID, SENSOR_DRVNAME_IMX230_MIPI_RAW, IMX230_MIPI_RAW_SensorInit},
#endif
path:alps-release-q0.mp1-V8.4\kernel-4.14\drivers\misc\mediatek\imgsensor\src\common\v1_1\imgsensor_sensor_list.h
UINT32 IMX230_MIPI_RAW_SensorInit(struct SENSOR_FUNCTION_STRUCT **pfFunc);
|
|
|
|
|
|
|
|
楼主|
发表于 2020-8-11 13:40:11
hal添加驱动文件说明
path:alps-xxx-xx.xxx-Vx.x\vendor\mediatek\proprietary\custom\(platform)\hal\imgsensor\ver1\
在该目录下添加imx230硬件驱动层文件
path:alps-xxx-xx.xxx-Vx.x\vendor\mediatek\proprietary\custom\(platform)\hal\imgsensor_src\sensorlist.cpp添加具体imgsensor的驱动
#if defined(IMX230_MIPI_RAW)
RAW_INFO_M(IMX230_SENSOR_ID, DEFAULT_MODULE_INDEX, DEFAULT_MODULE_ID, SENSOR_DRVNAME_IMX230_MIPI_RAW,CAM_CALGetCalData/*NULL*/),
#endif
path:alps-xxx-xx.xxx-Vx.x\device\mediatek\common\kernel-headers\kd_imgsensor.h定义sensor ID和sensor name
#define IMX230_SENSOR_ID 0x0230
#define SENSOR_DRVNAME_IMX230_MIPI_RAW "imx230_mipi_raw"
path:alps-xxx-xx.xxx-Vx.x\vendor\mediatek\proprietary\custom\common\hal\imgsensor_metadata\sensor\xxx_mipi_raw\在改目录下添加该摄像头的meta_data文件
config_static_metadata.sensor.xxxmipiraw.h
|
|
|
|
|
|
|
|
楼主|
发表于 2020-8-11 13:54:37
camera power 配置说明:
path:alps-xxx-xx.xxx-Vx.x\kernel-xxx\drivers\misc\mediatek\imgsensor\src\(platform)\camera_hw\imgsensor_cfg_table.c
按照规格书加入上电时序
#if defined(IMX230_MIPI_RAW)
{
SENSOR_DRVNAME_IMX230_MIPI_RAW,
{
{PDN, Vol_Low, 2},
{RST, Vol_Low, 2},
{AVDD, Vol_2500, 2},
{DOVDD, Vol_1800, 2},
{DVDD, Vol_1100, 2},
{AFVDD, Vol_2800, 1},
{SensorMCLK, Vol_High, 10},
{PDN, Vol_High, 0},
{RST, Vol_High, 10}
},
},
#endif
|
|
|
|
|
|
|
登录或注册
|