sonyxperiadev / kernel

Other
353 stars 364 forks source link

[7.1.r1] Fix seine & Ganges platform front camera #2439

Closed sjllls closed 3 years ago

sjllls commented 3 years ago
  1. For Ganges, fixed the wrong GPIO settings.

  2. Seine is the latest platform uses mm-camera, which has 3 rear cameras.

3 rear cams + 1 front cams + 2 aux cams = 6

From log:

08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2503: Found Back Main Camera: i: 0 idx: 0
08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2519: Found Front Main Camera: i: 1 idx: 1
08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2536: Found Back Aux Camera: i: 2 idx: 2
08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2536: Found Back Aux Camera: i: 3 idx: 3
08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2569: Found Back Main+AUX Camera: i: 2 idx: 4
08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2569: Found Back Main+AUX Camera: i: 3 idx: 5
08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2619: Camera id: 0 facing: 0, type: 0 is_yuv: 0
08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2619: Camera id: 1 facing: 1, type: 0 is_yuv: 0
08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2619: Camera id: 2 facing: 0, type: 2 is_yuv: 0
08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2619: Camera id: 3 facing: 0, type: 2 is_yuv: 0
08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2619: Camera id: 4 facing: 0, type: 3 is_yuv: 0
08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2619: Camera id: 5 facing: 0, type: 1701079414 is_yuv: 0
08-28 08:47:06.706  1719  1719 I QCamera : <MCI><INFO> sort_camera_info: 2625: Number of cameras 4 sorted 6

Camera hal sorted 6 cameras and camera service crashed because of out of array:

08-28 08:47:06.786  1761  1761 F DEBUG   : pid: 1719, tid: 1719, name: android.hardwar  >>> /vendor/bin/hw/android.hardware.camera.provider@2.4-service <<<
08-28 08:47:06.786  1761  1761 F DEBUG   : uid: 1047
08-28 08:47:06.786  1761  1761 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
08-28 08:47:06.786  1761  1761 F DEBUG   : Abort message: 'stack corruption detected (-fstack-protector)'
08-28 08:47:06.786  1761  1761 F DEBUG   :     r0  00000000  r1  000006b7  r2  00000006  r3  ffc1a948
08-28 08:47:06.786  1761  1761 F DEBUG   :     r4  ffc1a95c  r5  ffc1a940  r6  000006b7  r7  0000016b
08-28 08:47:06.786  1761  1761 F DEBUG   :     r8  ffc1a948  r9  ffc1a958  r10 ffc1a978  r11 ffc1a968
08-28 08:47:06.786  1761  1761 F DEBUG   :     ip  000006b7  sp  ffc1a918  lr  e9efe901  pc  e9efe914
08-28 08:47:06.807  1761  1761 F DEBUG   : backtrace:
08-28 08:47:06.807  1761  1761 F DEBUG   :       #0 pc 00038914  /apex/com.android.runtime/lib/bionic/libc.so (abort+172) (BuildId: 0df42f4bf5b7d932ce25d3ef38ff1413)
08-28 08:47:06.807  1761  1761 F DEBUG   :       #1 pc 00046593  /apex/com.android.runtime/lib/bionic/libc.so (__stack_chk_fail+10) (BuildId: 0df42f4bf5b7d932ce25d3ef38ff1413)
08-28 08:47:06.807  1761  1761 F DEBUG   :       #2 pc 0000bb37  /vendor/lib/libmmcamera_interface.so (sort_camera_info+1814) (BuildId: 9af7317b6951fa6bcd64cd8792f2c3b2)
08-28 08:47:06.807  1761  1761 F DEBUG   :       #3 pc 0000c029  /vendor/lib/libmmcamera_interface.so (get_num_of_cameras+1212) (BuildId: 9af7317b6951fa6bcd64cd8792f2c3b2)

Thanks for Pavel Dubrova's found in camera hal.

So increase MSM_MAX_CAMERA_SENSORS to 6, all cameras worked on Seine.

bartcubbins commented 3 years ago

Please note that the precompiled headers need to be updated after this PR.

MarijnS95 commented 3 years ago

The regulator GPIOs seem wrong, since they are already controlled by regulator-fixed (also defined in this file). However, @kholk did the same in 9f693d2099307e1ab1f22c5e1123d7e9f63559f5 for the secondary rear camera.

What userspace failures are you observing?

Should we remove the fixed regulators to avoid possible conflicts?

bartcubbins commented 3 years ago

Well, I do not have a full log now, but the kernel reported to us about this:

[   10.995731] msm_cci_irq:1806 MASTER_0 error 0x10000000
[   10.996159] msm_cci_i2c_read:965 read_words = 0, exp words = 1
[   10.996283] msm_cci_i2c_read_bytes:1048 failed rc -22
[   10.996344] msm_camera_cci_i2c_read: line 48 rc = -22
[   10.996452] msm_sensor_match_id: s5k4h8: read id failed
[   10.996512] msm_sensor_check_id:1429 match id failed rc -22

Should we remove the fixed regulators to avoid possible conflicts?

By the way, the stock kernel has a very similar configuration, I think it's just worth synchronize them to avoid conflicts.