【Camera专题】I2C不通或地址读错总结(含闪光灯)

2019-05-11  本文已影响0人  c枫_撸码的日子

系列文章
【Camera专题】I2C不通或地址读错总结
【Camera专题】概率性读不到id~二

一.I2C地址不通

平台:高通 msm8909(wear2001)
最近遇到I2C地址不通问题,通信失败,导致摄像头无法点亮。
分析方法:
1.硬件层面

2.软件层面

二.(LM36010)闪光灯 I2C地址不通

平台:高通429
报错log:

658 [wcnss_service] msm_flash_init:488 Enter
c0   658 [wcnss_service] subsys-pil-tz a21b000.qcom,pronto: wcnss: Brought out of reset
c0  1031 [CAM_sensor] msm_flash_i2c_write_table:162 zcf_flash 1
c1  1031 [CAM_sensor] msm_cci_subdev_ioctl line 1848
c1  1031 [CAM_sensor] msm_cci_config line 1681 cmd 6
c1  1031 [CAM_sensor] msm_cci_i2c_write set param sid 0x32 retries 3 id_map 0
c1  1031 [CAM_sensor] msm_cci_validate_queue line 214 CCI_I2C_M0_Q0_CUR_WORD_CNT_ADDR 0 len 63 max 64
c1  1031 [CAM_sensor] msm_cci_data_queue addr type 1 data type 1 cmd_size 1
c1  1031 [CAM_sensor] msm_cci_data_queue CCI_I2C_M0_Q0_LOAD_DATA_ADDR:val 0x310:0x30321
c1  1031 [CAM_sensor] msm_cci_write_i2c_queue:272 called
c1  1031 [CAM_sensor] msm_cci_validate_queue line 214 CCI_I2C_M0_Q0_CUR_WORD_CNT_ADDR 1 len 1 max 64
c1  1031 [CAM_sensor] msm_cci_write_i2c_queue CCI_I2C_M0_Q0_LOAD_DATA_ADDR:val 0x310:0x6
c1  1031 [CAM_sensor] msm_cci_data_queue line 704 CUR_WORD_CNT_ADDR 2 len 1 max 64
c1  1031 [CAM_sensor] msm_cci_data_queue cmd_size 1 addr 0x1 data 0x22
c1  1031 [CAM_sensor] msm_cci_get_queue_free_size line 597 CCI_I2C_M0_Q0_CUR_WORD_CNT_ADDR 2 max 64
c1  1031 [CAM_sensor] msm_cci_data_queue LOAD_DATA_ADDR 0x220129, q: 0, len:1, cnt: 2
c1  1031 [CAM_sensor] msm_cci_write_i2c_queue:272 called
c1  1031 [CAM_sensor] msm_cci_validate_queue line 214 CCI_I2C_M0_Q0_CUR_WORD_CNT_ADDR 3 len 1 max 64
c1  1031 [CAM_sensor] msm_cci_write_i2c_queue CCI_I2C_M0_Q0_LOAD_DATA_ADDR:val 0x310:0x7
<3>[   18.890167] c1  1031 [CAM_sensor] msm_cci_load_report_cmd:444 CCI_I2C_REPORT_CMD curr_w_cnt: 4
c1  1031 [CAM_sensor] msm_cci_load_report_cmd:451 CCI_I2C_M0_Q0_EXEC_WORD_CNT_ADDR 5
c0  1066 [ip6tables-wrapp] msm_cci_irq CCI_I2C_M0_STATUS_ADDR = 0x8000000
c0  1066 [ip6tables-wrapp] msm_cci_irq:1816 MASTER_0 error 0x8000000
c0  1066 [ip6tables-wrapp] msm_cci_irq CCI_I2C_M0_STATUS_ADDR = 0x2000000
c0  1066 [ip6tables-wrapp] msm_cci_irq CCI_I2C_M0_STATUS_ADDR = 0x1000000
c1  1031 [CAM_sensor] msm_cci_wait line 300 wait DONE_for_completion_timeout
c1  1031 [CAM_sensor] msm_cci_wait: 307 wait for queue: 0
c1  1031 [CAM_sensor] msm_cci_transfer_end: 559 failed rc -110
c1  1031 [CAM_sensor] msm_cci_data_queue: 817 failed rc -110
c1  1031 [CAM_sensor] msm_cci_i2c_write failed line 1110
c0  1071 [netmgrd] msm_cci_irq CCI_I2C_M0_STATUS_ADDR = 0x2000000
c1  1031 [CAM_sensor] msm_cci_config line 1708 rc -110
c1  1031 [CAM_sensor] msm_cci_subdev_ioctl line 1867 rc -110
c1  1031 [CAM_sensor] msm_camera_cci_i2c_write: line 134 rc = -110
c0  1071 [netmgrd] msm_flash_i2c_write_table:176 zcf_flash rc=-110
c0  1071 [netmgrd] msm_cci_irq CCI_I2C_M0_STATUS_ADDR = 0x1000000

可以看到msm_flash_i2c_write_table: line 134 rc=-110
-110表示的是:访问的I2C地址0x64没有应答,总之就是I2C不通。 规格书

问题解决:

因此,以后I2C不通,先和厂家确认一下给的I2C地址是7位还是8位的。
把I2C地址左移或者右移一位,再去尝试一下,问题就迎刃而解了!!!

三.I2C地址读错总结

最近遇到一个比较奇葩的问题:
我们kernel层加了后摄的otp后,会出现某些机器概率性前摄ID读错问题,otp读出来的数据也全是0。
dtsi文件关于otp的修改

eeprom0: qcom,eeprom@5a {
        cell-index = <0>;
        reg = <0x5A>;
        qcom,eeprom-name = "sunwin_s5k4h7";
        compatible = "qcom,eeprom";
        qcom,slave-addr = <0x5A>;
        qcom,cci-master = <0>;
        qcom,num-blocks = <2>;

        qcom,page0 = <1 0x0A02 2 0x15 1 1>;/*set the page21 of otp*/
        qcom,poll0 = <0 0x0 1 0x0 1 1>;
        qcom,mem0 = <0 0x0 1 0x0 1 1>;
    
        qcom,page1 = <1 0x0A00 2 0x0100 2 1>;/*OTP enable and read start*/
        qcom,poll1 = <0 0x0 1 0x0 1 1>;
        qcom,mem1 = <60 0x0A04 2 0x0000 2 1>;

        cam_vio-supply = <&pm8916_l10>;
        cam_vaf-supply = <&pm8916_l11>;
···
}

报错log如下:

//id读错
    Line 1875: <3>[   12.086195] msm_sensor_match_id: sensor_id_reg_addr=300b: 
    Line 1876: <3>[   12.086206] msm_sensor_match_id: read id: 0x274 expected id 0x5675:
    Line 1877: <3>[   12.086214] msm_sensor_match_id chip id 274 does not match 5675
//otp读错
<3>[    1.470158] memory_data[0] = 0x0
<3>[    1.470179] memory_data[1] = 0x0
<3>[    1.470188] memory_data[2] = 0x0
<3>[    1.470197] memory_data[3] = 0x0
<3>[    1.470206] memory_data[4] = 0x0
<3>[    1.470215] memory_data[5] = 0x0
<3>[    1.470223] memory_data[6] = 0x0
<3>[    1.470233] memory_data[7] = 0x0
<3>[    1.470242] memory_data[8] = 0x0
<3>[    1.470251] memory_data[9] = 0x0
<3>[    1.470260] memory_data[10] = 0x0
···
<3>[    1.470260] memory_data[256] = 0x0

分析:


otp的读取顺序
camera的加载顺序

i2c通信时ok的,但是就是读错了,肯定是读到某个地址的值了,所以id没读对,移除dtsi后摄的otp修改,
就能读对。
可以确认的是加了后摄的otp导致的。
需要注意的是,otp是烧录在sensor里面的,也同样和camera一样要上的,上电时序和camera一致,
因此在读取前摄的时候,读错成了后摄的地址,导致读成0x274.
解决:
vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/module/sensor_init.c

-  "ov5675_back",
-  "s5k4h7",\
+  "s5k4h7",\
+  "ov5675_back",

把camera加载的顺序和otp加载的顺序改成一致。

Stay hungry,Stay foolish!

上一篇下一篇

猜你喜欢

热点阅读