打开应用层相关日志
adb shell setprop persist.vendor.camera.sensor.debug 6
adb shell setprop persist.vendor.camera.hal.debug 6
adb shell setprop persist.vendor.camera.mci.debug 6
setprop persist.vendor.camera.expose.aux 1
打开预览的dump:setprop persist.vendor.camera.dumpimg 1
dtsi相关解析
// csi0 默认为主摄
qcom,csiphy-sd-index = <0>;
// 同上
qcom,csid-sd-index = <0>;// 位置0 表主摄。vendor的配置起实际作用
qcom,sensor-position = <0>;
qcom,sensor-mode = <0>;
// 挂载的CCI通道编号(0/1)
qcom,cci-master = <0>;
使能sensor步骤
1. 加入sensor驱动代码
vendor\qcom\proprietary\mm-camera\mm-camera2\media-controller\modules\sensors\sensor\libs\
2. 配置传感器
配置 camera ID, slaver address, sensor ID
xml文件
1.路径:vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/
2.主要参数
a.CameraId: 0, 1, 2
CameraId 对应于 qcom,camera@0, qcom,camera@1 和 qcom,camera@2 中
内核/msm-4.4/arch/arm/boot/dts/qcom/sdm660-camera-sensor-mtp.dtsi
b.CSIDCore:0, 1, 2
CSIDCore对应于qcom,csid-sd-index中
内核/msm-4.4/arch/arm/boot/dts/qcom/sdm660-camera-sensor-mtp.dtsi
c.cci-master: 0, 1
cci-master 对应传感器使用的 cci 资源,定义在
内核/msm-4.4/arch/arm/boot/dts/qcom/sdm660-camera-sensor-mtp.dtsi。
3.位置
BACK、FRONT 和 BACK_AUX
(BACK_AUX 设置为深度摄像头,用于双摄像头设备,一般不会用过的。)
4.安装角度:0、90、180、270
5.配置 csi_lane_mask、csi_lane_assign 和 combo_mode
csi_lane_mask:该 8 位字段指示哪些 MIPI 通道有效和启用。
csi_lane_assign:有时客户的硬件可能设计有不同的引脚映射与模块芯片组的相机数据通道的参考引脚图相比,例如传感器数据通道 0 可以连接到 MSM 数据通道 4。 此参数可以配置为处理此类情况// csi配置,bit1固定为clk,bit0,bit2、bit3、bit4,
//代表miipi-csi lane通道是否启用
// 如使用4lane,为0xb11111=0x1F。 使用2lane,0b111 = 0x03
添加效果文件
添加chromatix代码:vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/xxxxx(新增的)
在驱动中配置电源和上电/下电顺序:vendor\qcom\proprietary\mm-camera\mm-camera2\media-controller\modules\sensors\sensor\libs\xxxxx(新增的)
配置以下两个.xml文件:
vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/s
dm660_camera.xml
vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/xxxxx_chromatix.xml(新增的)
添加编译文件vendor/qcom/proprietary/common/config/device-vendor.mk
YUV sensor配置
上述配置基于Bayer传感器。 部分传感器输出类型为YUV时配置不同,列出主要区别
以下:
1.供应商驱动程序关于sensor_output 的配置不同。
2.没有chromatix代码,所以不需要配置xxx_chromatix.xml。 也没有
需要在 sdm660_camera.xml 中添加 ChromatixName。
添加 AF 执行器驱动程序
一。更新设备树文件
- 在目标的相机 .dtsi 文件中,例如 sdm660-camera-sensor-mtp.dtsi,为执行器添加一个node 并为 qcom,actuator-src 分配执行器节点。
路径:kernel/arch/arm/boot/dts/qcom/sdm660-camera-sensor-mtp.dtsi
- 请注意AF的电源是与相机传感器一起指定的,它是每个 vreg 名称、类型、最小电压、最大电压和操作模式列表中的第四个条目
二。添加AF执行器驱动程序
1.添加自动对焦执行器文件
vendor\qcom\proprietary\mm-camera\mm-camera2\media-controller\modules\sensors\actuator\libs
2.添加AF算法调优文件
关于 SC66,没有单独的 chromatix 代码。 它包含在传感器 3A 文件中。
vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/chromatix/0310/chromatix_xxxx(新增)/3A/
3.更新 sdm660_camera.xml 配置
三。更新设备树
添加 EEPROM 驱动程序
一。更新设备树文件
在目标相机 .dtsi 文件中,例如 msm8953-camera-sensor-mtp.dtsi,为 EEPROM 添加一个节点并为 qcom,eeprom-src 分配 EEPROM 节点。
路径 kernel/msm-4.4/arch/arm/boot/dts/qcom/sdm660-camera-sensor-mtp.dtsi
二。更新传感器驱动程序文件
路径:vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/configs/sdm660_camera.xml
三。增加EEPROM驱动文件
vendor\qcom\proprietary\mm-camera\mm-camera2\media-controller\modules\sensors\eeprom\libs\sony_imx214
四。调通 xml文件:(前置ov5695 后置imx214 景深ov2685 )
<CameraConfigurationRoot>
<CameraModuleConfig><CameraId>1</CameraId><SensorName>imx214</SensorName><ActuatorName>dw9714</ActuatorName><FlashName>gpio</FlashName><EepromName>sony_imx214</EepromName><ChromatixName>imx214_chromatix</ChromatixName><ModesSupported>1</ModesSupported><Position>BACK</Position><MountAngle>180</MountAngle><CSIInfo><CSIDCore>1</CSIDCore><LaneMask>0x1F</LaneMask><LaneAssign>0x4320</LaneAssign><ComboMode>0</ComboMode></CSIInfo><LensInfo><FocalLength>3.47</FocalLength><FNumber>2.2</FNumber><TotalFocusDistance>1.9</TotalFocusDistance><HorizontalViewAngle>63.84</HorizontalViewAngle><VerticalViewAngle>47.88</VerticalViewAngle><MinFocusDistance>0.1</MinFocusDistance></LensInfo></CameraModuleConfig><CameraModuleConfig><CameraId>0</CameraId><SensorName>ov5695</SensorName><ActuatorName>dw9714</ActuatorName><ChromatixName>ov5695_chromatix</ChromatixName><ModesSupported>1</ModesSupported><Position>FRONT</Position><MountAngle>0</MountAngle><CSIInfo><CSIDCore>0</CSIDCore><LaneMask>0x7</LaneMask><LaneAssign>0x4320</LaneAssign><ComboMode>0</ComboMode></CSIInfo><LensInfo><FocalLength>1.98</FocalLength><FNumber>2.4</FNumber><TotalFocusDistance>1.2</TotalFocusDistance><HorizontalViewAngle>68.0</HorizontalViewAngle><VerticalViewAngle>51.0</VerticalViewAngle><MinFocusDistance>0.1</MinFocusDistance></LensInfo>
</CameraModuleConfig>
<CameraModuleConfig><CameraId>2</CameraId><SensorName>ov2685</SensorName><ChromatixName>ov2685_chromatix</ChromatixName><ModesSupported>1</ModesSupported><Position>BACK_AUX</Position><MountAngle>0</MountAngle><CSIInfo><CSIDCore>2</CSIDCore><LaneMask>0x07</LaneMask><LaneAssign>0x4320</LaneAssign><ComboMode>0</ComboMode></CSIInfo><LensInfo><FocalLength>3.47</FocalLength><FNumber>2.2</FNumber><TotalFocusDistance>1.9</TotalFocusDistance><HorizontalViewAngle>63.84</HorizontalViewAngle><VerticalViewAngle>47.88</VerticalViewAngle><MinFocusDistance>0.1</MinFocusDistance></LensInfo></CameraModuleConfig>
</CameraConfigurationRoot>
常见错误
1.打开摄像头闪退
kernel\msm-4.4\include\uapi\media\msmb_camera.h
#define MSM_MAX_CAMERA_SENSORS 8//扩大最大camera sensor数量
2.设备上电异常,有两种情况 a.sensor模块电源异常,b.sensor模块电源正常
a.sensor模块电源异常
[ 14.384568] msm_cci_init:1439: hw_version = 0x10060000
[ 14.384742] msm_cci_irq:1797 MASTER_0 error 0x10000000
[ 14.384797] msm_cci_i2c_read:960 read_words = 0, exp words = 1
[ 14.388772] msm_cci_i2c_read_bytes:1043 failed rc -22
[ 14.395030] msm_camera_cci_i2c_read: line 47 rc = -22
[ 14.399818] msm_sensor_match_id: s5k3p3: read id failed
[ 14.404849] msm_sensor_check_id:1410 match id failed rc -22
[ 14.668475] msm_pcm_volume_ctl_get substream runtime not found
[ 14.668705] msm_adsp_stream_callback_get: ASM Stream PP event queue is not initialized.
[ 14.680820] s5k3p3 power up failed
[ 14.681092] MSM-SENSOR-INIT msm_sensor_driver_cmd:80 msm_sensor_driver_cmd failed (non-fatal) rc -22原因:电源异常,设备硬件接触不良
b.sensor模块电源正常
[ 14.982814] msm_cci_init:1439: hw_version = 0x10060000
[ 14.982994] msm_cci_irq:1803 MASTER_1 error 0x40000000
[ 14.983049] msm_cci_i2c_read:960 read_words = 0, exp words = 1
[ 14.987314] msm_cci_i2c_read_bytes:1043 failed rc -22
[ 14.993014] msm_camera_cci_i2c_read: line 47 rc = -22
[ 14.998063] msm_sensor_match_id: ov5695: read id failed
[ 15.003111] msm_sensor_check_id:1410 match id failed rc -22
[ 15.410817] ov5695 power up failed
[ 15.410841] MSM-SENSOR-INIT msm_sensor_driver_cmd:80 msm_sensor_driver_cmd failed (non-fatal) rc -22
[ 15.413199] MSM-SENSOR-INIT msm_sensor_init_subdev_do_ioctl:146 msm_sensor_init_subdev_do_ioctl:146 VIDIOC_MSM_SENSOR_INIT_CFG failed (non-fatal)原因:设备I2C地址出错,驱动给的i2c地址不一定是正确的
一定要和厂商确认清楚!!!!
3.景深摄像头报错
11-15 06:51:52.354 3892 3892 D CameraDemo.DCTF: cameraId = 2
11-15 06:51:52.356 3892 3892 W ctel.cameradem: Accessing hidden method Landroid/hardware/Camera;->openLegacy(II)Landroid/hardware/Camera; (light greylist, reflection)
11-15 06:51:52.360 1088 3588 I CameraService: CameraService::connect call (PID -1 "com.quectel.camerademo", camera ID 2) for HAL version 256 and Camera API version 1
11-15 06:51:52.362 1088 3588 W libc : Unable to set property "sys.camera.package" to "com.quectel.camerademo": connection failed; errno=13 (Permission denied)
11-15 06:51:52.375 674 674 I QCamera : <HAL><INFO> getCameraInfo: 382: getCameraInfo,382: camera_id: 2, mNumOfCSICameras: 2, mNumOfCameras: 7,mNumOfUSBCameras: 3
11-15 06:51:52.376 674 674 E libc : Access denied finding property "sys.camera.package"
11-15 06:51:52.376 674 674 E libc : Access denied finding property "sys.vendor.camera.splice"
11-15 06:51:52.349 1088 1088 W Binder:1088_1: type=1400 audit(0.0:226): avc: denied { write } for name="property_service" dev="tmpfs" ino=18341 scontext=u:r:cameraserver:s0 tcontext=u:object_
r:property_socket:s0 tclass=sock_file permissive=0
11-15 06:51:52.376 674 674 I QualcommUsbCamera: usbcam_get_camera_info,281: camera id: 2 E
11-15 06:51:52.398 1100 3948 E FileSource: Failed to open file '/product/media/audio/ui/camera_click.ogg'. (No such file or directory)原因:进入usbcamera 模组
解决:setprop persist.vendor.camera.expose.aux 1
4.相机黑屏打印如下
01-01 15:30:59.741 690 7054 E mm-camera: <STATS_AIS ><ERROR> 1259: dsps_send_request: Error preparing request message!
01-01 15:31:06.727 690 7128 E mm-camera: <MCT ><ERROR> 98: mct_bus_sof_thread_run: FATAL Session 5: SOF Freeze! Sending error message
原因:
以上日志表明获取流失败。 这可能是由于不正确注册配置,
或有问题的 MIPI 信号和 xxx_lib.h 中的不正确的lane_cnt
硬件 信号测试其导通性能!!!
- 出现probe成功,但还是反复sensor already probed
原因:是画质文件chromatix没有合成功,或者合入的有问题。
移远apk 无法打开imx214
原因:驱动里的效果参数2–无对应的效果参数,调试:
修改如下参数 移远apk可用
跑到某组参数去 然后黑屏无反应退出