对于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为例)

(1)将kernel层代码整个文件夹sp5507_mipi_raw。sp2509_mipi_raw复制到mediatek/custom/common/kernel/imgsensor/文件夹下。
(2)将hal层代码整个文件夹sp5507_mipi_raw,sp2509_mipi_raw复制到mediatek/custom/common/hal/imgsensor/文件夹下。
         SP5507芯片与VO5670是用一款芯片。所以驱动程序也是同一套。上电时序也是一致;

(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;
}

依据芯片的上电时序图把大致的上电时序设置好就能够使摄像头工作起来;这里的上电时序没有像协议时序那般严格。仅仅须要大致配置好就能够了;

4、改动i2c控制器

打开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驱动移植的更多相关文章

  1. mtk camera 移植步骤

    mtk camera 移植步骤: 1, Kernel层驱动代码文件添加 /mediatek/custom/doov92_wet_tdd/kernel/imgsensor/下添加imx179_mipi_ ...

  2. MTK camera 闪光灯Flashlight驱动调试流程

    MTK camera 闪光灯Flashlight驱动调试流程 分类: MtkDev  |  作者: topicdev 相关  |  发布日期 : 2014-09-26  |  热度 : 153°   ...

  3. MTK6577+Android之Camera驱动

    MTK6577+Android之Camera驱动 <MTK安卓平台的Camera效果在线调试> 1.     Camera拍照相关概念 1.1  ISP isp--(Image Signa ...

  4. 基于MT6752/32平台 Android L版本驱动移植步骤

    基于MT6752/32平台 Android L版本驱动移植步骤 根据MK官网所述,在Android L 版本上Turnkey ABS 架构将会phase out,而Mediatek Turnkey架构 ...

  5. Mtk Camera

    MTK6577+Android之Camera驱动 http://blog.csdn.net/loongembedded/article/details/41695205 MTK Camera 开机启动 ...

  6. DM9000驱动移植在mini2440(linux2.6.29)和FS4412(linux3.14.78)上的实现(deep dive)篇一

    关于dm9000的驱动移植分为两篇,第一篇在mini2440上实现,基于linux2.6.29,也成功在在6410上移植了一遍,和2440非常类似,第二篇在fs4412(Cortex A9)上实现,基 ...

  7. kernel 4.4.12 EETI eGTouch 电容屏驱动移植

    kernel 4.4.12 EETI eGTouch 电容屏驱动移植: 在make menuconfig 里面添加如下选项: 添加通过事件上报接口节点: Device Drivers ---> ...

  8. AM335x kernel 4.4.12 i2c eeprom AT24c02驱动移植

    kernel 4.4.12 i2c eeprom AT24c02驱动移植 在kernel make menuconfig ARCH=ARM 中打开: Device Drivers ---> Mi ...

  9. wifi 驱动移植范例

    .改Makefile:  里面没有dm6441平台的,我看到有dm6446的,所以就在这里改了 ifeq ($(PLATFORM),DM6446) LINUX_SRC = /root/work/lin ...

随机推荐

  1. leetcode_919. Complete Binary Tree Inserter

    https://leetcode.com/problems/complete-binary-tree-inserter/ 设计一个CBTInserter,使用给定完全二叉树初始化.三个功能; CBTI ...

  2. 如何优雅地从CSDN转载文章

    复制粘贴应该是最显而易见的方法,但是不仅会有丢失内容,而且格式也会丢失.要想达到更好的效果,可以从html源码入手. 1.在chrome浏览器中打开要转载的文章,右键选择检查 2.在chrome的右方 ...

  3. 第2节 mapreduce深入学习:9、手机上行流量排序

    还是上次那个例子,需求二:上行流量倒序排序(递减排序) 分析,以需求一的输出数据作为排序的输入数据,自定义FlowBean,以FlowBean为map输出的key,以手机号作为Map输出的value, ...

  4. -- HTML标记大全参考手册[推荐]

    --  HTML标记大全参考手册[推荐]总类(所有HTML文件都有的) 文件类型 <HTML></HTML> (放在档案的开头与结尾) 文件主题 <TITLE>&l ...

  5. JAVA基础——设计模式之装饰者模式

    装饰模式 : 对新房进行装修并没有改变房屋的本质,但它可以让房子变得更漂亮.更温馨.更实用.    在软件设计中,对已有对象(新房)的功能进行扩展(装修).    把通用功能封装在装饰器中,用到的地方 ...

  6. git命令初级

    git是开源的分布式版本控制系统,分布式主要区别于集中式代表CVS(Concurrent Version System,遵从C/S架构,同步比较笨拙.)和SVN(Subversion),linux开发 ...

  7. 笔试算法题(24):找出出现次数超过一半的元素 & 二叉树最近公共父节点

    出题:数组中有一个数字出现的次数超过了数组长度的一半,请找出这个数字: 分析: 解法1:首先对数组进行排序,时间复杂度为O(NlogN),由于有一个数字出现次数超过了数组的一半,所以如果二分数组的话, ...

  8. [笔记] APIO 2018 Day1

    计算折纸 computaional origami 全息算法(???) margulis napkin problem 素数里有任意长的等差数列 xor gate Σxi or gate(exact ...

  9. MySQL 日志初探

    目录 MySQL 日志初探 零.概述 一.Error Log(错误日志) 二.General Query Log(通用查询日志) 三.Slow Query Log (慢查询日志) 四.Binary L ...

  10. Buffer.alloc()

    Buffer.alloc(size[, fill[, encoding]]) Node.js FS模块方法速查 size {Number} fill {Value} 默认:undefined enco ...