Skip to content

Commit aaf2cbc

Browse files
janaszewskicooloney
authored andcommitted
Documentation: leds: Add description of v4l2-flash sub-device
This patch extends LED Flash class documention by the description of interactions with v4l2-flash sub-device. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Richard Purdie <rpurdie@rpsys.net> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
1 parent 589fca1 commit aaf2cbc

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

‎Documentation/leds/leds-class-flash.txt‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,54 @@ Following sysfs attributes are exposed for controlling flash LED devices:
2020
- max_flash_timeout
2121
- flash_strobe
2222
- flash_fault
23+
24+
25+
V4L2 flash wrapper for flash LEDs
26+
=================================
27+
28+
A LED subsystem driver can be controlled also from the level of VideoForLinux2
29+
subsystem. In order to enable this CONFIG_V4L2_FLASH_LED_CLASS symbol has to
30+
be defined in the kernel config.
31+
32+
The driver must call the v4l2_flash_init function to get registered in the
33+
V4L2 subsystem. The function takes six arguments:
34+
- dev : flash device, e.g. an I2C device
35+
- of_node : of_node of the LED, may be NULL if the same as device's
36+
- fled_cdev : LED flash class device to wrap
37+
- iled_cdev : LED flash class device representing indicator LED associated with
38+
fled_cdev, may be NULL
39+
- ops : V4L2 specific ops
40+
* external_strobe_set - defines the source of the flash LED strobe -
41+
V4L2_CID_FLASH_STROBE control or external source, typically
42+
a sensor, which makes it possible to synchronise the flash
43+
strobe start with exposure start,
44+
* intensity_to_led_brightness and led_brightness_to_intensity - perform
45+
enum led_brightness <-> V4L2 intensity conversion in a device
46+
specific manner - they can be used for devices with non-linear
47+
LED current scale.
48+
- config : configuration for V4L2 Flash sub-device
49+
* dev_name - the name of the media entity, unique in the system,
50+
* flash_faults - bitmask of flash faults that the LED flash class
51+
device can report; corresponding LED_FAULT* bit definitions are
52+
available in <linux/led-class-flash.h>,
53+
* torch_intensity - constraints for the LED in TORCH mode
54+
in microamperes,
55+
* indicator_intensity - constraints for the indicator LED
56+
in microamperes,
57+
* has_external_strobe - determines whether the flash strobe source
58+
can be switched to external,
59+
60+
On remove the v4l2_flash_release function has to be called, which takes one
61+
argument - struct v4l2_flash pointer returned previously by v4l2_flash_init.
62+
This function can be safely called with NULL or error pointer argument.
63+
64+
Please refer to drivers/leds/leds-max77693.c for an exemplary usage of the
65+
v4l2 flash wrapper.
66+
67+
Once the V4L2 sub-device is registered by the driver which created the Media
68+
controller device, the sub-device node acts just as a node of a native V4L2
69+
flash API device would. The calls are simply routed to the LED flash API.
70+
71+
Opening the V4L2 flash sub-device makes the LED subsystem sysfs interface
72+
unavailable. The interface is re-enabled after the V4L2 flash sub-device
73+
is closed.

0 commit comments

Comments
 (0)