18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci.. _flash-controls:
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci***********************
68c2ecf20Sopenharmony_ciFlash Control Reference
78c2ecf20Sopenharmony_ci***********************
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciThe V4L2 flash controls are intended to provide generic access to flash
108c2ecf20Sopenharmony_cicontroller devices. Flash controller devices are typically used in
118c2ecf20Sopenharmony_cidigital cameras.
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciThe interface can support both LED and xenon flash devices. As of
148c2ecf20Sopenharmony_ciwriting this, there is no xenon flash driver using this interface.
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci.. _flash-controls-use-cases:
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciSupported use cases
208c2ecf20Sopenharmony_ci===================
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ciUnsynchronised LED flash (software strobe)
248c2ecf20Sopenharmony_ci------------------------------------------
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciUnsynchronised LED flash is controlled directly by the host as the
278c2ecf20Sopenharmony_cisensor. The flash must be enabled by the host before the exposure of the
288c2ecf20Sopenharmony_ciimage starts and disabled once it ends. The host is fully responsible
298c2ecf20Sopenharmony_cifor the timing of the flash.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciExample of such device: Nokia N900.
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciSynchronised LED flash (hardware strobe)
358c2ecf20Sopenharmony_ci----------------------------------------
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciThe synchronised LED flash is pre-programmed by the host (power and
388c2ecf20Sopenharmony_citimeout) but controlled by the sensor through a strobe signal from the
398c2ecf20Sopenharmony_cisensor to the flash.
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciThe sensor controls the flash duration and timing. This information
428c2ecf20Sopenharmony_citypically must be made available to the sensor.
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ciLED flash as torch
468c2ecf20Sopenharmony_ci------------------
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ciLED flash may be used as torch in conjunction with another use case
498c2ecf20Sopenharmony_ciinvolving camera or individually.
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci.. _flash-control-id:
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciFlash Control IDs
558c2ecf20Sopenharmony_ci-----------------
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_CLASS (class)``
588c2ecf20Sopenharmony_ci    The FLASH class descriptor.
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_LED_MODE (menu)``
618c2ecf20Sopenharmony_ci    Defines the mode of the flash LED, the high-power white LED attached
628c2ecf20Sopenharmony_ci    to the flash controller. Setting this control may not be possible in
638c2ecf20Sopenharmony_ci    presence of some faults. See V4L2_CID_FLASH_FAULT.
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci.. flat-table::
688c2ecf20Sopenharmony_ci    :header-rows:  0
698c2ecf20Sopenharmony_ci    :stub-columns: 0
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_LED_MODE_NONE``
728c2ecf20Sopenharmony_ci      - Off.
738c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_LED_MODE_FLASH``
748c2ecf20Sopenharmony_ci      - Flash mode.
758c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_LED_MODE_TORCH``
768c2ecf20Sopenharmony_ci      - Torch mode. See V4L2_CID_FLASH_TORCH_INTENSITY.
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_STROBE_SOURCE (menu)``
818c2ecf20Sopenharmony_ci    Defines the source of the flash LED strobe.
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{7.5cm}|p{10.0cm}|
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci.. flat-table::
868c2ecf20Sopenharmony_ci    :header-rows:  0
878c2ecf20Sopenharmony_ci    :stub-columns: 0
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_STROBE_SOURCE_SOFTWARE``
908c2ecf20Sopenharmony_ci      - The flash strobe is triggered by using the
918c2ecf20Sopenharmony_ci	V4L2_CID_FLASH_STROBE control.
928c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_STROBE_SOURCE_EXTERNAL``
938c2ecf20Sopenharmony_ci      - The flash strobe is triggered by an external source. Typically
948c2ecf20Sopenharmony_ci	this is a sensor, which makes it possible to synchronise the
958c2ecf20Sopenharmony_ci	flash strobe start to exposure start.
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_STROBE (button)``
1008c2ecf20Sopenharmony_ci    Strobe flash. Valid when V4L2_CID_FLASH_LED_MODE is set to
1018c2ecf20Sopenharmony_ci    V4L2_FLASH_LED_MODE_FLASH and V4L2_CID_FLASH_STROBE_SOURCE
1028c2ecf20Sopenharmony_ci    is set to V4L2_FLASH_STROBE_SOURCE_SOFTWARE. Setting this
1038c2ecf20Sopenharmony_ci    control may not be possible in presence of some faults. See
1048c2ecf20Sopenharmony_ci    V4L2_CID_FLASH_FAULT.
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_STROBE_STOP (button)``
1078c2ecf20Sopenharmony_ci    Stop flash strobe immediately.
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_STROBE_STATUS (boolean)``
1108c2ecf20Sopenharmony_ci    Strobe status: whether the flash is strobing at the moment or not.
1118c2ecf20Sopenharmony_ci    This is a read-only control.
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_TIMEOUT (integer)``
1148c2ecf20Sopenharmony_ci    Hardware timeout for flash. The flash strobe is stopped after this
1158c2ecf20Sopenharmony_ci    period of time has passed from the start of the strobe.
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_INTENSITY (integer)``
1188c2ecf20Sopenharmony_ci    Intensity of the flash strobe when the flash LED is in flash mode
1198c2ecf20Sopenharmony_ci    (V4L2_FLASH_LED_MODE_FLASH). The unit should be milliamps (mA)
1208c2ecf20Sopenharmony_ci    if possible.
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_TORCH_INTENSITY (integer)``
1238c2ecf20Sopenharmony_ci    Intensity of the flash LED in torch mode
1248c2ecf20Sopenharmony_ci    (V4L2_FLASH_LED_MODE_TORCH). The unit should be milliamps (mA)
1258c2ecf20Sopenharmony_ci    if possible. Setting this control may not be possible in presence of
1268c2ecf20Sopenharmony_ci    some faults. See V4L2_CID_FLASH_FAULT.
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_INDICATOR_INTENSITY (integer)``
1298c2ecf20Sopenharmony_ci    Intensity of the indicator LED. The indicator LED may be fully
1308c2ecf20Sopenharmony_ci    independent of the flash LED. The unit should be microamps (uA) if
1318c2ecf20Sopenharmony_ci    possible.
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_FAULT (bitmask)``
1348c2ecf20Sopenharmony_ci    Faults related to the flash. The faults tell about specific problems
1358c2ecf20Sopenharmony_ci    in the flash chip itself or the LEDs attached to it. Faults may
1368c2ecf20Sopenharmony_ci    prevent further use of some of the flash controls. In particular,
1378c2ecf20Sopenharmony_ci    V4L2_CID_FLASH_LED_MODE is set to V4L2_FLASH_LED_MODE_NONE
1388c2ecf20Sopenharmony_ci    if the fault affects the flash LED. Exactly which faults have such
1398c2ecf20Sopenharmony_ci    an effect is chip dependent. Reading the faults resets the control
1408c2ecf20Sopenharmony_ci    and returns the chip to a usable state if possible.
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{8.4cm}|p{9.1cm}|
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci.. flat-table::
1458c2ecf20Sopenharmony_ci    :header-rows:  0
1468c2ecf20Sopenharmony_ci    :stub-columns: 0
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_FAULT_OVER_VOLTAGE``
1498c2ecf20Sopenharmony_ci      - Flash controller voltage to the flash LED has exceeded the limit
1508c2ecf20Sopenharmony_ci	specific to the flash controller.
1518c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_FAULT_TIMEOUT``
1528c2ecf20Sopenharmony_ci      - The flash strobe was still on when the timeout set by the user ---
1538c2ecf20Sopenharmony_ci	V4L2_CID_FLASH_TIMEOUT control --- has expired. Not all flash
1548c2ecf20Sopenharmony_ci	controllers may set this in all such conditions.
1558c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_FAULT_OVER_TEMPERATURE``
1568c2ecf20Sopenharmony_ci      - The flash controller has overheated.
1578c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_FAULT_SHORT_CIRCUIT``
1588c2ecf20Sopenharmony_ci      - The short circuit protection of the flash controller has been
1598c2ecf20Sopenharmony_ci	triggered.
1608c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_FAULT_OVER_CURRENT``
1618c2ecf20Sopenharmony_ci      - Current in the LED power supply has exceeded the limit specific to
1628c2ecf20Sopenharmony_ci	the flash controller.
1638c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_FAULT_INDICATOR``
1648c2ecf20Sopenharmony_ci      - The flash controller has detected a short or open circuit
1658c2ecf20Sopenharmony_ci	condition on the indicator LED.
1668c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_FAULT_UNDER_VOLTAGE``
1678c2ecf20Sopenharmony_ci      - Flash controller voltage to the flash LED has been below the
1688c2ecf20Sopenharmony_ci	minimum limit specific to the flash controller.
1698c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_FAULT_INPUT_VOLTAGE``
1708c2ecf20Sopenharmony_ci      - The input voltage of the flash controller is below the limit under
1718c2ecf20Sopenharmony_ci	which strobing the flash at full current will not be possible.The
1728c2ecf20Sopenharmony_ci	condition persists until this flag is no longer set.
1738c2ecf20Sopenharmony_ci    * - ``V4L2_FLASH_FAULT_LED_OVER_TEMPERATURE``
1748c2ecf20Sopenharmony_ci      - The temperature of the LED has exceeded its allowed upper limit.
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_CHARGE (boolean)``
1798c2ecf20Sopenharmony_ci    Enable or disable charging of the xenon flash capacitor.
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci``V4L2_CID_FLASH_READY (boolean)``
1828c2ecf20Sopenharmony_ci    Is the flash ready to strobe? Xenon flashes require their capacitors
1838c2ecf20Sopenharmony_ci    charged before strobing. LED flashes often require a cooldown period
1848c2ecf20Sopenharmony_ci    after strobe during which another strobe will not be possible. This
1858c2ecf20Sopenharmony_ci    is a read-only control.
186