海思Hi3519AV100sensor移植之一– imx307

驱动修改, 基于imx291的驱动(imx291_sensor_ctl.c )进行修改, 遵循imx307数据手册修改寄存器即可。(因为imx307与imx291型号差距不大,初始化序列可以参考imx291)

const unsigned short IMX291_SETTING_SHORT[]= { //Tag standby 0x0200,0x1, 0x0204,0x10, //Tag AD 12bit 0x0205,0x1, 0x0206,0x0, //Tag FULL HD1080 0x0207,0x00,//0x10, 0x0208,0xA0,//0x10, //Tag 30fps 0x0209,0x02,//IMX185_FRSEL,//0x2, //Tag BLACKLEVEL default 0x020A,0xf0, 0x020B,0x0, 0x020C,0x0, 0x020D,0x0, 0x020E,0x1, 0x020F,0x00,//0x1, 0x0210,0x21,//0x39, 0x0211,0x0, 0x0212,0x64,//0x50, 0x0213,0x0, //Tag GAIN 0x0214,0x0, 0x0215,0x0, 0x0216,0x09,//0x8, 0x0217,0x0, //Tag /VMAX calc refer to 0x0218,0x65,//0x46,//0x65, 0x0219,0x4,//0x5,//0x4, 0x021A,0x0, 0x021B,0x00,//IMX185_HMAX_LOW,//0x98, //Tag HMAX 0x021C,0x30,//IMX185_HMAX_HIGH,//0x8, 0x021D,0x11,//0xff, 0x021E,0xB2,//0x1, 0x021F,0x01,//0x0, //Tag SHS1 0x0220,0x0, 0x0221,0x0, 0x0222,0x0, //Tag :WINWV_OB calc ? 0x023A,0x10,//0xc9, 0x023B,0x00,//0x4, //Tag WINPV 0x023C,0x0, 0x023D,0x0, //Tag WINWV 0x023E,0x49,//0x9c, 0x023F,0x04,//0x7, //Tag WINPH 0x0240,0x00,//0x1, 0x0241,0x0, //Tag WInWH 0x0242,0x9C,//0x1, 0x0243,0x07,//0x0, //Fixed in CSI-2 0x0246,0x01,//0x0, 0x0247,0x01,//0x8, //Tag XVSLNG 0x0248,0x00,//0x13, 0x0249,0x08,//0x0, 0x024A,0x00, //0x024B,0x00, //Tag INCK 0x025C,0x18,//0x20, 0x025D,0x03,//0x0, 0x025E,0x20,//0x18, 0x025F,0x01,//0x0, 0x0270,0x02, 0x0271,0x11, 0x02A6,0x20, 0x02A7,0x00, 0x02A8,0x20, 0x02A9,0x00, 0x02AA,0x20, 0x02AB,0x00, 0x02AC,0x20, 0x030B,0x00,//0x84, 0x0319,0x9E,//0x0, 0x031E,0x08,//0x3, 0x0328,0x05,//0x0, 0x0334,0x0F,//0x0, 0x033B,0x50,//0x0, 0x033C,0x41,//0x0, 0x033D,0x83,//0x1, //Tag INCKSEL5 0x035E,0x1A,//0x12, 0x0364,0x1A,//0x12, 0x037C,0x0, 0x037D,0x00,//0x10, //0x037E,0x0, 0x037F,0x0, 0x04B8,0x50,//0xc1,//0x11, 0x04B9,0x10,//0x12,//0x13, 0x04BA,0x0, 0x04BB,0x04,//0xac, 0x04C8,0x50,//0x0, 0x04C9,0x10,//0xb0,//0xb5, 0x04CA,0x00,//0x40,//0x90, 0x04CB,0x04,//0xb, 0x052C,0xD3,//IMX185_THSEXIT,//0x3f, 0x052D,0x10,//0x20,//0x1f, 0x052E,0x0D,//0x3, 0x0558,0x06, 0x0559,0xE1, 0x055A,0x11, 0x0560,0x1E, 0x0561,0x61, 0x0562,0x10, 0x05B0,0x08,//0x0, 0x05B1,0x30,//0x0, 0x05B2,0x00, 0x05B3,0x04,//0x0,
<

////////////////////////////////////

//REPETITION default 0x0605,0x20, 0x0606,0x00, //LANE_NUM default 0x0607,0x03, //Tag OPB_SIZE_V 0x0614,0x0A, //Tag YOUTSIZE 0x0618,0x49, 0x0619,0x04, 0x062C,0x47, 0x062D,0x00, 0x0630,0x0F, 0x0631,0x00, //RAW12: 0x0641,0x0C, 0x0642,0x0C, //Tag 3: 4Lane 0x0643,0x03, //INCK = 37.125 MHz 0x0644,0x20, 0x0645,0x25, 0x0646,0x47, 0x0647,0x00, 0x0648,0x1F, 0x0649,0x00, 0x064A,0x17, 0x064B,0x00, 0x064C,0x0F, 0x064D,0x00, 0x064E,0x17, 0x064F,0x00, 0x0650,0x47, 0x0651,0x00, 0x0652,0x0F, 0x0653,0x00, 0x0654,0x0F, 0x0655,0x00, //Tag X_OUT_SIZE 0x0672,0x9C, 0x0673,0x07, //H,V Inverted 0x3007,0x03
<

};

按照《sensor调试指南》修改文件,主要集中在sample_comm_vi.c , sample_comm_isp.c 下面为驱动程序分析 原文件为sample_comm_isp.c

HI_S32 SAMPLE_COMM_ISP_Sensor_Regiter_callback(ISP_DEV IspDev, HI_U32 u32SnsId)

{

ALG_LIB_S stAeLib; ALG_LIB_S stAwbLib; const ISP_SNS_OBJ_S* pstSnsObj; HI_S32 s32Ret = -1; if (MAX_SENSOR_NUM <= u32SnsId) { SAMPLE_PRT(“invalid sensor id: %d\n”, u32SnsId); return HI_FAILURE; } pstSnsObj = SAMPLE_COMM_ISP_GetSnsObj(u32SnsId); if (HI_NULL == pstSnsObj) { SAMPLE_PRT(“sensor %d not exist!\n”, u32SnsId); return HI_FAILURE; }
<

跳入SAMPLE_COMM_ISP_GetSnsObj,发现原来是缺少了stSnsImx307Obj;所以我在这里添加了相应的代码

switch (enSnsType) { case SONY_IMX290_MIPI_2M_30FPS_12BIT: case SONY_IMX290_MIPI_2M_30FPS_12BIT_WDR2TO1: return &stSnsImx290Obj; /*添加的代码*/ case SONY_IMX307_MIPI_2M_30FPS_12BIT: return &stSnsImx307Obj; … }

该结构体定义在 imx290_cmos.c ; 添加stSnsImx307Obj

ISP_SNS_OBJ_S stSnsImx307Obj = { .pfnRegisterCallback = sensor_register_callback, .pfnUnRegisterCallback = sensor_unregister_callback, .pfnStandby = imx291_standby, .pfnRestart = imx291_restart, .pfnMirrorFlip = HI_NULL, .pfnWriteReg = imx291_write_register, .pfnReadReg = imx291_read_register, .pfnSetBusInfo = imx291_set_bus_info, .pfnSetInit = sensor_set_init };
<

定义在.c文件所有肯定是外部引用,extern , 位置 hi_sns_ctrl.h ; 同理添加 extern ISP_SNS_OBJ_S stSnsImx307Obj

extern ISP_SNS_OBJ_S stSnsMn34220Obj; extern ISP_SNS_OBJ_S stSnsImx377Obj; extern ISP_SNS_OBJ_S stSnsImx299Obj; extern ISP_SNS_OBJ_S stSnsImx477Obj; extern ISP_SNS_OBJ_S stSnsImx299SlvsObj; extern ISP_SNS_OBJ_S stSnsImx290Obj; extern ISP_SNS_OBJ_S stSnsImx327Obj; extern ISP_SNS_OBJ_S stSnsImx334Obj; extern ISP_SNS_OBJ_S stSnsOV2718Obj; extern ISP_SNS_OBJ_S stSnsCmv50000Obj; extern ISP_SNS_OBJ_S stSnsImx277SlvsObj; extern ISP_SNS_OBJ_S stSnsImx117Obj; extern ISP_SNS_OBJ_S stSnsImx290SlaveObj; extern ISP_SNS_OBJ_S stSnsImx334SlaveObj; extern ISP_SNS_OBJ_S stSnsImx226Obj; extern ISP_SNS_OBJ_S stSnsImx335Obj; extern ISP_SNS_OBJ_S stSnsImx458Obj; /*添加的代码*/ extern ISP_SNS_OBJ_S stSnsImx307Obj;
<

原文链接:https://blog.csdn.net/sinat_20276189/article/details/104513938?biz_id=102&utm_term=%E6%B5%B7%E6%80%9Dsensor&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~sobaiduweb~default-4-104513938&spm=1018.2118.3001.4187

免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:海思Hi3519AV100sensor移植之一– imx307 https://www.yhzz.com.cn/a/15089.html

上一篇 2023-05-12
下一篇 2023-05-12

相关推荐

联系云恒

在线留言: 我要留言
客服热线:400-600-0310
工作时间:周一至周六,08:30-17:30,节假日休息。