之前有说过,410c没有专用的camera接口,唯一可以用来外接camera的接口就是那个高速接口了。买的那个camera转接板,商家在android L上已经调试过了,而我之前是在android M上调试的,所以一直有问题,后来没办法,重新下载了android 5.1.1的代码,又重新调试的,不过这次就顺利多了,我们选的是ov5645,接下来一起看一下。
顺便提一下,android不同版本的代码下载。
连接:https://developer.qualcomm.com/hardware/dragonboard-410c/software
进入之后,可以在OS Software下面看到Android、Linux、Windows 10IoT Core。在Android下面又有如下文件:
Android Board Support Package vLA.BR.1.2.7-01010-8x16.0-4Android Board Support Package vLA.BR.1.2.4-01810-8x16.0-3 第一个是android M的,第二个是android L的,直接看文件名称根本看不出来哪个是L哪个是M,所以,找源码还花了一些时间,更让人心塞的是,不是下载错误就是编译错误,重下和重新编译了几次才弄好。详细的下载和编译可参考:http://blog.csdn.net/cgx090902/article/details/73250235
接下来进入正题:
路径:kernel/arch/arm64/boot/dts/qcom/apq8016-camera-sensor-sbc.dtsi
在这里面我们可以看到,已经包含了ov5645的配置了,而且还有camera0和camera1等。但是默认配置ov5645是前置的
qcom,sensor-position = <1>;
但是我要用的库是设置的后置,那就改吧,0:后置;1:前置
其次是查看csid和csiphy,默认的是CSI1
qcom,csiphy-sd-index = <1>;
qcom,csid-sd-index = <1>;
但是通过查看硬件原理图会发现,用的CSI0,这里把1都换成0。顺便提一下,410c开发板上CSI是从0开始的,但是商家给的硬件原理图上是从1开始的,不注意看会被坑的很惨的。
这两部分是通过需要和硬件原理图查看来解决的,其他的配置就要根据datasheet和spec去写了。不过camera0是配置的后置,可以把其它的部分直接移植过来。最后如下:
qcom,camera@78 {
compatible = "ovti,ov5645";
reg = <0x78 0x0>;
qcom,slave-id = <0x78 0x300a 0x5645>;
// qcom,csiphy-sd-index = <1>;
// qcom,csid-sd-index = <1>;
qcom,csiphy-sd-index = <0>;
qcom,csid-sd-index = <0>;
qcom,mount-angle = <90>;
qcom,sensor-name = "ov5645";
cam_vdig-supply = <&vph_pwr_vreg>;
cam_vana-supply = <&vph_pwr_vreg>;
cam_vio-supply = <&vph_pwr_vreg>;
// qcom,cam-vreg-name = "cam_vdig", "cam_vio", "cam_vana";
// qcom,cam-vreg-min-voltage = <2100000 0 2850000>;
// qcom,cam-vreg-max-voltage = <2100000 0 2850000>;
// qcom,cam-vreg-op-mode = <200000 0 80000>;
// pinctrl-names = "cam_default", "cam_suspend";
// pinctrl-0 = <&cam_sensor_mclk1_default &cam_sensor_front_default>;
// pinctrl-1 = <&cam_sensor_mclk1_sleep &cam_sensor_front_sleep>;
// gpios = <&msm_gpio 27 0>,
// <&msm_gpio 28 0>,
// <&msm_gpio 33 0>;
qcom,cam-vreg-name = "cam_vdig", "cam_vio", "cam_vana",
"cam_vaf";
qcom,cam-vreg-min-voltage = <2100000 0 2850000 2800000>;
qcom,cam-vreg-max-voltage = <2100000 0 2850000 2800000>;
qcom,cam-vreg-op-mode = <200000 0 80000 100000>;
pinctrl-names = "cam_default", "cam_suspend";
pinctrl-0 = <&cam_sensor_mclk0_default &cam_sensor_rear_default>;
pinctrl-1 = <&cam_sensor_mclk0_sleep &cam_sensor_rear_sleep>;
gpios = <&msm_gpio 26 0>,
<&msm_gpio 35 0>,
<&msm_gpio 34 0>;
qcom,gpio-reset = <1>;
qcom,gpio-standby = <2>;
qcom,gpio-req-tbl-num = <0 1 2>;
qcom,gpio-req-tbl-flags = <1 0 0>;
qcom,gpio-req-tbl-label = "CAMIF_MCLK",
"CAM_RESET",
"CAM_STANDBY";
qcom,gpio-set-tbl-num = <1 1>;
qcom,gpio-set-tbl-flags = <0 2>;
qcom,gpio-set-tbl-delay = <1000 4000>;
qcom,csi-lane-assign = <0x4320>;
qcom,csi-lane-mask = <0x3>;
// qcom,sensor-position = <1>;
qcom,sensor-position = <0>;
qcom,sensor-mode = <0>;
qcom,cci-master = <0>;
// qcom,mclk-23880000;
// clocks = <&clock_gcc clk_mclk1_clk_src>,
// <&clock_gcc clk_gcc_camss_mclk1_clk>;
// clock-names = "cam_src_clk", "cam_clk";
status = "ok";
clocks = <&clock_gcc clk_mclk0_clk_src>,
<&clock_gcc clk_gcc_camss_mclk0_clk>;
clock-names = "cam_src_clk", "cam_clk";
};
最后,还有一个比较关键的部分:
路径:device/qcom/msm8916_64/init.target.rc
在这里把qcamerasvr使能起来,即把disabled屏蔽掉就可以了。
#start camera server as daemon
service qcamerasvr /system/bin/mm-qcamera-daemon
class late_start
user camera
group camera system inet input graphics
# disabled
重新编译boot.img,刷到设备里面,打开一个camera应用,就可以看到图像了。
到这里,在android L上的camrea配置就完成了。