2.19. V4L2 flash functions and data structures¶
-
struct v4l2_flash_ctrl_data¶
flash control initialization data, filled basing on the features declared by the LED flash class driver in the v4l2_flash_config
Definition:
struct v4l2_flash_ctrl_data {
struct v4l2_ctrl_config config;
u32 cid;
};
Members
configinitialization data for a control
cidcontains v4l2 flash control id if the config field was initialized, 0 otherwise
-
struct v4l2_flash_ops¶
V4L2 flash operations
Definition:
struct v4l2_flash_ops {
int (*external_strobe_set)(struct v4l2_flash *v4l2_flash, bool enable);
enum led_brightness (*intensity_to_led_brightness) (struct v4l2_flash *v4l2_flash, s32 intensity);
s32 (*led_brightness_to_intensity) (struct v4l2_flash *v4l2_flash, enum led_brightness);
};
Members
external_strobe_setSetup strobing the flash by hardware pin state assertion.
intensity_to_led_brightnessConvert intensity to brightness in a device specific manner
led_brightness_to_intensityconvert brightness to intensity in a device specific manner.
-
struct v4l2_flash_config¶
V4L2 Flash sub-device initialization data
Definition:
struct v4l2_flash_config {
char dev_name[32];
struct led_flash_setting intensity;
u32 flash_faults;
unsigned int has_external_strobe:1;
};
Members
dev_namethe name of the media entity, unique in the system
intensitynon-flash strobe constraints for the LED
flash_faultsbitmask of flash faults that the LED flash class device can report; corresponding LED_FAULT* bit definitions are available in the header file <linux/led-class-flash.h>
has_external_strobeexternal strobe capability
-
struct v4l2_flash¶
Flash sub-device context
Definition:
struct v4l2_flash {
struct led_classdev_flash *fled_cdev;
struct led_classdev *iled_cdev;
const struct v4l2_flash_ops *ops;
struct v4l2_subdev sd;
struct v4l2_ctrl_handler hdl;
struct v4l2_ctrl **ctrls;
};
Members
fled_cdevLED flash class device controlled by this sub-device
iled_cdevLED class device representing indicator LED associated with the LED flash class device
opsV4L2 specific flash ops
sdV4L2 sub-device
hdlflash controls handler
ctrlsarray of pointers to controls, whose values define the sub-device state
-
struct v4l2_flash *v4l2_subdev_to_v4l2_flash(struct v4l2_subdev *sd)¶
Returns a
struct v4l2_flashfrom thestruct v4l2_subdevembedded on it.
Parameters
struct v4l2_subdev *sdpointer to
struct v4l2_subdev
-
struct v4l2_flash *v4l2_ctrl_to_v4l2_flash(struct v4l2_ctrl *c)¶
Returns a
struct v4l2_flashfrom thestruct v4l2_ctrlembedded on it.
Parameters
struct v4l2_ctrl *cpointer to
struct v4l2_ctrl
-
struct v4l2_flash *v4l2_flash_init(struct device *dev, struct fwnode_handle *fwn, struct led_classdev_flash *fled_cdev, const struct v4l2_flash_ops *ops, struct v4l2_flash_config *config)¶
initialize V4L2 flash led sub-device
Parameters
struct device *devflash device, e.g. an I2C device
struct fwnode_handle *fwnfwnode_handle of the LED, may be NULL if the same as device’s
struct led_classdev_flash *fled_cdevLED flash class device to wrap
const struct v4l2_flash_ops *opsV4L2 Flash device ops
struct v4l2_flash_config *configinitialization data for V4L2 Flash sub-device
Description
Create V4L2 Flash sub-device wrapping given LED subsystem device. The ops pointer is stored by the V4L2 flash framework. No references are held to config nor its contents once this function has returned.
Return
A valid pointer, or, when an error occurs, the return
value is encoded using ERR_PTR(). Use IS_ERR() to check and
PTR_ERR() to obtain the numeric return value.
-
struct v4l2_flash *v4l2_flash_indicator_init(struct device *dev, struct fwnode_handle *fwn, struct led_classdev *iled_cdev, struct v4l2_flash_config *config)¶
initialize V4L2 indicator sub-device
Parameters
struct device *devflash device, e.g. an I2C device
struct fwnode_handle *fwnfwnode_handle of the LED, may be NULL if the same as device’s
struct led_classdev *iled_cdevLED flash class device representing the indicator LED
struct v4l2_flash_config *configinitialization data for V4L2 Flash sub-device
Description
Create V4L2 Flash sub-device wrapping given LED subsystem device. The ops pointer is stored by the V4L2 flash framework. No references are held to config nor its contents once this function has returned.
Return
A valid pointer, or, when an error occurs, the return
value is encoded using ERR_PTR(). Use IS_ERR() to check and
PTR_ERR() to obtain the numeric return value.
-
void v4l2_flash_release(struct v4l2_flash *v4l2_flash)¶
release V4L2 Flash sub-device
Parameters
struct v4l2_flash *v4l2_flashthe V4L2 Flash sub-device to release
Description
Release V4L2 Flash sub-device.