赞
踩
本文基于展锐的ums9620-2h10平台上讲解Camera驱动的移植和配置的完整过程。
展锐平台SDK的很多功能一般都是以模块化为主。camera的驱动位于libcamera这个模块。驱动代码具体路径为:vendor/sprd/modules/libcamera/。整个模块的驱动代码结构如下:
编译型配置: bsp/kernel5.4/kernel5.4/arch/arm64/boot/dts/sprd/ums9620-2h10-overlay.dts
编译型配置:vendor/sprd/modules/libcamera/sensor/sensor_drv/classic/
解析型配置:vendor/sprd/modules/libcamera/sensor/its_param/qogirl6/
解析型配置:device/sprd/qogirl6/ums9620-2h10/module/camera/sensor_config.xml
文件路径如下:bsp/kernel5.4/kernel5.4/arch/arm64/boot/dts/sprd/ums9260-2h10-overlay.dts。要根据实际使用平台的硬件原理图配置,确定Camera挂在哪一路I2C上,reset-gpiod的引脚以及IOVDD、AVDD、DVDD和AFVDD的供电
- &i2c0 {
- status = "okay";
- clock-frequency = <400000>;
- #address-cells = <1>;
- #size-cells = <0>;
- //senor_main: sensor_id 0 (一般为后主摄)
- //senor_main2: sensor_id 2 (一般为后辅摄)
-
- sensor_main: sensor-main@20 {
- compatible = "sprd,sensor-main";
- reg = <0x20>; //I2C地址,用来区分I2C设备,不一定是设备的实际地址
- clock-names = "clk_src","sensor_eb",
- "clk_96m","clk_64m",
- "clk_51m2","clk_48m","clk_26m";
- clocks = <&mm_clk CLK_SENSOR0>,<&mm_gate CLK_SENSOR0_EN>,
- <&g5l_pll CLK_TGPLL_96M>,<&g5l_pll CLK_TGPLL_64M>,
- <&g5l_pll CLK_TGPLL_51M2>,<&g5l_pll CLK_TGPLL_48M>,<&ext_26m>;
- vddio-supply = <&vddcamio>; //IOVDD
- vddcama-supply = <&vddcama0>; //AVDD
- vddcamd-supply = <&vddcamd0>;//DVDD
- vddcammot-supply = <&vddcammot0>; //AFVDD
- reset-gpios = <&ap_gpio 40 0>; //reset
- power-down-gpios = <&ap_gpio 46 0>; //PWDN
- sprd,phyid = <0>; //PHY
- csi = <&csi0>; //csi
- power-domains = <&mm_domain>;
- };
- //senor_sub: sensor_id 1 (一般为前摄)
- sensor_sub: sensor-sub@5a {
- compatible = "sprd,sensor-sub";
- reg = <0x5a>;
- clock-names = "clk_src","sensor_eb",
- "clk_96m","clk_64m",
- "clk_51m2","clk_48m","clk_26m";
- clocks = <&mm_clk CLK_SENSOR0>,<&mm_gate CLK_SENSOR0_EN>,
- <&g5l_pll CLK_TGPLL_96M>,<&g5l_pll CLK_TGPLL_64M>,
- <&g5l_pll CLK_TGPLL_51M2>,<&g5l_pll CLK_TGPLL_48M>,<&ext_26m>;
- vddio-supply = <&vddcamio>;
- vddcama-supply = <&vddcama0>;
- vddcamd-supply = <&vddcamd0>;
- vddcammot-supply = <&vddcammot0>;
- reset-gpios = <&ap_gpio 39 0>;
- power-down-gpios = <&ap_gpio 45 0>;
- sprd,phyid = <1>;
- csi = <&csi1>;
- power-domains = <&mm_domain>;
- };
- };
-
驱动文件存放的路径为:vendor/sprd/modules/libcamera/sensor/sensor_drv/
展锐平台的框架已经在classic目录下建好存放各sensor vendor对应的驱动代码文件夹,将自己所用的Camera放到对应文件夹中,这里我用的是OmniVision的ov08a10
添加好驱动后要配置一下sensor_lib_cfg.mk文件,在sensor_lib_cfg.mk中添加libsensor_ov08a10将编译好的so文件打包到pac。
- sensor id 0
- <CameraModuleCfg> //sensor属性字段
- <SlotId>0</SlotId>
- <SensorName>ov08a10</SensorName> //sensor Name:与sensor驱动文件夹要保持一致
- <Facing>BACK</Facing> //sensor的朝向,指的是后摄
- <Orientation>90</Orientation> //sensor安装的角度
- <Resource_cost>55</Resource_cost> //sensor的资源占有比例,0-100
- <SensorRole>dualcam_master</SensorRole> //sensor角色,如不配置认为单摄
- <VCM>
- <AfName>lc898219</AfName> //与AF驱动文件名称保持一致
- <Mode>0</Mode> //AF的工作模式。默认为0,暂未使用
- </VCM>
-
- <TuningParameter>
- <TuningName>ov08a10</TuningName>//与its_param目录下的Tunning参数文件夹名称相同
- </TuningParameter>
- </CameraModuleCfg>
-
添加AF的驱动文件到如下路径:vendor/sprd/modules/libcamera/sensor/af_drv/。要根据自己camera实际使用的AF添加。
添加完AF驱动后,要配置vcm_lib_cfg.mk文件将编译好的so打包到pac:
以上就是基于展锐平台框架下的camera驱动移植和配置的完整流程。本篇文章是记录自己的学习过程,方便自己以后可以查看笔记,也希望对大家有所帮助,谢谢!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。