对于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. Java多线程编程核心技术---Lock的基本概念和使用

    Lock接口: ReentrantLock的基本功能: ReentrantLock的lock和unlock方法进行加锁,解锁.可以起到和synchronized关键字一样的效果: 选择性通知!!!: ...

  2. sql server 强制关闭连接

    USE master; GO DECLARE @SQL VARCHAR(MAX); SET @SQL='' SELECT @SQL=@SQL+'; KILL '+RTRIM(SPID) FROM ma ...

  3. Codeforces_791_B. Bear and Friendship Condition_(dfs)

    B. Bear and Friendship Condition time limit per test 1 second memory limit per test 256 megabytes in ...

  4. Objective-C 是动态语言

    Objective-C 的动态性是由 runtime 相关的库赋予的. 当然其他语言也完全可以运行在一个 Runtime 库上而获得动态性,由于多数高级语言的诞生都对应着一种编译器,因此将编译器的特性 ...

  5. Android APK生成证书并签名方法

    Android APK生成证书并签名方法 android cordova keystore android证书签名 阅读:925 时间:2018年09月20日 Android开发者可能对此很熟悉.使用 ...

  6. Vue+Bootstrap实现购物车程序(3)

    效果展示:(说明:使用webpack重构购物车程序,使用vue-cli生成项目脚手架) 文件结构: 代码: (1)将原来编写的btn-grp组件单独编写到BtnGrp.vue文件中 可以看到现在代码清 ...

  7. UML-画类图与交互图的顺序

    并行.画完交互图,在画类图.交替进行.

  8. 微信小程序(template的使用)

    小程序的template是一个模版功能,在创建一个template后,其他的页面可以引用,相比component较简单.方便! template只需要两个文件,一个wxss文件和wxml文件,也只有这 ...

  9. Python 函数递归-三元表达式-列表生成式-字典生成式-匿名函数-内置函数

    上节课复习: 1. 无参装饰器 def 装饰器名字(func): def wrapper(*args,**kwargs): res = func(*args,**kwargs) return res ...

  10. JavaScript实现AES算法加密和解密

    JavaScript的加密和解密用的是google的CryptoJS库.本文以AES/ECB/NoPadding为例展示AES加密和解密的方法. 需要下载CryptoJS库,下载地址如下:https: ...