drivers/media/usb/uvc/uvcvideo.h

Source file repositories/reference/linux-study-clean/drivers/media/usb/uvc/uvcvideo.h

File Facts

System
Linux kernel
Corpus path
drivers/media/usb/uvc/uvcvideo.h
Extension
.h
Size
21840 bytes
Lines
816
Domain
Driver Families
Bucket
drivers/media
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct uvc_control_info {
	struct list_head mappings;

	u8 entity[16];
	u8 index;	/* Bit index in bmControls */
	u8 selector;

	u16 size;
	u32 flags;
};

struct uvc_control_mapping {
	struct list_head list;
	struct list_head ev_subs;

	u32 id;
	char *name;
	u8 entity[16];
	u8 selector;

	/*
	 * Size of the control data in the payload of the UVC control GET and
	 * SET requests, expressed in bits.
	 */
	u8 size;

	u8 offset;
	enum v4l2_ctrl_type v4l2_type;
	u32 data_type;

	const u32 *menu_mapping;
	const char (*menu_names)[UVC_MENU_NAME_LEN];
	unsigned long menu_mask;

	u32 master_id;
	s32 master_manual;
	u32 slave_ids[2];

	bool disabled;

	const struct uvc_control_mapping *(*filter_mapping)
				(struct uvc_video_chain *chain,
				struct uvc_control *ctrl);
	int (*get)(struct uvc_control_mapping *mapping, u8 query,
		   const void *uvc_in, size_t v4l2_size, void *v4l2_out);
	int (*set)(struct uvc_control_mapping *mapping, size_t v4l2_size,
		   const void *v4l2_in, void *uvc_out);
};

struct uvc_control {
	struct uvc_entity *entity;
	struct uvc_control_info info;

	u8 index;	/* Used to match the uvc_control entry with a uvc_control_info. */
	u8 dirty:1,
	   loaded:1,
	   modified:1,
	   cached:1,
	   initialized:1;

	u8 *uvc_data;

	struct uvc_fh *handle;	/* File handle that last changed the control. */
};

/*
 * The term 'entity' refers to both UVC units and UVC terminals.
 *
 * The type field is either the terminal type (wTerminalType in the terminal
 * descriptor), or the unit type (bDescriptorSubtype in the unit descriptor).
 * As the bDescriptorSubtype field is one byte long, the type value will
 * always have a null MSB for units. All terminal types defined by the UVC
 * specification have a non-null MSB, so it is safe to use the MSB to
 * differentiate between units and terminals as long as the descriptor parsing
 * code makes sure terminal types have a non-null MSB.
 *
 * For terminals, the type's most significant bit stores the terminal
 * direction (either UVC_TERM_INPUT or UVC_TERM_OUTPUT). The type field should
 * always be accessed with the UVC_ENTITY_* macros and never directly.
 */

#define UVC_ENTITY_FLAG_DEFAULT		(1 << 0)

struct uvc_entity {
	struct list_head list;		/* Entity as part of a UVC device. */
	struct list_head chain;		/* Entity as part of a video device chain. */
	unsigned int flags;

	/*
	 * Entities exposed by the UVC device use IDs 0-255, extra entities

Annotation

Implementation Notes