您当前的位置: 首页 >> 资讯 >  >> 
Camera|12.瑞芯微摄像头自动焦距马达驱动移植
来源:面包芯语      时间:2023-08-22 12:33:36
点击左上方蓝色“一口Linux”,选择“设为星标”

3. 模块图

4. 引脚

5. 参考电路

6. i2c时序

由以下时序可以看到,vcm9714利用I2C接口通信时,每次读/写,直接传输2个字节的数据,通信之前,不需要发送内部寄存器地址。


(资料图片)

7. 寄存器格式

三、驱动移植

vcm9714与rk3568连接图:

@arch/arm64/boot/dts/rockchip/rk3568-evb1-ddr4-v10.dtsi560dw9714:dw9714@c{561compatible="dongwoon,dw9714";562status="okay";563reg=<0x0c>;564rockchip,camera-module-index=<0>;565rockchip,vcm-start-current=<10>;566rockchip,vcm-rated-current=<85>;567rockchip,vcm-step-mode=<5>;568rockchip,camera-module-facing="back";569};570571ov13850:ov13850@10{……584lens-focus=<&dw9714>;……591};

其中,下面这两个属性,必须要和对应的的摄像头ov13850信息保持一致

rockchip,camera-module-index=<0>;rockchip,camera-module-facing="back";

摄像头支持的马达驱动信息通过以下属性关联

lens-focus=<&dw9714>;
@kernel\drivers\media\i2c\Makefileobj-$(CONFIG_VIDEO_DW9714)+=dw9714.o
@kernel\drivers\media\i2c\KconfigconfigVIDEO_DW9714tristate"DW9714lensvoicecoilsupport"dependsonI2C&&VIDEO_V4L2&&MEDIA_CONTROLLERdependsonVIDEO_V4L2_SUBDEV_API---help---ThisisadriverfortheDW9714cameralensvoicecoil.DW9714isa10bitDACwith120mAoutputcurrentsinkcapability.Thisisdesignedforlinearcontrolofvoicecoilmotors,controlledviaI2Cserialinterface.
@arch/arm64/configs/rockchip_defconfig572CONFIG_VIDEO_DW9714=y
rk_android11.0_sdk_220718\kernel\drivers\media\i2c\dw9714.c

四、调试信息

1. 启动的驱动log

[0.800799]vm149c4-000c:probing...[0.800820]vm149c4-000c:driverversion:00.01.00[0.800834]vm149c4-000c:couldnotgetmodulerockchip,vcm-max-currentfromdts![0.800847]vm149c4-000c:couldnotgetmodulerockchip,vcm-start-currentfromdts![0.800860]vm149c4-000c:couldnotgetmodulerockchip,vcm-rated-currentfromdts![0.800872]vm149c4-000c:couldnotgetmodulerockchip,vcm-step-modefromdts![0.800907]vm149c4-000c:probingsuccessful

2. 查看拓扑结构

media-ctl-p……………-entity74:m00_b_ov138504-0010(1pad,1link)typeV4L2subdevsubtypeSensordevicenodename/dev/v4l-subdev4pad0:Source[fmt:SBGGR10/4224x3136]->"rockchip-csi2-dphy0":0[]-entity78:m00_b_gpio-flash(0pad,0link)typeV4L2subdevsubtypeFlashdevicenodename/dev/v4l-subdev5-entity79:m00_b_dw97144-000c(0pad,0link)typeV4L2subdevsubtypeLensdevicenodename/dev/v4l-subdev6

四、驱动分析

vcm9714驱动比较简单,基于i2c总线,

核心就是要注册基于v4l2的subdev,

提供给用户层调用的核心回调函数如下:

staticconststructv4l2_ctrl_opsdw9714_vcm_ctrl_ops={.g_volatile_ctrl=dw9714_get_ctrl,.s_ctrl=dw9714_set_ctrl,};staticintdw9714_init_controls(structdw9714_device*dev_vcm){structv4l2_ctrl_handler*hdl=&dev_vcm->ctrls_vcm;conststructv4l2_ctrl_ops*ops=&dw9714_vcm_ctrl_ops;v4l2_ctrl_handler_init(hdl,1);v4l2_ctrl_new_std(hdl,ops,V4L2_CID_FOCUS_ABSOLUTE,0,VCMDRV_MAX_LOG,1,VCMDRV_MAX_LOG);……}
staticconststructv4l2_subdev_core_opsdw9714_core_ops={.ioctl=dw9714_ioctl,};staticconststructv4l2_subdev_opsdw9714_ops={.core=&dw9714_core_ops,};staticintdw9714_probe(structi2c_client*client,conststructi2c_device_id*id){v4l2_i2c_subdev_init(&dw9714_dev->sd,client,&dw9714_ops);}

所有camera原创文章已经汇总成pdf,

关注公众号:一口Linux,

后台回复:rxw

即可获取

这是一口君的新书,感谢大家支持!

精彩文章合集

文章推荐

标签:

X 关闭

X 关闭