162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ciThe cafe_ccic driver
462306a36Sopenharmony_ci====================
562306a36Sopenharmony_ci
662306a36Sopenharmony_ciAuthor: Jonathan Corbet <corbet@lwn.net>
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciIntroduction
962306a36Sopenharmony_ci------------
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci"cafe_ccic" is a driver for the Marvell 88ALP01 "cafe" CMOS camera
1262306a36Sopenharmony_cicontroller.  This is the controller found in first-generation OLPC systems,
1362306a36Sopenharmony_ciand this driver was written with support from the OLPC project.
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciCurrent status: the core driver works.  It can generate data in YUV422,
1662306a36Sopenharmony_ciRGB565, and RGB444 formats.  (Anybody looking at the code will see RGB32 as
1762306a36Sopenharmony_ciwell, but that is a debugging aid which will be removed shortly).  VGA and
1862306a36Sopenharmony_ciQVGA modes work; CIF is there but the colors remain funky.  Only the OV7670
1962306a36Sopenharmony_cisensor is known to work with this controller at this time.
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciTo try it out: either of these commands will work:
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci.. code-block:: none
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci     $ mplayer tv:// -tv driver=v4l2:width=640:height=480 -nosound
2662306a36Sopenharmony_ci     $ mplayer tv:// -tv driver=v4l2:width=640:height=480:outfmt=bgr16 -nosound
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciThe "xawtv" utility also works; gqcam does not, for unknown reasons.
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciLoad time options
3162306a36Sopenharmony_ci-----------------
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciThere are a few load-time options, most of which can be changed after
3462306a36Sopenharmony_ciloading via sysfs as well:
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci - alloc_bufs_at_load:  Normally, the driver will not allocate any DMA
3762306a36Sopenharmony_ci   buffers until the time comes to transfer data.  If this option is set,
3862306a36Sopenharmony_ci   then worst-case-sized buffers will be allocated at module load time.
3962306a36Sopenharmony_ci   This option nails down the memory for the life of the module, but
4062306a36Sopenharmony_ci   perhaps decreases the chances of an allocation failure later on.
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci - dma_buf_size: The size of DMA buffers to allocate.  Note that this
4362306a36Sopenharmony_ci   option is only consulted for load-time allocation; when buffers are
4462306a36Sopenharmony_ci   allocated at run time, they will be sized appropriately for the current
4562306a36Sopenharmony_ci   camera settings.
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci - n_dma_bufs: The controller can cycle through either two or three DMA
4862306a36Sopenharmony_ci   buffers.  Normally, the driver tries to use three buffers; on faster
4962306a36Sopenharmony_ci   systems, however, it will work well with only two.
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci - min_buffers: The minimum number of streaming I/O buffers that the driver
5262306a36Sopenharmony_ci   will consent to work with.  Default is one, but, on slower systems,
5362306a36Sopenharmony_ci   better behavior with mplayer can be achieved by setting to a higher
5462306a36Sopenharmony_ci   value (like six).
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci - max_buffers: The maximum number of streaming I/O buffers; default is
5762306a36Sopenharmony_ci   ten.  That number was carefully picked out of a hat and should not be
5862306a36Sopenharmony_ci   assumed to actually mean much of anything.
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci - flip: If this boolean parameter is set, the sensor will be instructed to
6162306a36Sopenharmony_ci   invert the video image.  Whether it makes sense is determined by how
6262306a36Sopenharmony_ci   your particular camera is mounted.
63