首页 > 代码库 > MTK Camera驱动移植
MTK Camera驱动移植
对于MTK Camera驱动移植一般分为四部分:
1、硬件IO口配置;
2、Camera驱动移植;
3、上电时序。
4、改动i2c控制器;
1、GPIO配置
打开 mediatek\dct\DrvGen.exe
选择 mediatek\custom\xiaoxi\kernel\dct\dct\codegen.dws 配置文件
设置前后摄像头的CMRST和CMPDN引脚。这是跟上电时序有关;
2、Camera驱动移植(以SP5507+SP2509为例)
(3)打开mediatek/custom/common/kernel/imgsensor/inc/kd_imgsensor.h文件, 定义sensor id和sensor name
#define SP5507MIPI_SENSOR_ID 0x5670
#define SENSOR_DRVNAME_SP5507MIPI_RAW "sp5507_mipi_raw"
#define SP2509MIPI_SENSOR_ID 0x2509
#define SENSOR_DRVNAME_SP2509MIPI_RAW "sp2509_mipi_raw"
id和name的定义建议跟系统其他数据格式保持一致;
(4)在mediatek/custom/common/kernel/imgsensor/src/kd_sensorlist.h文件里声明初始化函数;
UINT32 SP5507_MIPI_RAW_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc); //该函数为kernel中的初始化函数。
UINT32 SP2509_MIPI_RAW_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc); //该函数为kernel中的初始化函数;
在kdSensorList数组中加入:
#if defined(SP5507_MIPI_RAW) //该宏为驱动文件夹名大写
{SP5507MIPI_SENSOR_ID, SENSOR_DRVNAME_SP5507MIPI_RAW, SP5507_MIPI_RAW_SensorInit},
#endif
#if defined(SP2509_MIPI_RAW) //该宏为驱动文件夹名大写
{SP2509MIPI_SENSOR_ID, SENSOR_DRVNAME_SP2509MIPI_RAW, SP2509_MIPI_RAW_SensorInit},
#endif
(5)在mediatek/custom/common/hal/imgsensor/src/sensorlist.cpp文件的SensorList数组中加入
#if defined(SP5507_MIPI_RAW)
RAW_INFO(SP5507MIPI_SENSOR_ID, SENSOR_DRVNAME_SP5507MIPI_RAW, NULL),
#endif
#if defined(SP2509_MIPI_RAW)
RAW_INFO(SP2509MIPI_SENSOR_ID, SENSOR_DRVNAME_SP2509MIPI_RAW, NULL),
#endif
代码位置要跟kdSensorList数组中的位置保持一致;
(6) 改动mediatek/config/pro/ProjectConfig.mk配置文件
CUSTOM_HAL_IMGSENSOR=sp5507_mipi_raw
CUSTOM_HAL_MAIN_IMGSENSOR=sp5507_mipi_raw //后摄像头
CUSTOM_HAL_SUB_IMGSENSOR=sp2509_mipi_raw //前摄像头
CUSTOM_KERNEL_IMGSENSOR=sp5507_mipi_raw
CUSTOM_KERNEL_MAIN_IMGSENSOR =sp5507_mipi_raw //后摄像头
CUSTOM_KERNEL_SUB_IMGSENSOR=sp2509_mipi_raw //前摄像头
(7)驱动文件的改动
改动kernel层中的XXXXmipiraw_Sensor.h文件里的Sensor ID宏为kd_imgsensor.h中定义的Sensor ID宏:
#define OV5670_SENSOR_ID SP5507MIPI_SENSOR_ID
与供应商确认i2c读写地址。
再改动hal层中的camera_info_XXXXmipiraw.h中的SENSOR_ID和SENSOR_DRVNAME为kd_imgsensor.h中定义的宏。改动config.ftbl.XXXX_mipi_raw.h中的FTABLE_DEFINITION(SENSOR_DRVNAME_XXXX_MIPI_RAW)的SENSOR_DRVNAME为kd_imgsensor.h中定义的sensor name宏;
(8)改动上电时序
打开mediatek\custom\pro\kernel\camera\camera\kd_camera_hw.c文件
改动kdCISModulePowerOn()函数;
SP5507上电时序
SP2509上电时序
int kdCISModulePowerOn(CAMERA_DUAL_CAMERA_SENSOR_ENUM SensorIdx, char *currSensorName, BOOL On, char* mode_name) { u32 pinSetIdx = 0;//default main sensor #define IDX_PS_CMRST 0 //RST索引 #define IDX_PS_CMPDN 4 //PDN索引 #define IDX_PS_MODE 1 #define IDX_PS_ON 2 #define IDX_PS_OFF 3 u32 pinSet[2][8] = { //for main sensor //后摄像头 { GPIO_CAMERA_CMRST_PIN, GPIO_CAMERA_CMRST_PIN_M_GPIO, /* mode */ GPIO_OUT_ONE, /* ON state */ GPIO_OUT_ZERO, /* OFF state */ GPIO_CAMERA_CMPDN_PIN, GPIO_CAMERA_CMPDN_PIN_M_GPIO, GPIO_OUT_ONE, GPIO_OUT_ZERO, }, //for sub sensor //前摄像头 { GPIO_CAMERA_CMRST1_PIN, //RST引脚 GPIO_CAMERA_CMRST1_PIN_M_GPIO, GPIO_OUT_ONE, //上电电平 GPIO_OUT_ZERO, //下电电平 GPIO_CAMERA_CMPDN1_PIN, //PDN引脚 GPIO_CAMERA_CMPDN1_PIN_M_GPIO, GPIO_OUT_ONE, //上电电平 GPIO_OUT_ZERO, //下电电平 } }; if (DUAL_CAMERA_MAIN_SENSOR == SensorIdx){ pinSetIdx = 0; searchMainSensor = KAL_TRUE; } else if (DUAL_CAMERA_SUB_SENSOR == SensorIdx) { pinSetIdx = 1; searchMainSensor = KAL_FALSE; } PK_DBG("[kdCISModulePowerOn]:pinSetIdx=%d\n",pinSetIdx); //power ON if (On) //上电时序 { PK_DBG("kdCISModulePowerOn -on:currSensorName=%s\n",currSensorName); if (currSensorName && ((0 == strcmp(SENSOR_DRVNAME_SP2509MIPI_RAW,currSensorName)))) { { PK_DBG("kdCISModulePowerOn get in--- %s \n",currSensorName); PK_DBG("[ON_general 2.8V]sensorIdx:%d \n",SensorIdx); /* SP2509仅仅有两个电源 */ if(TRUE != hwPowerOn(CAMERA_POWER_VCAM_D2, VOL_1800,mode_name)) //VCAM_IO 先打开DVDDIO电源 { PK_DBG("[CAMERA SENSOR] Fail to enable digital power\n"); //return -EIO; goto _kdCISModulePowerOn_exit_; } mdelay(1); if(TRUE != hwPowerOn(CAMERA_POWER_VCAM_A, VOL_2800,mode_name)) //再打开AVDD电源 { PK_DBG("[CAMERA SENSOR] Fail to enable analog power\n"); //return -EIO; goto _kdCISModulePowerOn_exit_; } mdelay(1); if (GPIO_CAMERA_INVALID != pinSet[pinSetIdx][IDX_PS_CMRST]) { /* RST和PDN先置为低电平 */ //PDN/STBY pin if(mt_set_gpio_mode(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_MODE])){PK_DBG("[CAMERA LENS] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[pinSetIdx][IDX_PS_CMPDN],GPIO_DIR_OUT)){PK_DBG("[CAMERA LENS] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_OFF])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} //RST pin if(mt_set_gpio_mode(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_MODE])){PK_DBG("[CAMERA SENSOR] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[pinSetIdx][IDX_PS_CMRST],GPIO_DIR_OUT)){PK_DBG("[CAMERA SENSOR] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_OFF])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");} mdelay(1); //PDN/STBY pin //PWD高电平脉冲 持续10ms if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_ON])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} mdelay(10); if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_OFF])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} mdelay(10); //RST pin //然后RST置高电平 if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_ON])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");} mdelay(10); // } //disable inactive sensor //关闭不使用的摄像头 if(pinSetIdx == 0 ) {//disable sub if (GPIO_CAMERA_INVALID != pinSet[1][IDX_PS_CMRST]) { if(mt_set_gpio_mode(pinSet[1][IDX_PS_CMRST],pinSet[1][IDX_PS_CMRST+IDX_PS_MODE])){PK_DBG("[CAMERA SENSOR] set gpio mode failed!! \n");} if(mt_set_gpio_mode(pinSet[1][IDX_PS_CMPDN],pinSet[1][IDX_PS_CMPDN+IDX_PS_MODE])){PK_DBG("[CAMERA LENS] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[1][IDX_PS_CMRST],GPIO_DIR_OUT)){PK_DBG("[CAMERA SENSOR] set gpio dir failed!! \n");} if(mt_set_gpio_dir(pinSet[1][IDX_PS_CMPDN],GPIO_DIR_OUT)){PK_DBG("[CAMERA LENS] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[1][IDX_PS_CMRST],pinSet[1][IDX_PS_CMRST+IDX_PS_OFF])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");} //low == reset sensor if(mt_set_gpio_out(pinSet[1][IDX_PS_CMPDN],pinSet[1][IDX_PS_CMPDN+IDX_PS_OFF])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} //high == power down lens module } } else { if (GPIO_CAMERA_INVALID != pinSet[0][IDX_PS_CMRST]) { if(mt_set_gpio_mode(pinSet[0][IDX_PS_CMRST],pinSet[0][IDX_PS_CMRST+IDX_PS_MODE])){PK_DBG("[CAMERA SENSOR] set gpio mode failed!! \n");} if(mt_set_gpio_mode(pinSet[0][IDX_PS_CMPDN],pinSet[0][IDX_PS_CMPDN+IDX_PS_MODE])){PK_DBG("[CAMERA LENS] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[0][IDX_PS_CMRST],GPIO_DIR_OUT)){PK_DBG("[CAMERA SENSOR] set gpio dir failed!! \n");} if(mt_set_gpio_dir(pinSet[0][IDX_PS_CMPDN],GPIO_DIR_OUT)){PK_DBG("[CAMERA LENS] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[0][IDX_PS_CMRST],pinSet[0][IDX_PS_CMRST+IDX_PS_OFF])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");} //low == reset sensor if(mt_set_gpio_out(pinSet[0][IDX_PS_CMPDN],pinSet[0][IDX_PS_CMPDN+IDX_PS_OFF])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} //high == power down lens module } } mdelay(50); } } else if (currSensorName && ((0 == strcmp(SENSOR_DRVNAME_SP5507MIPI_RAW,currSensorName)))) { { PK_DBG("kdCISModulePowerOn get in--- %s \n",currSensorName); PK_DBG("[ON_general 2.8V]sensorIdx:%d \n",SensorIdx); /* SP5507有三个电源 */ if(TRUE != hwPowerOn(CAMERA_POWER_VCAM_D2, VOL_1800,mode_name)) //VCAM_IO 先打开DOVDD电源 { PK_DBG("[CAMERA SENSOR] Fail to enable digital power\n"); //return -EIO; goto _kdCISModulePowerOn_exit_; } if(TRUE != hwPowerOn(CAMERA_POWER_VCAM_A, VOL_2800,mode_name)) //再打开AVDD电源 { PK_DBG("[CAMERA SENSOR] Fail to enable analog power\n"); //return -EIO; goto _kdCISModulePowerOn_exit_; } if(TRUE != hwPowerOn(CAMERA_POWER_VCAM_D, VOL_1200,mode_name)) //最后打开DVDD电源 { PK_DBG("[CAMERA SENSOR] Fail to enable analog power\n"); //return -EIO; goto _kdCISModulePowerOn_exit_; } mdelay(1); if (GPIO_CAMERA_INVALID != pinSet[pinSetIdx][IDX_PS_CMRST]) { /* 先把RET(SHUTDOWN)和PWDN置为低电平 */ //PDN/STBY pin if(mt_set_gpio_mode(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_MODE])){PK_DBG("[CAMERA LENS] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[pinSetIdx][IDX_PS_CMPDN],GPIO_DIR_OUT)){PK_DBG("[CAMERA LENS] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_OFF])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} //RST pin if(mt_set_gpio_mode(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_MODE])){PK_DBG("[CAMERA SENSOR] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[pinSetIdx][IDX_PS_CMRST],GPIO_DIR_OUT)){PK_DBG("[CAMERA SENSOR] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_OFF])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");} mdelay(1); //RST pin if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_ON])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");} mdelay(2); //PDN/STBY pin if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_ON])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} mdelay(20); } //disable inactive sensor //关闭其它摄像头 if(pinSetIdx == 0 ) {//disable sub if (GPIO_CAMERA_INVALID != pinSet[1][IDX_PS_CMRST]) { if(mt_set_gpio_mode(pinSet[1][IDX_PS_CMRST],pinSet[1][IDX_PS_CMRST+IDX_PS_MODE])){PK_DBG("[CAMERA SENSOR] set gpio mode failed!! \n");} if(mt_set_gpio_mode(pinSet[1][IDX_PS_CMPDN],pinSet[1][IDX_PS_CMPDN+IDX_PS_MODE])){PK_DBG("[CAMERA LENS] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[1][IDX_PS_CMRST],GPIO_DIR_OUT)){PK_DBG("[CAMERA SENSOR] set gpio dir failed!! \n");} if(mt_set_gpio_dir(pinSet[1][IDX_PS_CMPDN],GPIO_DIR_OUT)){PK_DBG("[CAMERA LENS] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[1][IDX_PS_CMRST],pinSet[1][IDX_PS_CMRST+IDX_PS_OFF])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");} //low == reset sensor if(mt_set_gpio_out(pinSet[1][IDX_PS_CMPDN],pinSet[1][IDX_PS_CMPDN+IDX_PS_OFF])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} //high == power down lens module } } else { if (GPIO_CAMERA_INVALID != pinSet[0][IDX_PS_CMRST]) { if(mt_set_gpio_mode(pinSet[0][IDX_PS_CMRST],pinSet[0][IDX_PS_CMRST+IDX_PS_MODE])){PK_DBG("[CAMERA SENSOR] set gpio mode failed!! \n");} if(mt_set_gpio_mode(pinSet[0][IDX_PS_CMPDN],pinSet[0][IDX_PS_CMPDN+IDX_PS_MODE])){PK_DBG("[CAMERA LENS] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[0][IDX_PS_CMRST],GPIO_DIR_OUT)){PK_DBG("[CAMERA SENSOR] set gpio dir failed!! \n");} if(mt_set_gpio_dir(pinSet[0][IDX_PS_CMPDN],GPIO_DIR_OUT)){PK_DBG("[CAMERA LENS] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[0][IDX_PS_CMRST],pinSet[0][IDX_PS_CMRST+IDX_PS_OFF])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");} //low == reset sensor if(mt_set_gpio_out(pinSet[0][IDX_PS_CMPDN],pinSet[0][IDX_PS_CMPDN+IDX_PS_OFF])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} //high == power down lens module } } mdelay(50); } } } //power OFF else //下电时序 { PK_DBG("kdCISModulePowerOn -off:currSensorName=%s\n",currSensorName); if (currSensorName && (0 == strcmp(SENSOR_DRVNAME_SP2509MIPI_RAW, currSensorName))) { PK_DBG("kdCISModulePowerOff, get in---SENSOR_DRVNAME_IMX219_MIPI_RAW \n"); if (GPIO_CAMERA_INVALID != pinSet[pinSetIdx][IDX_PS_CMRST]) { //RST pin if(mt_set_gpio_mode(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_MODE])){PK_DBG("[CAMERA SENSOR] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[pinSetIdx][IDX_PS_CMRST],GPIO_DIR_OUT)){PK_DBG("[CAMERA SENSOR] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_OFF])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");} //low == reset sensor mdelay(1); //PDN/STBY pin if(mt_set_gpio_mode(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_MODE])){PK_DBG("[CAMERA LENS] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[pinSetIdx][IDX_PS_CMPDN],GPIO_DIR_OUT)){PK_DBG("[CAMERA LENS] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_ON])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} mdelay(1); } if(TRUE != hwPowerDown(CAMERA_POWER_VCAM_A,mode_name)) { PK_DBG("[CAMERA SENSOR] Fail to OFF analog power:VCAM_A:VOL_2800\n"); //return -EIO; goto _kdCISModulePowerOn_exit_; } if(TRUE != hwPowerDown(CAMERA_POWER_VCAM_D2, mode_name)) { PK_DBG("[CAMERA SENSOR] Fail to OFF digital power:VCAM_D:VOL_1200\n"); //return -EIO; goto _kdCISModulePowerOn_exit_; } mdelay(1); //PDN pull down if (GPIO_CAMERA_INVALID != pinSet[pinSetIdx][IDX_PS_CMPDN]) { if(mt_set_gpio_mode(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_MODE])){PK_DBG("[CAMERA LENS] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[pinSetIdx][IDX_PS_CMPDN],GPIO_DIR_OUT)){PK_DBG("[CAMERA LENS] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_OFF])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} mdelay(1); } } else if (currSensorName && (0 == strcmp(SENSOR_DRVNAME_SP5507MIPI_RAW, currSensorName))) { PK_DBG("kdCISModulePowerOff, get in---SENSOR_DRVNAME_IMX219_MIPI_RAW \n"); if (GPIO_CAMERA_INVALID != pinSet[pinSetIdx][IDX_PS_CMRST]) { //RST pin if(mt_set_gpio_mode(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_MODE])){PK_DBG("[CAMERA SENSOR] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[pinSetIdx][IDX_PS_CMRST],GPIO_DIR_OUT)){PK_DBG("[CAMERA SENSOR] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMRST],pinSet[pinSetIdx][IDX_PS_CMRST+IDX_PS_OFF])){PK_DBG("[CAMERA SENSOR] set gpio failed!! \n");} //low == reset sensor mdelay(2); //PDN/STBY pin if(mt_set_gpio_mode(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_MODE])){PK_DBG("[CAMERA LENS] set gpio mode failed!! \n");} if(mt_set_gpio_dir(pinSet[pinSetIdx][IDX_PS_CMPDN],GPIO_DIR_OUT)){PK_DBG("[CAMERA LENS] set gpio dir failed!! \n");} if(mt_set_gpio_out(pinSet[pinSetIdx][IDX_PS_CMPDN],pinSet[pinSetIdx][IDX_PS_CMPDN+IDX_PS_ON])){PK_DBG("[CAMERA LENS] set gpio failed!! \n");} mdelay(1); } if(TRUE != hwPowerDown(CAMERA_POWER_VCAM_D, mode_name)) { PK_DBG("[CAMERA SENSOR] Fail to OFF digital power:VCAM_D:VOL_1200\n"); //return -EIO; goto _kdCISModulePowerOn_exit_; } if(TRUE != hwPowerDown(CAMERA_POWER_VCAM_A,mode_name)) { PK_DBG("[CAMERA SENSOR] Fail to OFF analog power:VCAM_A:VOL_2800\n"); //return -EIO; goto _kdCISModulePowerOn_exit_; } if(TRUE != hwPowerDown(CAMERA_POWER_VCAM_D2, mode_name)) { PK_DBG("[CAMERA SENSOR] Fail to OFF digital power:VCAM_D:VOL_1200\n"); //return -EIO; goto _kdCISModulePowerOn_exit_; } mdelay(1); } } return 0; _kdCISModulePowerOn_exit_: return -EIO; }
依据芯片的上电时序图把大致的上电时序设置好就能够使摄像头工作起来;这里的上电时序没有像协议时序那般严格。仅仅须要大致配置好就能够了;
打开mediatek\custom\common\kernel\imgsensor\src\kd_sensorlist.c。改动 i2c_register_board_info(SUPPORT_I2C_BUS_NUM, &i2c_devs, 1);中的SUPPORT_I2C_BUS_NUM设置为实际电路使用的i2c控制器
假设开机后,相机无法起来,那就应该查看系统log,推断是否可以获取到Camera的ID,硬件上必须保证I2C可以正常通信;
MTK Camera驱动移植