Q&A: How to setup camera under Android?

Document created by Yixing Kong Employee on Aug 22, 2013
Version 1Show Document
  • View in full screen mode

Q:

How to setup camera under Android?

 

helping a customer (RTX) debug some issues with camera. They're using i.MX 6Solo and Android 13.4-GA on custom hardware. They added a new camera driver which seems to work when using small console capture program (no gui, no preview), so the route from camera to /dev/video0 seems to work.

 

However, when they try to use camera from Android, entire system freezes. They located the crash to following line in ipu_common.c which basically enables camera CSI0:

ipu_cm_write(ipu, reg | IPU_CONF_CSI0_EN, IPU_CONF);

 

While investigating IPU setup, we noticed that CPMEM setup for IDMAC channel 0 is "off":

ch 0 word 0 - 00000000 25800000 00000000 E0000000 00077C4F
ch 0 word 1 - 01B086B0 00394EC0 0087C000 00009FC0 0000027F

 

As seen from above, EBA0 points to 0x0D843580 and EBA1 to 0x0E53B000, which is in EIM memory space, not DDR memory space, which probably causes issues.

 

We're not sure what could be causing this as camera driver doesn't provide any such address and mostly just handles communication to camera chip. But something gets off in Android framework and we could use any hints about what to look for.

 

A:

You can reference to the "i.MXAndroidR13.4GAAdvancedUserGuide.html" "3 Camera&Video Recorder customization" for how to change the camera in Android.

Another thing needs be checked is the camera sensor driver, you can reference to "kernel_imx\drivers\media\video\mxc\capture\ov5642.c", "static struct v4l2_int_ioctl_desc ov5642_ioctl_desc", did you implemented the same v4l2_int_ioctl_desc functions?

 

Customer HW is set up so that DDR memory space starts at 0x80000000. This causes problems in myandroid/hardware/imx/mx6/libcamera/CamerHAL.cpp when obtaining buffer addresses where camera should store data. GPU will only return OFFSET into 2GB memory space it can address, so it will return an address below 0x80000000. This needs to be adjusted before passing onto V4L2 when starting capturing.

Attachments

    Outcomes