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


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

    分类: MtkDev  |  作者: topicdev 相关  |  发布日期 : 2014-09-26  |  热度 : 153°
     
     

    Camera Flash 驱动分析

    一、Flash驱动涉及到的文件包含:

    mediatek /custom/common/kernel/flashlight/src/kd_flashlightlist.c

    mediatek /custom/huaqin_bsp/at808p/base/kernel/flashlight/constant_flashlight/leds_strobe.c

    mediatek /platform/mt6592/hardware/mtkcam/core/featureio/drv/strobe/flashlight_drv.cpp

    mediatek/platform/mt6592/hardware/mtkcam/core/featureio/pipe/aaa/flash_mgr/flash_mgr.cpp

    mediatek/platform/mt6592/hardware/mtkcam/core/featureio/pipe/aaa/flash_mgr/flash_cct.cpp

    mediatek/platform/mt6592/hardware/mtkcam/acdk/src/cct/if/cct_feature.cpp

    二、Flash驱动代码流程分析:

    i.             mediatek /custom/common/kernel/flashlight/src/kd_flashlightlist.c

    主要完成设备的注册和初始化。

    1.注册一个平台设备:名为"kd_camera_flashlight";

    2.注册一个平台驱动,name和我们的devices name同名,这个名字主要用来和HAL层的name做匹配用;

    3.对IOCTL的一个填充,供HAL调用;

    4.做一个接口主要跟我们实际使用的Flash驱动对接,以kdFlashlightList罗列出来;

    ii.             mediatek/custom/huaqin_bsp/at808p/base/kernel/flashlight/constant_flashlight/leds_strobe.c

    1.      这个文件就是我们实际性的使用的Flash驱动文件,从

    mediatek/config/huaqin92_wet_b2a_tdd/xxx/ProjectConfig.mk文件中CUSTOM_KERNEL_FLASHLIGHT配置获取具体使用的Flash驱动。

    如:

    CUSTOM_HAL_FLASHLIGHT= constant_flashlight

    CUSTOM_KERNEL_FLASHLIGHT = constant_flashlight

    2.      该文件和kd_flashlightlist.c文件的对接函数为: 

    323 MUINT32constantFlashlightInit(PFLASHLIGHT_FUNCTION_STRUCT *pfFunc)

    3.      这个文件完成的任务是填充以下几个函数:

    1. 315FLASHLIGHT_FUNCTION_STRUCT constantFlashlightFunc=  
    2. 316{   
    3. 317     constant_flashlight_open,  
    4. 318     constant_flashlight_release,  
    5. 319     constant_flashlight_ioctl  
    6. 320 };  

    4.      我们主要分析的是constant_flashlight_ioctl,以为这是跟HAL实际握手的接口。

    iii.             mediatek/platform/mt6592/hardware/mtkcam/core/featureio/drv/strobe/flashlight_drv.cpp

    这个文件完成的任务比较多,主要是一些类的实现和定义。

    1. 825 intFlashlightDrv::setFlashlightModeConf(unsigned long a_strobeMode)  
    2. 897 intFlashlightDrv::setCaptureFlashlightConf(unsigned long a_strobeWidth)  
    3. 952 intFlashlightDrv::setCaptureDelay(unsigned int value)  
    4. 1021 intFlashlightDrv::getDuty(int* duty)  
    5. 1090 intFlashlightDrv::lowPowerDetectEnd(int* isLowPower)  

    主要是为flash_mgr.cpp提供接口。

                          

    iv.             mediatek/platform/mt6592/hardware/mtkcam/core/featureio/pipe/aaa/flash_mgr/flash_mgr.cpp

    实现闪光灯模式的设置和获取、拍照/摄像预览的开启和终止、闪光灯设备的打开和关闭等等。


    v.             mediatek/platform/mt6592/hardware/mtkcam/core/featureio/pipe/aaa/flash_mgr/flash_cct.cpp

    调用lash_mgr.cpp中的函数来给cct_feature.cpp提供接口。

    1. 128 int FlashMgr::cctFlashEnable(int en)  
    2. 129 {  
    3. 130    LogInfo("cctFlashEnable(en=%d) line=%d",en,__LINE__);  
    4. 131     if(en==1)  
    5. 132     {  
    6. 133        setFlashMode(FLASHLIGHT_FORCE_ON);  
    7. 134     }  
    8. 135     else  
    9. 136     {  
    10. 137        setFlashMode(FLASHLIGHT_FORCE_OFF);  
    11. 138     }  
    12. 139     return 0;  
    13. 140 }  

    vi.             mediatek/platform/mt6592/hardware/mtkcam/acdk/src/cct/if/cct_feature.cpp

    调用flash_cct.cpp中的函数,并以IOCTL的形式进行封装,供更上一层次调用。具体的没有在继续跟下去,有兴趣的话,可以再往上分析分析。

    1. MINT32 CctImp::aaaCCTFeatureControl  
    2. 361    case ACDK_CCT_OP_FLASH_ENABLE:  
    3. 362        err = FlashMgr::getInstance()->cctFlashEnable(1); //YosenFlash  
    4. 363        break;  
    5. 364    case ACDK_CCT_OP_FLASH_DISABLE:  
    6. 365        err = FlashMgr::getInstance()->cctFlashEnable(0); //YosenFlash  

    原文:http://www.aiuxian.com/article/p-1646401.html

  • 相关阅读:
    c++的socket编程 tcp
    qt下载
    定义数组类型
    虚析构函数
    运算符重载
    友元函数
    const成员函数
    静态成员变量,静态成员函数
    linux安装mysql
    智能指针
  • 原文地址:https://www.cnblogs.com/Ph-one/p/5528334.html
Copyright © 2020-2023  润新知