以OV8865为例
1、kernel部分:
A、kernel_driver:把驱动文件ov8865_qtech_f8865ac.c 放到kernel/drivers/media/platform/msm/camera_v2/sensor/目录下
B、kernel_dtsi:
把如下板级信息加到 kernel/arch/arm/boot/dts/msm8610-qrd-camera-sensor.dtsi文件中
actuator1: qcom,actuator@18 {
cell-index = <4>;
reg = <0x18>;
compatible = "qcom,actuator";
qcom,cci-master = <0>;
};
eeprom0:qom,eeprom@2b{
cell-index = <0>;
reg = <0x2b 0x0>;
...
...
};
qcom,camera@7f {
compatible = "qcom,ov8865_qtech";
reg = <0x7f>;
qcom,slave-id = <0x6c 0x300b 0x8865>;
qcom,csid-sd-index = <0>;
qcom,actuator-src = <&actuator1>;
qcom,eeprom-src = <&eeprom0>;
qcom,led-flash-src = <&led_flash0>;
qcom,mount-angle = <90>;
qcom,sensor-name = "ov8865_qtech";
cam_vdig-supply = <&pm8110_l7>;
cam_vana-supply = <&pm8110_l19>;
cam_vio-supply = <&pm8110_l14>;
qcom,cam-vreg-name = "cam_vdig", "cam_vio", "cam_vana";
qcom,cam-vreg-type = <0 0 0>;
qcom,cam-vreg-min-voltage = <1500000 1800000 2850000>;
qcom,cam-vreg-max-voltage = <1500000 1800000 2850000>;
qcom,cam-vreg-op-mode = <200000 200000 100000>;
qcom,gpio-no-mux = <0>;
gpios = <&msmgpio 13 0>,
<&msmgpio 21 0>,
<&msmgpio 20 0>,
<&pm8110_gpios 2 0>;
qcom,gpio-reset = <1>;
qcom,gpio-standby = <2>;
qcom,gpio-vdig = <3>;
qcom,gpio-req-tbl-num = <0 1 2 3>;
qcom,gpio-req-tbl-flags = <1 0 0 0>;
qcom,gpio-req-tbl-label = "CAMIF_MCLK",
"CAM_RESET1",
"CAM_STANDBY",
"CAM_VDIG";
qcom,csi-lane-assign = <0xe4>;
qcom,csi-lane-mask = <0x3>;
qcom,sensor-position = <0>;
qcom,sensor-mode = <1>;
qcom,cci-master = <0>;};
C、kernel-clock:
这部分主要是针对 B 的,增加一些I2C地址
如下代码断:
--- a/arch/arm/mach-msm/clock-8610.c
+++ b/arch/arm/mach-msm/clock-8610.c
@@ -3033,6 +3033,7 @@ static struct clk_lookup msm_clocks_8610[] = {
CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-0020"),
CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-006a"),
CLK_LOOKUP("cam_src_clk", mclk1_clk_src.c, "6-0048"),
+ CLK_LOOKUP("cam_src_clk", mclk0_clk_src.c, "6-006c"), //front camera is mclk1_clk_src.c back camera is mclk0_clk_src.c
CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-006f"),
CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-0034"),
CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-007d"),
@@ -3042,6 +3043,7 @@ static struct clk_lookup msm_clocks_8610[] = {
CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-0020"),
CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-006a"),
CLK_LOOKUP("cam_clk", mclk1_clk.c, "6-0048"),
+ CLK_LOOKUP("cam_clk", mclk0_clk.c, "6-006c"),
D、把C文件加到Makefile
--- a/drivers/media/platform/msm/camera_v2/sensor/Makefile
+++ b/drivers/media/platform/msm/camera_v2/sensor/Makefile
@@ -22,3 +22,4 @@ obj-y += gc2035.o
#obj-$(CONFIG_SP1628) += sp1628.o
obj-$(CONFIG_GC0339) += gc0339.o
obj-$(CONFIG_HM1090) += HM1090.o
+obj-y +=ov8865_qtech_f8865ac.o
kernel部分就这么多了,此时可以先编译一个bootimage看看能不能编译过。
2、vendor部分
这一部分主要包括:效果(chromatix)、马达AF驱动(actuators)、库文件(sensor_libs)
A、效果(chromatix):把chromatix_ov8865_qtech_f8865ac整个文件夹放到vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/chromatix/0301/libchromatix/下
B、马达AF驱动(actuators) :把af_main_cam_camcorder_6.h、af_main_cam_camera_6.h AF头文件放到vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/actuators/0301/目录下。
同时做如下工作:
--- a/mm-camera/mm-camera2/media-controller/modules/sensors/actuators/actuator.c
+++ b/mm-camera/mm-camera2/media-controller/modules/sensors/actuators/actuator.c
@@ -13,7 +14,7 @@
-static actuator_ctrl_t actuators[ACTUATOR_CAM_MODE_MAX][6] = {
+static actuator_ctrl_t actuators[ACTUATOR_CAM_MODE_MAX][7] = {
@@ -21,6 +22,7 @@ static actuator_ctrl_t actuators[ACTUATOR_CAM_MODE_MAX][6] = {
#include "af_main_cam_camera_2.h"
#include "af_main_cam_camera_3.h"
#include "af_main_cam_camera_4.h"
#include "af_main_cam_camera_5.h"
+ #include "af_main_cam_camera_6.h"
@@ -29,6 +31,7 @@ static actuator_ctrl_t actuators[ACTUATOR_CAM_MODE_MAX][6] = {
#include "af_main_cam_camcorder_2.h"
#include "af_main_cam_camcorder_3.h"
#include "af_main_cam_camcorder_4.h"
#include "af_main_cam_camcorder_5.h"
+ #include "af_main_cam_camcorder_6.h"
}
};在af_main_cam_camcorder_6.h中会有af_header_info_t:
如下:
/* af_header_info_t */
{
/* header_version */
0x301,
/* cam_name */
ACTUATOR_MAIN_CAM_6,
/* module_name */
"ov8865",
/* actuator_name */
"BU64243GWZ",
}, /* af_header_info_t */
其中ACTUATOR_MAIN_CAM_6这个需要在kernel中定义,在kernel/include/media/msm_cam_sensor.h文件中添加ACTUATOR_MAIN_CAM_6
enum af_camera_name {
ACTUATOR_MAIN_CAM_0,
ACTUATOR_MAIN_CAM_1,
ACTUATOR_MAIN_CAM_2,
ACTUATOR_MAIN_CAM_3,
ACTUATOR_MAIN_CAM_4,
ACTUATOR_MAIN_CAM_5,
ACTUATOR_MAIN_CAM_6
ACTUATOR_WEB_CAM_0,
ACTUATOR_WEB_CAM_1,
ACTUATOR_WEB_CAM_2,
};
C、库文件(sensor_libs) :把ov8865_qtech_f8865ac整个文件夹放到vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/sensor_libs/目录下
D、把相关文件添加到config中,如下:
--- a/common/config/device-vendor.mk
+++ b/common/config/device-vendor.mk
@@ -526,6 +526,7 @@ MM_CAMERA += libmmcamera_s5k3l1yx
+MM_CAMERA += libmmcamera_ov8865_qtech //库文件
MM_CAMERA += libmmcamera_SKUAA_ST_gc0339
@@ -617,6 +618,10 @@ MM_CAMERA += libchromatix_ov8825_7853f_snapshot
MM_CAMERA += libchromatix_ov8825_7853f_zsl
+MM_CAMERA += libchromatix_ov8865_qtech_f8865ac_snapshot //效果文件
+MM_CAMERA += libchromatix_ov8865_qtech_f8865ac_preview
+MM_CAMERA += libchromatix_ov8865_qtech_f8865ac_common
+MM_CAMERA += libchromatix_ov8865_qtech_f8865ac_default_video
MM_CAMERA += libchromatix_SKUAA_ST_gc0339_common
@@ -640,6 +645,7 @@ MM_CAMERA += libchromatix_skuf_ov5648_p5v23c_preview
MM_CAMERA += libmmcamera_truly_cm7700_eeprom
+MM_CAMERA += libmmcamera_qtech_f8865ac_eeprom //e2prom文件
MM_CAMERA += libmmcamera_sunny_p12v01m_eeprom
编systemimage.img验证