132e2eae2SMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
232e2eae2SMauro Carvalho Chehab
332e2eae2SMauro Carvalho ChehabThe cafe_ccic driver
432e2eae2SMauro Carvalho Chehab====================
532e2eae2SMauro Carvalho Chehab
632e2eae2SMauro Carvalho ChehabAuthor: Jonathan Corbet <corbet@lwn.net>
732e2eae2SMauro Carvalho Chehab
832e2eae2SMauro Carvalho ChehabIntroduction
932e2eae2SMauro Carvalho Chehab------------
1032e2eae2SMauro Carvalho Chehab
1132e2eae2SMauro Carvalho Chehab"cafe_ccic" is a driver for the Marvell 88ALP01 "cafe" CMOS camera
1232e2eae2SMauro Carvalho Chehabcontroller.  This is the controller found in first-generation OLPC systems,
1332e2eae2SMauro Carvalho Chehaband this driver was written with support from the OLPC project.
1432e2eae2SMauro Carvalho Chehab
1532e2eae2SMauro Carvalho ChehabCurrent status: the core driver works.  It can generate data in YUV422,
1632e2eae2SMauro Carvalho ChehabRGB565, and RGB444 formats.  (Anybody looking at the code will see RGB32 as
1732e2eae2SMauro Carvalho Chehabwell, but that is a debugging aid which will be removed shortly).  VGA and
1832e2eae2SMauro Carvalho ChehabQVGA modes work; CIF is there but the colors remain funky.  Only the OV7670
1932e2eae2SMauro Carvalho Chehabsensor is known to work with this controller at this time.
2032e2eae2SMauro Carvalho Chehab
2132e2eae2SMauro Carvalho ChehabTo try it out: either of these commands will work:
2232e2eae2SMauro Carvalho Chehab
2332e2eae2SMauro Carvalho Chehab.. code-block:: none
2432e2eae2SMauro Carvalho Chehab
2532e2eae2SMauro Carvalho Chehab     $ mplayer tv:// -tv driver=v4l2:width=640:height=480 -nosound
2632e2eae2SMauro Carvalho Chehab     $ mplayer tv:// -tv driver=v4l2:width=640:height=480:outfmt=bgr16 -nosound
2732e2eae2SMauro Carvalho Chehab
2832e2eae2SMauro Carvalho ChehabThe "xawtv" utility also works; gqcam does not, for unknown reasons.
2932e2eae2SMauro Carvalho Chehab
3032e2eae2SMauro Carvalho ChehabLoad time options
3132e2eae2SMauro Carvalho Chehab-----------------
3232e2eae2SMauro Carvalho Chehab
3332e2eae2SMauro Carvalho ChehabThere are a few load-time options, most of which can be changed after
3432e2eae2SMauro Carvalho Chehabloading via sysfs as well:
3532e2eae2SMauro Carvalho Chehab
3632e2eae2SMauro Carvalho Chehab - alloc_bufs_at_load:  Normally, the driver will not allocate any DMA
3732e2eae2SMauro Carvalho Chehab   buffers until the time comes to transfer data.  If this option is set,
3832e2eae2SMauro Carvalho Chehab   then worst-case-sized buffers will be allocated at module load time.
3932e2eae2SMauro Carvalho Chehab   This option nails down the memory for the life of the module, but
4032e2eae2SMauro Carvalho Chehab   perhaps decreases the chances of an allocation failure later on.
4132e2eae2SMauro Carvalho Chehab
4232e2eae2SMauro Carvalho Chehab - dma_buf_size: The size of DMA buffers to allocate.  Note that this
4332e2eae2SMauro Carvalho Chehab   option is only consulted for load-time allocation; when buffers are
4432e2eae2SMauro Carvalho Chehab   allocated at run time, they will be sized appropriately for the current
4532e2eae2SMauro Carvalho Chehab   camera settings.
4632e2eae2SMauro Carvalho Chehab
4732e2eae2SMauro Carvalho Chehab - n_dma_bufs: The controller can cycle through either two or three DMA
4832e2eae2SMauro Carvalho Chehab   buffers.  Normally, the driver tries to use three buffers; on faster
4932e2eae2SMauro Carvalho Chehab   systems, however, it will work well with only two.
5032e2eae2SMauro Carvalho Chehab
5132e2eae2SMauro Carvalho Chehab - min_buffers: The minimum number of streaming I/O buffers that the driver
5232e2eae2SMauro Carvalho Chehab   will consent to work with.  Default is one, but, on slower systems,
5332e2eae2SMauro Carvalho Chehab   better behavior with mplayer can be achieved by setting to a higher
5432e2eae2SMauro Carvalho Chehab   value (like six).
5532e2eae2SMauro Carvalho Chehab
5632e2eae2SMauro Carvalho Chehab - max_buffers: The maximum number of streaming I/O buffers; default is
5732e2eae2SMauro Carvalho Chehab   ten.  That number was carefully picked out of a hat and should not be
5832e2eae2SMauro Carvalho Chehab   assumed to actually mean much of anything.
5932e2eae2SMauro Carvalho Chehab
6032e2eae2SMauro Carvalho Chehab - flip: If this boolean parameter is set, the sensor will be instructed to
6132e2eae2SMauro Carvalho Chehab   invert the video image.  Whether it makes sense is determined by how
6232e2eae2SMauro Carvalho Chehab   your particular camera is mounted.
63