[Galaxy S II General] dsixda:
Debug info

THIS IS ISSUE IS NOW FIXED - I just had to update to a newer version of the kernel source

In summary, this is the problem on my Bell Samsung Galaxy S2 HD LTE (SGH-I757M) build for CM9:

- When I copied the Skyrocket's ICS liboemcamera.so and camera.msm8660.so into my build, the rear camera worked perfectly; however the

front camera would return an error

that it couldn't open. This is because the Skyrocket, like most of the other S2 variants, has a different front camera sensor (S5K5BAFX) than that on the Galaxy S2 HD LTE (SR200PC20M).

- When I later used the liboemcamera.so and camera.msm8660.so from an actual ICS test ROM for the Galaxy S2 HD LTE,

none of the cameras

would even start, even though they're for the correct device!

The new libs are found in the previous post. The datasheet is also attached there in PDF format.

------------------------------------------------------------------

Here's a logcat with the actual Samsung ICS I757M camera libs (when I tried to launch the rear camera and it failed):

--> http://logcat.miui.us/880029

- See line 182: it says can't open a file - what file is it?? Probably not relevant?

Then there's this part:

E/mm-camera( 175): vfe_util_get_sensor_info: mode=3
E/CAM_FD ( 175): VFE_AXIOutputVideoConfig: axi_write master 0 config
E/CAM_FD ( 175): VFE_AXIOutputVideoConfig: axi_write master 4 config
E/CAM_FD ( 175): VFE_AXIOutputVideoConfig: axi_write master 1 config
E/CAM_FD ( 175): VFE_AXIOutputVideoConfig: axi_write master 5 config
E/CAM_FD ( 175): MSM_CAM_IOCTL_AXI_CONFIG failed!

It's probably related to the part at the end, where it tells you it is having issues trying to set a preview of the camera:

763:	E/AndroidRuntime( 2355): FATAL EXCEPTION: main
764:	E/AndroidRuntime( 2355): java.lang.RuntimeException: setPreviewDisplay failed
765:	E/AndroidRuntime( 2355): at com.android.camera.Camera.setPreviewDisplay(Camera.java:2040)
766:	E/AndroidRuntime( 2355): at com.android.camera.Camera.surfaceChanged(Camera.java:2000)
767:	E/AndroidRuntime( 2355): at android.view.SurfaceView.updateWindow(SurfaceView.java:544)
768:	E/AndroidRuntime( 2355): at android.view.SurfaceView.access$000(SurfaceView.java:81)
769:	E/AndroidRuntime( 2355): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:169)
770:	E/AndroidRuntime( 2355): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:590)
771:	E/AndroidRuntime( 2355): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1617)
772:	E/AndroidRuntime( 2355): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
773:	E/AndroidRuntime( 2355): at android.os.Handler.dispatchMessage(Handler.java:99)
774:	E/AndroidRuntime( 2355): at android.os.Looper.loop(Looper.java:137)
775:	E/AndroidRuntime( 2355): at android.app.ActivityThread.main(ActivityThread.java:4575)
776:	E/AndroidRuntime( 2355): at java.lang.reflect.Method.invokeNative(Native Method)
777:	E/AndroidRuntime( 2355): at java.lang.reflect.Method.invoke(Method.java:511)
778:	E/AndroidRuntime( 2355): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
779:	E/AndroidRuntime( 2355): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
780:	E/AndroidRuntime( 2355): at dalvik.system.NativeStart.main(Native Method)
781:	E/AndroidRuntime( 2355): Caused by: java.io.IOException: setPreviewDisplay failed
782:	E/AndroidRuntime( 2355): at android.hardware.Camera.setPreviewDisplay(Native Method)
783:	E/AndroidRuntime( 2355): at android.hardware.Camera.setPreviewDisplay(Camera.java:423)
784:	E/AndroidRuntime( 2355): at com.android.camera.Camera.setPreviewDisplay(Camera.java:2037)
785:	E/AndroidRuntime( 2355): ... 15 more

This is the most important info:

When running "dmesg" afterwards on the device, the info tells us there was "pmem region lookup error" (this is found in the kernel code - /drivers/media/video/msm/msm_camera.c):

<6>[ *341.209106] [M5MO]m5mo_wait_interrupt:	X: 0x1
<7>[ *341.209167] [M5MO] m5mo_set_lock : off
<6>[ *341.234100] vfe31_proc_general: cmdID = RESET
<3>[ *341.235168] msm_pmem_region_lookup: pmem_type = 15
<3>[ *341.235229] listed region->info.type = 16, active = 0
<3>[ *341.235290] listed region->info.type = 14, active = 0
<3>[ *341.235321] listed region->info.type = 14, active = 0
<3>[ *341.235382] listed region->info.type = 14, active = 0
<3>[ *341.235443] listed region->info.type = 14, active = 0
<3>[ *341.235504] listed region->info.type = 14, active = 0
<3>[ *341.235565] listed region->info.type = 14, active = 0
<3>[ *341.235595] listed region->info.type = 14, active = 0
<3>[ *341.235656] listed region->info.type = 14, active = 0
<3>[ *341.235717] listed region->info.type = 15, active = 0
<3>[ *341.235778] listed region->info.type = 15, active = 0
<3>[ *341.235839] listed region->info.type = 15, active = 0
<3>[ *341.235870] listed region->info.type = 15, active = 0
<3>[ *341.235931] listed region->info.type = 15, active = 0
<3>[ *341.235992] listed region->info.type = 15, active = 0
<3>[ *341.236053] msm_frame_axi_cfg 1853: pmem region lookup error
<6>[ *341.239654] vfe31_proc_general: cmdID = START

"pmem_type = 15" (shown above) is the location in memory to be allocated for video previews (15 = MSM_PMEM_PREVIEW). It fails looking up a free region of memory, so it shows us all the entries that it was trying to access. In this case, none were active for #15 so it couldn't use them. Note that active=0.

The "1853" at the bottom of this output refers to line 1853 in the file msm_camera.c (see attachment below), which refers to CMD_AXI_CFG_VIDEO. So while configuring the video preview it can't find a suitable region of memory. The error indicates that the shared memory is not initialized (which the camera HAL, camera.msm8660, is responsible for), and thus no preview image gets sent to the display.

This is what it's SUPPOSED TO look like (using Skyrocket files):

<3>[ 888.653289] msm_pmem_region_lookup: pmem_type = 15
<3>[ 888.653350] listed region->info.type = 16, active = 1
<3>[ 888.653411] listed region->info.type = 14, active = 0
<3>[ 888.653472] listed region->info.type = 14, active = 0
<3>[ 888.653503] listed region->info.type = 14, active = 0
<3>[ 888.653564] listed region->info.type = 14, active = 0
<3>[ 888.653625] listed region->info.type = 14, active = 0
<3>[ 888.653686] listed region->info.type = 14, active = 1
<3>[ 888.653747] listed region->info.type = 14, active = 1
<3>[ 888.653778] listed region->info.type = 14, active = 1
<3>[ 888.653839] listed region->info.type = 15, active = 0
<3>[ 888.653900] listed region->info.type = 15, active = 0
<3>[ 888.653961] listed region->info.type = 15, active = 0
<3>[ 888.654022] listed region->info.type = 15, active = 1
<3>[ 888.654052] listed region->info.type = 15, active = 1
<3>[ 888.654113] listed region->info.type = 15, active = 1

<3>[ 888.654174] msm_pmem_region_lookup: pmem_type = 14
<3>[ 888.654235] listed region->info.type = 16, active = 1
<3>[ 888.654296] listed region->info.type = 14, active = 0
<3>[ 888.654357] listed region->info.type = 14, active = 0
<3>[ 888.654388] listed region->info.type = 14, active = 0
<3>[ 888.654449] listed region->info.type = 14, active = 0
<3>[ 888.654510] listed region->info.type = 14, active = 0
<3>[ 888.654571] listed region->info.type = 14, active = 1
<3>[ 888.654602] listed region->info.type = 14, active = 1
<3>[ 888.654663] listed region->info.type = 14, active = 1
<3>[ 888.654937] listed region->info.type = 15, active = 0
<3>[ 888.654998] listed region->info.type = 15, active = 0
<3>[ 888.655059] listed region->info.type = 15, active = 0
<3>[ 888.655120] listed region->info.type = 15, active = 1
<3>[ 888.655151] listed region->info.type = 15, active = 1
<3>[ 888.655212] listed region->info.type = 15, active = 1
<6>[ 888.658935] vfe31_proc_general: cmdID = START

Here's some of the source code (msm_camera.c):

static int msm_frame_axi_cfg(struct msm_sync *sync,
struct msm_vfe_cfg_cmd *cfgcmd)
{
int rc = -EIO;
struct axidata axi_data;
void *data = &axi_data;
struct msm_pmem_region region[MAX_PMEM_CFG_BUFFERS];
int pmem_type;

memset(&axi_data, 0, sizeof(axi_data));

switch (cfgcmd->cmd_type) {

case CMD_AXI_CFG_PREVIEW:
pmem_type = MSM_PMEM_PREVIEW;
axi_data.bufnum2 =
msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
&region[0], MAX_PMEM_CFG_BUFFERS,
&sync->pmem_frame_spinlock);
if (!axi_data.bufnum2) {
pr_err("%s %d: pmem region lookup error (empty %d)\n",
__func__, __LINE__,
hlist_empty(&sync->pmem_frames));
return -EINVAL;
}
break;

case CMD_AXI_CFG_VIDEO:
pmem_type = MSM_PMEM_PREVIEW;
axi_data.bufnum1 =
msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
&region[0], MAX_PMEM_CFG_BUFFERS,
&sync->pmem_frame_spinlock);
if (!axi_data.bufnum1) {
pr_err("%s %d: pmem region lookup error\n",
__func__, __LINE__);
return -EINVAL;
}

pmem_type = MSM_PMEM_VIDEO;
axi_data.bufnum2 =
msm_pmem_region_lookup(&sync->pmem_frames, pmem_type,
&region[axi_data.bufnum1],
(MAX_PMEM_CFG_BUFFERS-(axi_data.bufnum1)),
&sync->pmem_frame_spinlock);
if (!axi_data.bufnum2) {
pr_err("%s %d: pmem region lookup error\n",
__func__, __LINE__);
return -EINVAL;
}
break;

Shouldn't it be using CMD_AXI_CFG_PREVIEW instead of CMD_AXI_CFG_VIDEO?? Maybe the new devices use the latter for previews.

Or perhaps the list above (fifteen regions) should be increased to allow more regions to access in memory, with the hope the additional ones are active.

My feeling is, because one of the cameras actually works with the Skyrocket camera files, but doesn't work with the new I757M files, that means I may need to update the kernel somehow to fix the pmem lookup issue.

Other info:

Below is some additional camera info I got with "dmesg" with the new I757 ICS libs. The second block of text was achieved with the new camera.msm8660.so (camera HAL), sow no we can actually access the rear camera. But it says that the front cam was not initialized on line 1023 in the file drivers/media/video/msm/sec_sr200pc2m.c (cmd=10 is EXT_CFG_SET_FPS and cmd=8 is EXT_CFG_SET_BRIGHTNESS, defined in /include/media/msm_camera.h).

(Note: rear cam is M5MO, front is SR200PC20M)

<4>[ 1.175811] ############# M5MO probe ##############
<7>[ 1.175903] [M5MO] m5mo_sensor_probe : E
<7>[ 1.175903] [M5MO] m5mo_i2c_init : E
<7>[ 1.175933] [M5MO] m5mo_i2c_probe : E
<7>[ 1.175933] [M5MO] m5mo_i2c_probe : m5mo_i2c_probe X
<7>[ 1.175964]
<6>[ 1.177368] is_lpcharging_state: is_lpm_boot:0
<4>[ 1.177551] ############# SR200PC20M probe ##############
<7>[ 1.177978] [SR200PC20M] sr200pc20m_sensor_probe : E
<7>[ 1.177978] [SR200PC20M] sr200pc20m_i2c_init : E
<7>[ 1.178039] [SR200PC20M] sr200pc20m_i2c_probe : E
<7>[ 1.178039] [SR200PC20M] sr200pc20m_i2c_probe : X
<3>[ 1.178161] [SR200PC20M] sr200pc20m_sensor_probe:1242:rc = 0

<7>[ 68.579437] [SR200PC20M] sr200pc20m_sensor_open_init : E
<7>[ 68.579467] [SR200PC20M] sr200pc20m_sensor_init_probe : E
<7>[ 68.579467] [SR200PC20M] sr200pc20m_sensor_open_init : X
<7>[ 68.596954] [SR200PC20M] sr200pc20m_sensor_ext_config : cmd = 10 , param1 = 15
<3>[ 68.596954] [SR200PC20M] sr200pc20m_sensor_ext_config:1023:camera isn't initialized
<7>[ 68.756134] [SR200PC20M] sr200pc20m_sensor_ext_config : cmd = 10 , param1 = 30
<3>[ 68.756164] [SR200PC20M] sr200pc20m_sensor_ext_config:1023:camera isn't initialized
<7>[ 69.000061] [SR200PC20M] sr200pc20m_sensor_config : cfgtype = 0, mode = 0
<7>[ 69.000091] [SR200PC20M] sr200pc20m_set_sensor_mode : SENSOR_PREVIEW_MODE START
<7>[ 69.000091] [SR200PC20M] sr200pc20m_start : E
<7>[ 69.000091] [SR200PC20M] sr200pc20m_mipi_mode : E
<7>[ 69.000091] [SR200PC20M] sr200pc20m_mipi_mode : X
<7>[ 69.039398] [SR200PC20M] sr200pc20m_start : mode 0, 0
<7>[ 69.039398] [SR200PC20M] sr200pc20m_start : SELF CAMERA
<7>[ 69.039398] [SR200PC20M] sr200pc20m_i2c_write_list : sr200pc20m_common, size=851
<6>[ 69.138885] [SR200PC20M] delay = 100
<7>[ 69.239349] [SR200PC20M] sr200pc20m_start : X
<7>[ 69.239349] [SR200PC20M] sr200pc20m_i2c_write_list : sr200pc20m_preview, size=92
<6>[ 69.249206] [SR200PC20M] delay = 400
<7>[ 69.654144] [SR200PC20M] sr200pc20m_sensor_ext_config : cmd = 8 , param1 = 4
<7>[ 69.654174] [SR200PC20M] sr200pc20m_set_brightness : 4

Compare to:

Logcat with old ICS camera libs (rear camera opens when we try to launch it):

http://logcat.miui.us/887019

Here's my GitHub, which has my vendor files (celoxhd):

https://www.github.com/dsixda

.