Linux OV511 Driver:
Technical Notes Vol. 1
Subject:  OV6620 and Picture Settings
2000/9/7, driver version 1.25 (experimental)

As of today, OV6620 support is finally partially usable. Previously, the colors were both incorrect and over-saturated, and the exposure was too low for use in artificial light. There are two registers on the 6620, 0x4A and 0x4B, which are listed in the documentation as "reserved", even though they have a profound effect on either the color balance or color conversion (I have not determined which, yet). The Windows driver sets them both to 0x80, which results in a much more realistically colored image. 1

After adding these new register settings to the Linux driver, the resulting images were correct in terms of color, but were still very underexposed in artificial (low) light. The camera worked fine in daylight though, which indicates to me that the exposure and other picture settings are not set correctly. Under Windows, the camera worked fine. I suspect that many of the automatic brightness, exposure, gain, etc... controls are now implemented within the Windows driver and not in the 6620, most likely to save die space and processing power. This seems even more likely to be true when you consider that OmniVision has been changing the operational characteristics of some of their registers (blue level, etc...). In the older chips (OV7610), they were "direct set and get", but in the newer chips (OV7620AE and OV7620) ,they are modified by setting then to the difference between the current value and the intended new value. (Oddly, the 6620 uses the original method for many of its registers)

The old method is more useful in the case where the use might want to set the value manually, but the new method makes it easier for the driver to analyze the image and say "The image is too dark. Tell the sensor to increase exposure time by 3". It makes it more complicated to directly set an arbitrary value though, especially since the value can't be changed by more than half of its total range in one shot (because of the sign bit). This is why there is no support for setting and getting the picture settings on the 7620 and 7620AE.

To fully support the OV6620, the picture settings that are not already under hardware control will either have to be exposed through IOCTLs so that a user app can set them dynamically, or they will have to be controlled automatically in software somehow. I will probably not try to implement automatic picture control, because the algorithms are complicated, CPU intensive, and problematic (observe how OV6620 cameras "flicker" between light and dark in Windows in successive frames, due to repeated over and under-compensation).

1. In case you are wondering how I figured this out, I ran the camera at under Windows 98, and then rebooted to Linux. During thre reboot, the OV511 registers are set back to default when the USB bus is reset, but since the power to the camera remains on and since the OV511 reset does not automatically reset the 6620, the 6620 registers are preserved. They were then dumped by the Linux driver using the ov511_dump_i2c_regs() function. This is the procedure that was used to discover the correct register settings when the driver was first written.