Letux Kernel

Issue 206: Add driver for Camera

Reported by Nikolaus Schaller, Jan 29, 2011

Add driver for the (optional) Camera module.

Comment 1 by Nikolaus Schaller, Jul 28, 2011

Our camera is a OV9655 module connected to I2C2.

The LInux kernel comes with a camera driver for SOC_CAMERA_OV9640
(see src/drivers/media/video). This *may* be reasonably similar to 
our camera.

There is also some OMAP3 camera driver VIDEO_OMAP3

Here is a blog about connecting camera modules to a beagleboard XM: 

Comment 2 by Nikolaus Schaller, Nov 17, 2011

We have found a OV9640 (ov96xx) driver that should fit. It has been 
added to the kernel sources and the boardfile, but not tested nor 

Comment 3 by Nikolaus Schaller, Jan 9, 2012

Driver has been added


and partially works:
* gta04_cam and omap34xxcam and ov9655.ko are loaded properly
* Power and clock is switched on/off properly
* Camera emits sync and data (verified with oscilloscope)
* mplayer reports some understandable errors (not all ioctls are 
complete) but
* v4l2: select timeout 

Test command:

    mplayer tv:// -tv 
driver=v4l2:width=1280:height=1024:device=/dev/video0:fps=12 -vo x11

Ideas what can be wrong:
* clock frequency
* prescalers in OMAP and/or camera chip
* pinmux (unlikely)
* cam_xclk routing
* sync polarity
* number of bytes sent by camera vs. what interface expects (camera 
is SXGA by default, driver is VGA by default)

Generally, the register initialization of the OV9655 driver (which 
originates in a soc_camera driver by Stefan Herbrechtsmeier 
<hbmeier@hni.uni-paderborn.de>) is suspect. It writes to 
reserved registers and changes/sets some bits denoted as being 
reserved in the (preliminary!) datasheet:

Labels: Priority:Critical Priority:Medium

Comment 4 by Nikolaus Schaller, Mar 22, 2012

idea for further analysis: switch the CAM interface lines to GPIO 
mode (and export to /sys) and try to read an image (at least some 
bit patterns) through the GPIOs. This could also allow to check 
hsync/vsync frequencies.
The problem is that the standard user space video commands try to 
setup and enable the camera (power, clock, I2C etc.) and then want 
to read an image. And shut down the camera again because this fails.
I.e. we can't get to the GPIOs...

Comment 5 by Nikolaus Schaller, Apr 22, 2012

Reading GPIO works and shows some bit patterns consistent with very 
slow sampling.

Here is a register programming data set for different image 


We must analyse what these patterns mean and which registers they 

The code to send these patterns through I2C can be found in 
(camera_setup starting at line 1002):


These reources should help to better understand how to program the 
camera chip for specific resolutions and other functions.

Comment 6 by Nikolaus Schaller, Mar 21, 2013

Driver basically works in 3.7 kernel (using subdevices and media-ctl 
tool for the ISP.

Image (camera register settings) needs a lot of improvement.

Comment 7 by Nikolaus Schaller, Apr 22, 2013

finally successful
Status: Fixed

Created: 13 years 5 months ago by Nikolaus Schaller

Updated: 11 years 2 months ago

Status: Fixed