Porting Bayer sensor to the Android

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Porting Bayer sensor to the Android

Jump to solution
3,446 Views
DraganOstojic
Contributor V

Has anybody ported bayer type grayscale sensor to the android? In my case it's Aptina mt9p031. I wvas able to get the driver build and chip initialize up to the point where it outputs clock, data and sychronization signals. I made small changes to the HAL layer so that it recognizes the chip and starts talking. I also limited resolution to 640x480 and made camera to output vertical bars test patterns. I'm getting camera preview and capture with no apparent errors reported from kernel or HAL. However, picture is green with some slowly moving blocks. My problem is that there is no clear guide on where to make changes to make new camera work and I'm hoping that through this forum and experience of others I can make progress.

Let me know if you need more information.

Labels (3)
Tags (2)
1 Solution
1,479 Views
DraganOstojic
Contributor V

See attached the final patch.

View solution in original post

0 Kudos
11 Replies
1,480 Views
DraganOstojic
Contributor V

See attached the final patch.

0 Kudos
1,479 Views
DraganOstojic
Contributor V

I fixed green/pink issue and now Aptina camera displays normal gray picture in Android. I'll post my patch when I clean up the code. If somebody needs it right away reply to this thread.

0 Kudos
1,479 Views
varsmolta
Contributor V

it turns out the mt9p031 driver that is in the tree I mentioned above is in the MAINLINE kernel and not in the freescale sources. Look at this thread:https://lists.yoctoproject.org/pipermail/meta-freescale/2013-March/001803.html.

Freescale doesn't make use of soc_camera or media controller for their capture interfaces. Instead, their drivers are in /media/video/mxc/capture. So looks like what you are doing with taking the ov5642 driver and modifying it for the aptina sensor is the way to go. I would be interested in your patch such that I could use it for doing the MT9T111/MT9T112 driver. Regards

0 Kudos
1,479 Views
DraganOstojic
Contributor V

Do you want what I have now or you will wait a few days until I clean it up?

0 Kudos
1,479 Views
varsmolta
Contributor V

If what you have is working, then I'd like it now if thats possible since it will give me a chance to start to port the driver code over. Thanks

0 Kudos
1,479 Views
DraganOstojic
Contributor V

OK, please see attached. Let me know if you have any questions.

0 Kudos
1,479 Views
varsmolta
Contributor V

what kernel sources have you been using? I am using the sabrelite board and trying to use the mt9t112.c driver for a MT9T111 sensor but I noticed that this file is not up to date in the sabrelite linux-imx kernel (https://github.com/boundarydevices/linux-imx6/tree/boundary-imx_3.0.35_1.1.1/drivers/media/video).

I also noticed that there is no driver for the mt9p031 camera that you are using. On the other hand, this driver does exist in the Freescale's linux-imx tree (linux-imx/drivers/media/video at master · Freescale/linux-imx · GitHub). I assume you are using this one?

I am trying to merge this kernel into my sabrelite kernel working directory

0 Kudos
1,479 Views
DraganOstojic
Contributor V

I use MCIMX6Q-SDP board and running 3.0.35 Linux kernel. Currently while I'm in the exploratory phase, I just modified ov5642 driver to work with Aptina camera. Thanks for the pointer to that Aptina driver, I'll take a look.

0 Kudos
1,479 Views
DraganOstojic
Contributor V

I got preview from mt9p031 working on iMX6 SDK with resolution 640x480@30fps but the picture is squished to the left. Once I iron things out, I'll post the changes I had to make. If somebody needs them right away please let me know.

0 Kudos
1,479 Views
DraganOstojic
Contributor V

I fixed the squished picture issue. I attached all changes I made to make this camera work on the original iMX6 SDK. I'll now move to bringing camera on Android.

0 Kudos
1,479 Views
DraganOstojic
Contributor V

I was able to get camera working on Android. However the picture is green in black areas and pink in white areas. Difference is:

SDK:  RGB888 (sensor) ->RGB565 (memory) ->RGB666 (display)

Android: RGB888 (sensor) ->YUV420 (planar) ->RGB666 (display)

YUV planar is default preview memory configuration on Android. When I try the same configuration in SDK as on Android I get the same pink/green outcome. I'm looking into this. If anybody has an idea what the reason is please make a suggestion.

0 Kudos