mtk camera上电分析

mt6739 kernel4.4 方案

kernel部分:

涉及文件:kernel-4.4\drivers\misc\mediatek\imgsensor\src\mt6739\camera_hw\imgsensor_cfg_table.c,gpio,mclk上电信息dts配置信息
                 kernel-4.4\drivers\misc\mediatek\imgsensor\src\common\v1\imgsensor_hw.c,imgsensor.c,imgsensor_sensor_list.c
开机加载的初始化信息,项目只用到后置主摄,所以其他的管脚没有配置,执行camera_hw目录下的文件
mtk camera上电分析_第1张图片

camera驱动文件大概执行流程:主要执行 kernel-4.4\drivers\misc\mediatek\imgsensor\src\common\v1\目录下
imgsensor.c→imgsensor_sensor_list.c获取camera设备信息
imgsensor.c→imgsensor_hw.c→imgsensor_cfg_table.c(获取平台上电信息)

下面详细分析:
1:imgsensor_sensor_list.c存放sensor的id,gc5025的驱动信息
 

struct IMGSENSOR_INIT_FUNC_LIST kdSensorList[MAX_NUM_OF_SUPPORT_SENSOR] = {
	
#if defined(GC5025_MIPI_RAW)
    {GC5025_SENSOR_ID, SENSOR_DRVNAME_GC5025_MIPI_RAW, GC5025MIPI_RAW_SensorInit},
#endif

	/*  ADD sensor driver before this line */
	{0, {0}, NULL}, /* end of list */
};

struct IMGSENSOR_INIT_FUNC_LIST {
	MUINT32   id;
	MUINT8    name[32];
	MUINT32 (*init)(PSENSOR_FUNCTION_STRUCT *pfFunc);
};

2:imgsensor.c的imgsensor_set_driver调用kdSensorList获取设备信息,这步猜测是机器上电就获取camera设备
  获取设备后,还进行一下硬件初始化
mtk camera上电分析_第2张图片

3.这里是vendor\mediatek\proprietary\hardware\mtkcam\drv\src\sensor\common\v1\imgsensor_drv.cpp 的searchSensor接口调用,就是开机过程中,vendor会寻找Sensor,并对它做些硬件初始化

 mtk camera上电分析_第3张图片

 4.imgsensor.c通过调用imgsensor_hw.c的imgsensor_hw_power获取上电的步骤,其中imgsensor_hw.c的imgsensor_hw_power是调用imgsensor_cfg_table.c的platform_power_sequence,sensor_power_sequence

imgsensor_hw.c文件的imgsensor_hw_power函数
mtk camera上电分析_第4张图片

5.imgsensor_cfg_table.c文件的platform_power_sequence跟sensor_power_sequence


mtk camera上电分析_第5张图片 

上下电相关:

6:imgsensor.c通过adopt_CAMERA_HW_FeatureControl跟用户进行通信:
vendor\mediatek\proprietary\hardware\mtkcam\drv\src\sensor\common\v1\imgsensor_drv.cpp
SENSOR_FEATURE_OPEN上电拍照   SENSOR_FEATURE_CLOSE关闭

mtk camera上电分析_第6张图片

 mtk camera上电分析_第7张图片

mtk camera上电分析_第8张图片 

 其实就是gpimgsensor_cdev设备驱动的imgsensor_ioctl控制,里面还有一些awb,af接口

拍照的串口log

mtk camera上电分析_第9张图片

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