[Letux-kernel] GTA04 camera / ov9655 working with 4.13-rc1

H. Nikolaus Schaller hns at goldelico.com
Mon Jul 24 18:36:54 CEST 2017


> Am 20.07.2017 um 10:26 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> https://twitter.com/goldelico/status/887951141216157699
> I have found the bug and fixed our ancient 3.12-driver to support DT.
> Details, patches, video etc. to come.

First of all, here is some video:


Currently only SXGA resolution at 15 fps is working.
VGA and 30fps has some config problems (either camera
registers, clock/sync frequency, media-ctl setup or mplayer setup).

And there are plans to implement more V4L2 controls, e.g.
for exposure/auto-exposure, black&white level control, gain and
auto-gain. Maybe modifying the gamma curve etc.

Ideally we could implement "crop" but I am not sure if the camera
module can do smooth or arbitrary zoom or in steps of 1/2/4/8 only.

Maybe this is better done by the OMAP3ISP resizer.

A bigger problem than adding features is to decide to add to which
driver variant. Because there are now four different drivers to
choose from:

#1 we have a non-device-tree (platform data) driver in our
letux-3.12 kernel which works (provided one uses the correct
camera-demo script which was not part of the Letux kernel tree
back then).

#2 one year ago during our Tinkerphones workshop I transplanted
some code from our old 3.12 kernel to the official ov9650 driver
to make it ov9655 compatible.

I thought this is the right way to go because ov9650 and ov9655
are quite similar, at least from what we know from the register
name constants. So it appeared better to extend an existing (and
tested) driver than writing a new one.

This never worked in despite the oscilloscope showing correct
sync and pixel clocks. I could even monitor one data line and
the bit pattern did change when placing something in front of
the camera or hiding it from light.

But mplayer always reported "select timeout" showed a green

#3 some weeks ago, someone posted a modified version of my ov9650
extension for review on LKML. He apparently has made it working
for VGA and lower resolutions (no SXGA) on some ST SoC.

We discussed a lot and LKML reviewers did have valuable feedback.
I worked on a patch to add SXGA resolution.

But again only "select timeout" and green screen. So no success
with this driver for our GTA04 camera.

Someone recommended to check the /proc/interrupts - and indeed
I could see that the omap3isp interrupt (which is triggered by
the VSYNC signal) counts upwards. So this means that VSYNC arrives
at the ISP and the ISP is running.

#4 after some discussions back and forth, the LKML maintainers
decided that they to not like the approach to extend the ov9650
driver. Mainly because they did not find hardware to test the
ov9650 code for regressions. Therefore they expect an independent
ov9655 driver.

Then I digged out our old approach #1 and added device tree support
(which I could mainly copy from the ov9650 efforts).

This still did not work despite checking the signals by oscilloscope
again did not show any deviations from the expected ones.

Then I reasoned about that there are no signals from the ISP and
checked again and again the GTA04 device tree source code.

And this time I found a bug for the PCLK. This is the pixel clock
from the camera to the OMAP3ISP. And that definition was slightly
wrong. The effect was that the ISP receives SYNC and DATA but not
the clock. Hence it can't do anything else than make the mplayer
select timeout.

After fixing this, this driver started to work in SXGA mode and
I got first video on the display :)

Since then I have revised the code heavily and turned parts upside
down to include some ideas from approach #3.

The latest version is now part of Letux-4.13-rc2 and was used to
make the video.

It is far from being perfect and less upstreamable than #3.
But #3 does not work for us for still unknown reasons.

So at the moment there are two conflicting proposals (#3 and #4).
None of them is perfect... And the question has arised which one
will become the basis and which one the stone quarry for

At the moment my strategy is to continue working on #4 because
it works on GTA04. And the priorities of Letux are clear:
1. make it working on the supported devices
2. make it upstreamable
3. upstream (which may send back to 2. or 1.)

Please test and play with the driver - and if someone wants to
make (Q)VGA working, please let us know (to avoid double work).

For tests please use the letux-4.13-rc2 kernel (seems to be stable):


And use the camera-setup / camera-demo scripts in Letux/root
as examples how to configure the OMAP3ISP through media-ctl.

It would also be nice if Camera support could be integrated into
QtMokoand Replicant. There are so many applications around
(OCR, QR-Codes, Augmented Reality, ...) to experiment with.


PS: if you want to financially support this work:


More information about the Letux-kernel mailing list