xref: /openbmc/linux/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
254f38fcaSMauro Carvalho Chehab
354f38fcaSMauro Carvalho Chehab.. _image-source-controls:
454f38fcaSMauro Carvalho Chehab
554f38fcaSMauro Carvalho Chehab******************************
654f38fcaSMauro Carvalho ChehabImage Source Control Reference
754f38fcaSMauro Carvalho Chehab******************************
854f38fcaSMauro Carvalho Chehab
954f38fcaSMauro Carvalho ChehabThe Image Source control class is intended for low-level control of
1054f38fcaSMauro Carvalho Chehabimage source devices such as image sensors. The devices feature an
1154f38fcaSMauro Carvalho Chehabanalogue to digital converter and a bus transmitter to transmit the
1254f38fcaSMauro Carvalho Chehabimage data out of the device.
1354f38fcaSMauro Carvalho Chehab
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho Chehab.. _image-source-control-id:
1654f38fcaSMauro Carvalho Chehab
1754f38fcaSMauro Carvalho ChehabImage Source Control IDs
1854f38fcaSMauro Carvalho Chehab========================
1954f38fcaSMauro Carvalho Chehab
2054f38fcaSMauro Carvalho Chehab``V4L2_CID_IMAGE_SOURCE_CLASS (class)``
2154f38fcaSMauro Carvalho Chehab    The IMAGE_SOURCE class descriptor.
2254f38fcaSMauro Carvalho Chehab
2354f38fcaSMauro Carvalho Chehab``V4L2_CID_VBLANK (integer)``
2454f38fcaSMauro Carvalho Chehab    Vertical blanking. The idle period after every frame during which no
2554f38fcaSMauro Carvalho Chehab    image data is produced. The unit of vertical blanking is a line.
2654f38fcaSMauro Carvalho Chehab    Every line has length of the image width plus horizontal blanking at
2754f38fcaSMauro Carvalho Chehab    the pixel rate defined by ``V4L2_CID_PIXEL_RATE`` control in the
2854f38fcaSMauro Carvalho Chehab    same sub-device.
2954f38fcaSMauro Carvalho Chehab
3054f38fcaSMauro Carvalho Chehab``V4L2_CID_HBLANK (integer)``
3154f38fcaSMauro Carvalho Chehab    Horizontal blanking. The idle period after every line of image data
3254f38fcaSMauro Carvalho Chehab    during which no image data is produced. The unit of horizontal
3354f38fcaSMauro Carvalho Chehab    blanking is pixels.
3454f38fcaSMauro Carvalho Chehab
3554f38fcaSMauro Carvalho Chehab``V4L2_CID_ANALOGUE_GAIN (integer)``
3654f38fcaSMauro Carvalho Chehab    Analogue gain is gain affecting all colour components in the pixel
3754f38fcaSMauro Carvalho Chehab    matrix. The gain operation is performed in the analogue domain
3854f38fcaSMauro Carvalho Chehab    before A/D conversion.
3954f38fcaSMauro Carvalho Chehab
4054f38fcaSMauro Carvalho Chehab``V4L2_CID_TEST_PATTERN_RED (integer)``
4154f38fcaSMauro Carvalho Chehab    Test pattern red colour component.
4254f38fcaSMauro Carvalho Chehab
4354f38fcaSMauro Carvalho Chehab``V4L2_CID_TEST_PATTERN_GREENR (integer)``
4454f38fcaSMauro Carvalho Chehab    Test pattern green (next to red) colour component.
4554f38fcaSMauro Carvalho Chehab
4654f38fcaSMauro Carvalho Chehab``V4L2_CID_TEST_PATTERN_BLUE (integer)``
4754f38fcaSMauro Carvalho Chehab    Test pattern blue colour component.
4854f38fcaSMauro Carvalho Chehab
4954f38fcaSMauro Carvalho Chehab``V4L2_CID_TEST_PATTERN_GREENB (integer)``
5054f38fcaSMauro Carvalho Chehab    Test pattern green (next to blue) colour component.
5154f38fcaSMauro Carvalho Chehab
5254f38fcaSMauro Carvalho Chehab``V4L2_CID_UNIT_CELL_SIZE (struct)``
5354f38fcaSMauro Carvalho Chehab    This control returns the unit cell size in nanometers. The struct
5454f38fcaSMauro Carvalho Chehab    :c:type:`v4l2_area` provides the width and the height in separate
5554f38fcaSMauro Carvalho Chehab    fields to take into consideration asymmetric pixels.
5654f38fcaSMauro Carvalho Chehab    This control does not take into consideration any possible hardware
5754f38fcaSMauro Carvalho Chehab    binning.
5854f38fcaSMauro Carvalho Chehab    The unit cell consists of the whole area of the pixel, sensitive and
5954f38fcaSMauro Carvalho Chehab    non-sensitive.
6054f38fcaSMauro Carvalho Chehab    This control is required for automatic calibration of sensors/cameras.
617403fa17SHans Verkuil
627403fa17SHans Verkuil.. c:type:: v4l2_area
637403fa17SHans Verkuil
647403fa17SHans Verkuil.. flat-table:: struct v4l2_area
657403fa17SHans Verkuil    :header-rows:  0
667403fa17SHans Verkuil    :stub-columns: 0
677403fa17SHans Verkuil    :widths:       1 1 2
687403fa17SHans Verkuil
697403fa17SHans Verkuil    * - __u32
707403fa17SHans Verkuil      - ``width``
717403fa17SHans Verkuil      - Width of the area.
727403fa17SHans Verkuil    * - __u32
737403fa17SHans Verkuil      - ``height``
747403fa17SHans Verkuil      - Height of the area.
75*311a839aSDavid Plowman
76*311a839aSDavid Plowman``V4L2_CID_NOTIFY_GAINS (integer array)``
77*311a839aSDavid Plowman    The sensor is notified what gains will be applied to the different
78*311a839aSDavid Plowman    colour channels by subsequent processing (such as by an ISP). The
79*311a839aSDavid Plowman    sensor is merely informed of these values in case it performs
80*311a839aSDavid Plowman    processing that requires them, but it does not apply them itself to
81*311a839aSDavid Plowman    the output pixels.
82*311a839aSDavid Plowman
83*311a839aSDavid Plowman    Currently it is defined only for Bayer sensors, and is an array
84*311a839aSDavid Plowman    control taking 4 gain values, being the gains for each of the
85*311a839aSDavid Plowman    Bayer channels. The gains are always in the order B, Gb, Gr and R,
86*311a839aSDavid Plowman    irrespective of the exact Bayer order of the sensor itself.
87*311a839aSDavid Plowman
88*311a839aSDavid Plowman    The use of an array allows this control to be extended to sensors
89*311a839aSDavid Plowman    with, for example, non-Bayer CFAs (colour filter arrays).
90*311a839aSDavid Plowman
91*311a839aSDavid Plowman    The units for the gain values are linear, with the default value
92*311a839aSDavid Plowman    representing a gain of exactly 1.0. For example, if this default value
93*311a839aSDavid Plowman    is reported as being (say) 128, then a value of 192 would represent
94*311a839aSDavid Plowman    a gain of exactly 1.5.
95