include/media/v4l2-flash-led-class.h

Source file repositories/reference/linux-study-clean/include/media/v4l2-flash-led-class.h

File Facts

System
Linux kernel
Corpus path
include/media/v4l2-flash-led-class.h
Extension
.h
Size
5888 bytes
Lines
187
Domain
Repository Root And Misc
Bucket
include
Inferred role
Repository Root And Misc: implementation source
Status
source implementation candidate

Why This File Exists

Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.

Dependency Surface

Detected Declarations

Annotated Snippet

struct v4l2_flash_ctrl_data {
	struct v4l2_ctrl_config config;
	u32 cid;
};

/**
 * struct v4l2_flash_ops - V4L2 flash operations
 *
 * @external_strobe_set: Setup strobing the flash by hardware pin state
 *	assertion.
 * @intensity_to_led_brightness: Convert intensity to brightness in a device
 *	specific manner
 * @led_brightness_to_intensity: convert brightness to intensity in a device
 *	specific manner.
 */
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);
};

/**
 * struct v4l2_flash_config - V4L2 Flash sub-device initialization data
 * @dev_name:			the name of the media entity,
 *				unique in the system
 * @intensity:			non-flash strobe constraints for the LED
 * @flash_faults:		bitmask 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_strobe:	external strobe capability
 */
struct v4l2_flash_config {
	char dev_name[32];
	struct led_flash_setting intensity;
	u32 flash_faults;
	unsigned int has_external_strobe:1;
};

/**
 * struct v4l2_flash - Flash sub-device context
 * @fled_cdev:		LED flash class device controlled by this sub-device
 * @iled_cdev:		LED class device representing indicator LED associated
 *			with the LED flash class device
 * @ops:		V4L2 specific flash ops
 * @sd:			V4L2 sub-device
 * @hdl:		flash controls handler
 * @ctrls:		array of pointers to controls, whose values define
 *			the sub-device state
 */
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;
};

/**
 * v4l2_subdev_to_v4l2_flash - Returns a &struct v4l2_flash from the
 * &struct v4l2_subdev embedded on it.
 *
 * @sd: pointer to &struct v4l2_subdev
 */
static inline struct v4l2_flash *v4l2_subdev_to_v4l2_flash(
							struct v4l2_subdev *sd)
{
	return container_of(sd, struct v4l2_flash, sd);
}

/**
 * v4l2_ctrl_to_v4l2_flash - Returns a &struct v4l2_flash from the
 * &struct v4l2_ctrl embedded on it.
 *
 * @c: pointer to &struct v4l2_ctrl
 */
static inline struct v4l2_flash *v4l2_ctrl_to_v4l2_flash(struct v4l2_ctrl *c)
{
	return container_of(c->handler, struct v4l2_flash, hdl);
}

#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
/**
 * v4l2_flash_init - initialize V4L2 flash led sub-device
 * @dev:	flash device, e.g. an I2C device

Annotation

Implementation Notes