基础:高通bring up camera【转】
本文转载自:http://blog.csdn.net/liwei16611/article/details/53056710
bring UP 需要做的工作
1、kernelspace
sensor driver : 驱动和设备树
2、userspace
camera 对应的chromatix library 和sensor library
准备工作
1、模组原理图
2、sensor spec
3、sensor resolution
代码准备
1、kernel
1、设备树
kernel/arch/arm/boot/***-camera-sensor-cdp.dtsi
qcom,camera@20 {
compatible =“qcom,imx111”;
reg = <0x20>;
qcom,slave-id =<0x20 0x0 0x111>; //(slave id – 0x20, chip id address – 0x0, chip id –0x111)
qcom,csiphy-sd-index= <0>; //(Use CSIPHY subdev 0)
qcom,csid-sd-index= <0>; //(Use CSID subdev 0)
qcom,flash-src-index= <&led_flash0>; //(Use LED flash subdev 0)
qcom,mount-angle =<90>; //(mount angle 90 degree)
qcom,sensor-name =“imx111”;// (sensor name)
cam_vdig-supply =<&pm8941_l3>;// (Use L3 for VDIG)
cam_vana-supply =<&pm8941_l23>;// (Use L23 for VANA)
cam_vio-supply =<&pm8941_lvs2>; //(Use LVS3 for VIO)
cam_vaf-supply =<&pm8941_l17>; //(Use L17 for VAF)
qcom,cam-vreg-name= “cam_vdig”, “cam_vio”, “cam_vana”, “cam_vaf”;
qcom,cam-vreg-type= <0 1 0 0>; //(0 – LDO, 1 – LVS)
qcom,cam-vreg-min-voltage= <1225000 0 2850000 2850000>;// (min voltage)
qcom,cam-vreg-max-voltage= <1225000 0 2850000 2850000>;// (max voltage)
qcom,cam-vreg-op-mode= <105000 0 80000 100000>; //(Optimum mode)
qcom,gpio-no-mux =<0>;
gpios =<&msmgpio 15 0>, <&msmgpio 90 0>;
qcom,gpio-reset =<1>; //(Use gpio pin 90 for reset)
qcom,gpio-req-tbl-num= <0 1>; //(0 – pin 15, 1 – pin 90)
qcom,gpio-req-tbl-flags= <1 0>; //(0 – output gpio, 1 – input gpio)
qcom,gpio-req-tbl-label= “CAMIF_MCLK”, “CAM_RESET1”; //(gpio name)
qcom,gpio-set-tbl-num= <1 1>;// (1 – pin 90)
qcom,gpio-set-tbl-flags= <0 2>; //(0 – GPIOF_OUT_INIT_LOW, 2 -
GPIOF_OUT_INIT_HIGH)
qcom,gpio-set-tbl-delay= <1000 4000>; //(delay in micro sec)
qcom,csi-lane-assign= <0x4320>; //(Use 0x4320 for CSI lane assign)
qcom,csi-lane-mask= <0x1F>; //(Use 0x1F for lane mask)
qcom,sensor-position= <0>; //(0 – back camera, 1 – front camera)
qcom,sensor-mode =<1>;// (1 – 2D, 3 – 3D)
qcom,cci-master =<0>; //(0 – Master 0, 1 – Master 1)
status = “ok”;
};
2、驱动
kernel/drivers/media/platform/msm/camera_v2/sensor/imx111.c
vendor(chromatix library)
1、vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/chromatix/0301/libchromatix/chromatix_imx111/
使用高通的chromatix tunning 软件生成头文件。
2、vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/sensor_libs/imx111/
需要配置以下信息:
1)init, start, stop寄存器配置
2)coarse_int_time_addr 、global_gain_addr 寄存器地址
3)x_output 、y_output、line_length_pclk 、frame_length_lines 寄存器地址
4)full/half resolution 寄存器配置
5)配置每个every resolution 对应的Chromatix library
6)配置每个resolution 对应的sensor_out_info
structsensor_lib_out_info_t sensor_out_info[] = {
{
.x_output = 0x0668,
.y_output = 0x04D0,
.line_length_pclk = 0xDD0,
.frame_length_lines = 0x04E6,
.vt_pixel_clk = 134400000,
.op_pixel_clk = 134400000,
.max_fps = 30,
.min_fps = 7.5,
.binning_factor = 1,
.mode = SENSOR_DEFAULT_MODE,
},
调试
1、测量camera的Power supply: AVDD, DOVDD, DVDD, AFVDD是否正确
2、测量MCLK波形是否正常
3、测量camera的PWDN/RESET是否正常