我是靠谱客的博主 大胆康乃馨,最近开发中收集的这篇文章主要介绍MTK AF driver porting,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Configuration

device/mediatekprojects/“ProjectName”/ ProjectConfig.mk

...
CUSTOM_HAL_LENS = AK7371AF
CUSTOM_KERNEL_LENS = AK7371AF
...

Kernel

kernel-4.14driversmiscmediatekdwsmt6853k6853v1_64.dws

...
<device26>
    <varName>CAMERA_MAIN_AF</varName>
    <channel>I2C_CHANNEL_8</channel>
    <address>0x72</address>
</device26>
...

kernel-4.14archarm64bootdtsmediatekmt6359.dtsi

mt_pmic_vtp_ldo_reg: ldo2 {
	regulator-compatible = "LDO2";
	regulator-name = "VTP";
	regulator-min-microvolt = <1200000>;
	regulator-max-microvolt = <3600000>;
};

kernel-4.14archarm64bootdtsmediatekcust_mt6853_camera.dtsi

...
vcamaf-supply = <&mt_pmic_vtp_ldo_reg>
...

kernel-4.14driversmiscmediateklensmaincommonak7371af

添加驱动ak7371af

kernel-4.14driversmiscmediateklensKconfig

...
config MTK_LENS_AK7371AF_SUPPORT
	bool "AK7371AF Lens Driver"
	default n
	help
	  AK7371AF Lens Driver
	  This config is used to enable the corresponding
	  lens driver for the camera sensor module
	  Set as y if the driver is used in this project
...

kernel-4.14driversmiscmediateklensmainMakefile

...
MAIN_CFILES  += common/ak7371af/AK7371AF.c
...
obj-y  += common/ak7371af/
...

kernel-4.14driversmiscmediateklensmaininclens_list.h

//define 用于区分不同camera模组使用相同af driver
#define AK7371AF_SetI2Cclient AK7371AF_SetI2Cclient_Main
#define AK7371AF_Ioctl AK7371AF_Ioctl_Main
#define AK7371AF_Release AK7371AF_Release_Main
#define AK7371AF_PowerDown AK7371AF_PowerDown_Main
#define AK7371AF_GetFileName AK7371AF_GetFileName_Main
//添加af driver的函数接口
extern int AK7371AF_SetI2Cclient(struct i2c_client *pstAF_I2Cclient,
				 spinlock_t *pAF_SpinLock, int *pAF_Opened);
extern long AK7371AF_Ioctl(struct file *a_pstFile, unsigned int a_u4Command,
			   unsigned long a_u4Param);
extern int AK7371AF_Release(struct inode *a_pstInode, struct file *a_pstFile);
extern int AK7371AF_PowerDown(struct i2c_client *pstAF_I2Cclient,
				int *pAF_Opened);
extern int AK7371AF_GetFileName(unsigned char *pFileName);

kernel-4.14driversmiscmediateklensmaininclens_info.h

/* AFDRV_XXXX be the same as AF_DRVNAME in (*af).c */
#define AFDRV_AK7371AF "AK7371AF"

af上电有两种方式,一种是在camera sensor上电时在sensor上电时序中加上af上电,还有一种就是下面这种在af字符设备驱动中上电
kernel-4.14driversmiscmediateklensmainmain_lens.c

static struct stAF_DrvList g_stAF_DrvList[MAX_NUM_OF_LENS] = {
	...
	{1, AFDRV_AK7371AF, AK7371AF_SetI2Cclient, AK7371AF_Ioctl,
	 AK7371AF_Release, AK7371AF_GetFileName, NULL},
	...
};
...
void AFRegulatorCtrl(int Stage)
{
    ....
    if (Stage == 0) {
        ...
        regVCAMAF = regulator_get_regVCAMAF();
        ...
    } else if (Stage == 1/*上电*/) {
        ...
        Status = regulator_set_voltage(regVCAMAF, 2800000, 2800000);
        ...
    }
    ...
}
...
void AF_PowerDown(void) {
   ...
   AK7371AF_PowerDown(g_pstAF_I2Cclient, &g_s4AF_Opened);
   ...
}

HAL

alps/vendor/mediatek/proprietary/custom/[$Platform]/hal/inc/camera_custom_lens.h

...
#define AK7371AF_LENS_ID        0x7371
...

alps/vendor/mediatek/proprietary/custom/[$Platform]/hal/lens/src/lenslist.cpp

...
MSDK_LENS_INIT_FUNCTION_STRUCT LensList_main[MAX_NUM_OF_SUPPORT_LENS] =
{
    ...
    #ifdefined(AK7371AF)
        {S5KGM1ST_SENSOR_ID, AK7371AF_LENS_ID, "AK7371AF", pAK7371AF_getDefaultData},
    ...
}
...

在这里插入图片描述

最后

以上就是大胆康乃馨为你收集整理的MTK AF driver porting的全部内容,希望文章能够帮你解决MTK AF driver porting所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(78)

评论列表共有 0 条评论

立即
投稿
返回
顶部