这篇文章主要介绍在高通平台的CamX框架里面,如何去点亮摄像头马达,需要修改哪些相关的文件。
先来个整体的浏览,看下涉及到需要修改哪些目录下的文件。可以看下图,要让马达运转起来,我们需要修改的基本就是下面4个目录下的相关文件。
1、各种型号的马达配置文件目录
vendor/qcom/proprietary/chi-cdk/oem/qcom/actuator
2、Camera sensor配置文件目录
vendor/qcom/proprietary/chi-cdk/oem/qcom/module
3、各个Camera sensor编译配置的文件目录
vendor/qcom/proprietary/chi-cdk/tools/buildbins
4、这个目录下是dtsi文件,主要配置Camera sensor上电时序等信息
vendor/qcom/proprietary/camera-devicetree
1)vendor/qcom/proprietary/chi-cdk/oem/qcom/actuator
这个目录下,是各个型号的马达配置文件,高通源码里面已经有一些比较常见的马达型号的配置文件,我们可以进行参考。
vendor/qcom/proprietary/chi-cdk/oem/qcom/actuator$ ls
ak7371_actuator.xml dw9714v_actuator.xml dw9763b_actuator.xml gt9764_actuator.xml lc898217xc_actuator.xml
ak7374_actuator.xml dw9718s_actuator.xml dw9767_actuator.xml gt9772_actuator.xml
bu64297gwz_actuator.xml dw9763_actuator.xml dw9800_actuator.xml
针对我们项目上用到的Camera sensor,模组厂会给我们提供关于该颗sensor的相关文档,我们需要获取的马达相关信息,也能从提供的文档中找到。
如下图所示,就是模组厂提供的文档里面的截图,可以看到这个sensor是imx481,马达型号是dw9714v,也就是在vendor/qcom/proprietary/chi-cdk/oem/qcom/actuator 这个目录下,我们需要添加个dw9714v_actuator.xml的文件,如果sersor 用的马达型号高通源码已经有了,那直接用高通原始的配置就可以了。
我们随便打开个xml的文件,看下里面都配置了哪些相关的信息。
ak7374
0x18
FAST
VCM
10
VAF
1
10
VAF
0
1
......
2)vendor/qcom/proprietary/chi-cdk/oem/qcom/module
这个目录下,就是关于camera sensor的配置文件了,关于某颗sensor的的详细信息,是在这边进行创建添加的。
vendor/qcom/proprietary/chi-cdk/oem/qcom/module$ ls
altek1_imx577_module.xml liteon_max7366_eyetrack_module.xml pmd_irs1645_module.xml sunny_imx519_module_talos.xml
altek2_imx577_module.xml liteon_max7366_ov6211_module.xml
下面是其中某颗sensor的module文件内容。
0
oflim
imx376
dw9800
pmic
ofilm_imx376
REAR
0x3210
0
4.04
2.0
0.1
3.496
61.6
46.2
90
360
360
3)/vendor/qcom/proprietary/chi-cdk/tools/buildbins
前面我们说了马达信息的配置文件和camera sensor的配置文件,那这些配置信息是在哪里会用到的呢,好了,就是在这个目录下了。看到buildbins这个名字,我们就可以看到是和编译相关的了,camx里面,各个模块分的更细了,每颗sensor的module和turning等模块,都是可以编译成各自独立的so文件,修改某个模块的内容后,我们可以切到chi-cdk目录下,进行mm编译,编译生成的对应so文件在vendor/lib*/目录下。
vendor/qcom/proprietary/chi-cdk/tools/buildbins$ ls
buildbins_bengal.yaml buildbins_lito.yaml buildbins_sm6150.yaml linux64 win32
buildbins_kona.yaml buildbins.py buildbins.yaml NOTICE yaml
我们打开其中一个yaml文件,看下里面的内容:
sensor_drivers:
- com.qti.sensormodule.truly_imx476:
- sensor/imx476/imx476_sensor.xml
- module/truly_imx476_module.xml
- com.qti.sensormodule.sunny_imx519:
- sensor/imx519/imx519_sensor.xml
- sensor/imx519/imx519_pdaf.xml
- module/sunny_imx519_module.xml
- eeprom/gt24p64b_imx519_eeprom.xml
- actuator/dw9718s_actuator.xml
- flash/back_sensor_flash.xml
4)vendor/qcom/proprietary/camera-devicetree
camera-devicetree 这边的dtsi文件,配置的就是和camera上电相关的内容了, 修改了该目录下的文件后,我们需要编译dtbo.img文件来烧录更新修改。
vendor/qcom/proprietary/camera-devicetree$ ls
bengal-camera.dtsi kona-camera-sensor-mtp.dtsi lito-camera.dtsi
bengal-camera-sensor-idp.dtsi kona-camera-sensor-qrd.dtsi lito-camera-sensor-cdp.dtsi
我们打开其中一个dtsi文件,看下里面的内容;
&soc {
led_flash_rear: qcom,camera-flash0 {
cell-index = <0>;
compatible = "qcom,camera-flash";
flash-source = <&pm8150l_flash0 &pm8150l_flash1>;
torch-source = <&pm8150l_torch0 &pm8150l_torch1>;
switch-source = <&pm8150l_switch2>;
status = "ok";
};
led_flash_rear_aux: qcom,camera-flash1 {
cell-index = <1>;
compatible = "qcom,camera-flash";
flash-source = <&pm8150l_flash0 &pm8150l_flash1>;
torch-source = <&pm8150l_torch0 &pm8150l_torch1>;
switch-source = <&pm8150l_switch2>;
status = "ok";
};
led_flash_triple_rear: qcom,camera-flash@4 {
cell-index = <4>;
compatible = "qcom,camera-flash";
flash-source = <&pm8150l_flash0 &pm8150l_flash1>;
torch-source = <&pm8150l_torch0 &pm8150l_torch1>;
switch-source = <&pm8150l_switch2>;
status = "ok";
};
led_flash_triple_rear_aux: qcom,camera-flash@5 {
cell-index = <5>;
compatible = "qcom,camera-flash";
flash-source = <&pm8150l_flash0 &pm8150l_flash1>;
torch-source = <&pm8150l_torch0 &pm8150l_torch1>;
switch-source = <&pm8150l_switch2>;
status = "ok";
};
led_flash_triple_rear_aux2: qcom,camera-flash@6 {
cell-index = <6>;
compatible = "qcom,camera-flash";
flash-source = <&pm8150l_flash0 &pm8150l_flash1>;
torch-source = <&pm8150l_torch0 &pm8150l_torch1>;
switch-source = <&pm8150l_switch2>;
status = "ok";
};
qcom,cam-res-mgr {
compatible = "qcom,cam-res-mgr";
status = "ok";
};
};
&cam_cci0 {
actuator_rear: qcom,actuator0 {
cell-index = <0>;
compatible = "qcom,actuator";
cci-master = <0>;
cam_vaf-supply = <&pm8150a_l7>;
regulator-names = "cam_vaf";
rgltr-cntrl-support;
rgltr-min-voltage = <2856000>;
rgltr-max-voltage = <3104000>;
rgltr-load-current = <100000>;
};
actuator_rear_aux: qcom,actuator1 {
cell-index = <1>;
compatible = "qcom,actuator";
cci-master = <1>;
cam_vaf-supply = <&pm8150a_l7>;
regulator-names = "cam_vaf";
};
actuator_triple_wide: qcom,actuator4 {
cell-index = <4>;
compatible = "qcom,actuator";
cci-master = <0>;
cam_vaf-supply = <&pm8150a_l7>;
regulator-names = "cam_vaf";
rgltr-cntrl-support;
rgltr-min-voltage = <2856000>;
rgltr-max-voltage = <3104000>;
rgltr-load-current = <100000>;
};
actuator_triple_tele: qcom,actuator5 {
cell-index = <5>;
compatible = "qcom,actuator";
cci-master = <0>;
cam_vaf-supply = <&pm8150a_l7>;
regulator-names = "cam_vaf";
rgltr-cntrl-support;
rgltr-min-voltage = <2856000>;
rgltr-max-voltage = <3104000>;
rgltr-load-current = <100000>;
};
actuator_triple_uw: qcom,actuator6 {
cell-index = <6>;
compatible = "qcom,actuator";
cci-master = <1>;
cam_vaf-supply = <&pm8150a_l7>;
regulator-names = "cam_vaf";
rgltr-cntrl-support;
rgltr-min-voltage = <2856000>;
rgltr-max-voltage = <3104000>;
rgltr-load-current = <100000>;
};
eeprom_rear: qcom,eeprom0 {
cell-index = <0>;
compatible = "qcom,eeprom";
cam_vio-supply = <&pm8009_l7>;
cam_vana-supply = <&pm8009_l5>;
cam_vdig-supply = <&pm8009_l1>;
cam_clk-supply = <&titan_top_gdsc>;
cam_vaf-supply = <&pm8150a_l7>;
regulator-names = "cam_vio", "cam_vana", "cam_vdig",
"cam_clk", "cam_vaf";
rgltr-cntrl-support;
rgltr-min-voltage = <1800000 2800000 1104000 0 2856000>;
rgltr-max-voltage = <1800000 3000000 1104000 0 3104000>;
rgltr-load-current = <120000 80000 1200000 0 100000>;
gpio-no-mux = <0>;
pinctrl-names = "cam_default", "cam_suspend";
pinctrl-0 = <&cam_sensor_mclk0_active
&cam_sensor_active_rear>;
pinctrl-1 = <&cam_sensor_mclk0_suspend
&cam_sensor_suspend_rear>;
gpios = <&tlmm 94 0>,
<&tlmm 93 0>;
gpio-reset = <1>;
gpio-req-tbl-num = <0 1>;
gpio-req-tbl-flags = <1 0>;
gpio-req-tbl-label = "CAMIF_MCLK0",
"CAM_RESET0";
sensor-position = <0>;
sensor-mode = <0>;
cci-master = <0>;
status = "ok";
clocks = <&clock_camcc CAM_CC_MCLK0_CLK>;
clock-names = "cam_clk";
clock-cntl-level = "turbo";
clock-rates = <24000000>;
};
eeprom_rear_aux: qcom,eeprom1 {
cell-index = <1>;
compatible = "qcom,eeprom";
cam_vdig-supply = <&pm8009_l2>;
cam_vio-supply = <&pm8009_l7>;
cam_vana-supply = <&pm8009_l6>;
cam_clk-supply = <&titan_top_gdsc>;
cam_vaf-supply = <&pm8150a_l7>;
regulator-names = "cam_vio", "cam_vana", "cam_vdig",
"cam_clk", "cam_vaf";
rgltr-cntrl-support;
rgltr-min-voltage = <1800000 2800000 1200000 0 2856000>;
rgltr-max-voltage = <1800000 3000000 1200000 0 3104000>;
rgltr-load-current = <120000 80000 1200000 0 100000>;
gpio-no-mux = <0>;
pinctrl-names = "cam_default", "cam_suspend";
pinctrl-0 = <&cam_sensor_mclk1_active
&cam_sensor_active_rear_aux>;
pinctrl-1 = <&cam_sensor_mclk1_suspend
&cam_sensor_suspend_rear_aux>;
gpios = <&tlmm 95 0>,
<&tlmm 92 0>;
gpio-reset = <1>;
gpio-req-tbl-num = <0 1>;
gpio-req-tbl-flags = <1 0>;
gpio-req-tbl-label = "CAMIF_MCLK1",
"CAM_RESET1";
sensor-position = <0>;
sensor-mode = <0>;
cci-master = <1>;
status = "ok";
clocks = <&clock_camcc CAM_CC_MCLK2_CLK>;
clock-names = "cam_clk";
clock-cntl-level = "turbo";
clock-rates = <24000000>;
};
qcom,cam-sensor0 {
cell-index = <0>;
compatible = "qcom,cam-sensor";
csiphy-sd-index = <0>;
sensor-position-roll = <90>;
sensor-position-pitch = <0>;
sensor-position-yaw = <180>;
actuator-src = <&actuator_rear>;
led-flash-src = <&led_flash_rear>;
eeprom-src = <&eeprom_rear>;
cam_vio-supply = <&pm8009_l7>;
cam_bob-supply = <&pm8150a_bob>;
cam_vana-supply = <&pm8009_l5>;
cam_vdig-supply = <&pm8009_l1>;
cam_clk-supply = <&titan_top_gdsc>;
regulator-names = "cam_vio", "cam_vana", "cam_vdig",
"cam_clk", "cam_bob";
rgltr-cntrl-support;
pwm-switch;
rgltr-min-voltage = <1800000 2800000 1104000 0 3008000>;
rgltr-max-voltage = <1800000 3000000 1104000 0 3960000>;
rgltr-load-current = <120000 80000 1200000 0 2000000>;
gpio-no-mux = <0>;
pinctrl-names = "cam_default", "cam_suspend";
pinctrl-0 = <&cam_sensor_mclk0_active
&cam_sensor_active_rear>;
pinctrl-1 = <&cam_sensor_mclk0_suspend
&cam_sensor_suspend_rear>;
gpios = <&tlmm 94 0>,
<&tlmm 93 0>;
gpio-reset = <1>;
gpio-req-tbl-num = <0 1>;
gpio-req-tbl-flags = <1 0>;
gpio-req-tbl-label = "CAMIF_MCLK0",
gpio-req-tbl-label = "CAMIF_MCLK0",
"CAM_RESET0";
sensor-mode = <0>;
cci-master = <0>;
status = "ok";
clocks = <&clock_camcc CAM_CC_MCLK0_CLK>;
clock-names = "cam_clk";
clock-cntl-level = "turbo";
clock-rates = <24000000>;
};
qcom,cam-sensor1 {
cell-index = <1>;
compatible = "qcom,cam-sensor";
csiphy-sd-index = <1>;
sensor-position-roll = <90>;
sensor-position-pitch = <0>;
sensor-position-yaw = <180>;
eeprom-src = <&eeprom_rear_aux>;
led-flash-src = <&led_flash_rear_aux>;
actuator-src = <&actuator_rear_aux>;
cam_bob-supply = <&pm8150a_bob>;
cam_vdig-supply = <&pm8009_l2>;
cam_vio-supply = <&pm8009_l7>;
regulator-names = "cam_vio", "cam_vana", "cam_vdig",
"cam_clk", "cam_bob";
rgltr-cntrl-support;
pwm-switch;
rgltr-min-voltage = <1800000 2800000 1200000 0 3008000>;
rgltr-max-voltage = <1800000 3000000 1200000 0 3960000>;
rgltr-load-current = <120000 80000 1200000 0 2000000>;
gpio-no-mux = <0>;
pinctrl-names = "cam_default", "cam_suspend";
pinctrl-0 = <&cam_sensor_mclk1_active
&cam_sensor_active_rear_aux>;
pinctrl-1 = <&cam_sensor_mclk1_suspend
&cam_sensor_suspend_rear_aux>;
gpios = <&tlmm 95 0>,
<&tlmm 92 0>;
gpio-reset = <1>;
gpio-req-tbl-num = <0 1>;
gpio-req-tbl-flags = <1 0>;
gpio-req-tbl-label = "CAMIF_MCLK1",
"CAM_RESET1";
sensor-mode = <0>;
cci-master = <1>;
status = "ok";
clocks = <&clock_camcc CAM_CC_MCLK1_CLK>;
clock-names = "cam_clk";
clock-cntl-level = "turbo";
clock-rates = <24000000>;
};
&cam_cci1 {
qcom,cam-sensor2 {
cell-index = <2>;
compatible = "qcom,cam-sensor";
csiphy-sd-index = <2>;
sensor-position-roll = <270>;
sensor-position-pitch = <0>;
sensor-position-yaw = <0>;
eeprom-src = <&eeprom_front>;
cam_vio-supply = <&pm8009_l7>;
cam_bob-supply = <&pm8150a_bob>;
cam_vana-supply = <&pm8009_l6>;
cam_vdig-supply = <&pm8009_l3>;
cam_clk-supply = <&titan_top_gdsc>;
regulator-names = "cam_vio", "cam_vana", "cam_vdig",
"cam_clk", "cam_bob";
rgltr-cntrl-support;
pwm-switch;
rgltr-min-voltage = <1800000 2800000 1056000 0 3008000>;
pinctrl-0 = <&cam_sensor_mclk2_active
&cam_sensor_active_rst2>;
pinctrl-1 = <&cam_sensor_mclk2_suspend
&cam_sensor_suspend_rst2>;
gpios = <&tlmm 96 0>,
<&tlmm 78 0>;
gpio-reset = <1>;
gpio-req-tbl-num = <0 1>;
gpio-req-tbl-flags = <1 0>;
gpio-req-tbl-label = "CAMIF_MCLK2",
"CAM_RESET2";
sensor-mode = <0>;
cci-master = <0>;
status = "ok";
clocks = <&clock_camcc CAM_CC_MCLK2_CLK>;
clock-names = "cam_clk";
clock-cntl-level = "turbo";
clock-rates = <24000000>;
};
qcom,cam-sensor3 {
cell-index = <3>;
compatible = "qcom,cam-sensor";
csiphy-sd-index = <3>;
eeprom-src = <&eeprom_tof>;
sensor-position-roll = <270>;
sensor-position-pitch = <0>;
sensor-position-yaw = <0>;
cam_vio-supply = <&pm8009_l7>;
cam_vdig-supply = <&vreg_tof>;
cam_clk-supply = <&titan_top_gdsc>;
rgltr-min-voltage = <1800000 3600000 0>;
rgltr-max-voltage = <1800000 3600000 0>;
rgltr-load-current = <180000 120000 0>;
gpio-no-mux = <0>;
pinctrl-names = "cam_default", "cam_suspend";
pinctrl-0 = <&cam_sensor_mclk3_active
&cam_sensor_active_3>;
pinctrl-1 = <&cam_sensor_mclk3_suspend
&cam_sensor_suspend_3>;
gpios = <&tlmm 97 0>,
<&tlmm 109 0>;
gpio-reset = <1>;
gpio-req-tbl-num = <0 1>;
gpio-req-tbl-flags = <1 0>;
gpio-req-tbl-label = "CAMIF_MCLK3",
"CAM_RESET3";
sensor-mode = <0>;
cci-master = <1>;
status = "ok";
clocks = <&clock_camcc CAM_CC_MCLK3_CLK>;
clock-names = "cam_clk";
clock-cntl-level = "turbo";
clock-rates = <24000000>;
};
};
------- 2020.05.18 20:36
欢迎关注我的个人微信公众号,公众号会记录自己开发的点滴,还有日常的生活,希望和更多的小伙伴一起交流~~