drivers/usb/gadget/function/uvc.h
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/function/uvc.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/function/uvc.h- Extension
.h- Size
- 5538 bytes
- Lines
- 217
- Domain
- Driver Families
- Bucket
- drivers/usb
- 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.
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/list.hlinux/mutex.hlinux/spinlock.hlinux/usb/composite.hlinux/videodev2.hlinux/wait.hmedia/v4l2-device.hmedia/v4l2-dev.hmedia/v4l2-fh.huvc_queue.h
Detected Declarations
struct usb_epstruct usb_requeststruct uvc_descriptor_headerstruct uvc_devicestruct uvc_requeststruct uvc_videostruct uvc_devicestruct uvc_file_handleenum uvc_state
Annotated Snippet
struct uvc_request {
struct usb_request *req;
u8 *req_buffer;
struct uvc_video *video;
struct sg_table sgt;
u8 header[UVCG_REQUEST_HEADER_LEN];
struct uvc_buffer *last_buf;
struct list_head list;
};
struct uvc_video {
struct uvc_device *uvc;
struct usb_ep *ep;
struct work_struct pump;
struct workqueue_struct *async_wq;
struct kthread_worker *kworker;
struct kthread_work hw_submit;
atomic_t queued;
/* Frame parameters */
u8 bpp;
u32 fcc;
unsigned int width;
unsigned int height;
unsigned int imagesize;
unsigned int interval; /* in 100ns units */
struct mutex mutex; /* protects frame parameters */
unsigned int uvc_num_requests;
unsigned int reqs_per_frame;
/* Requests */
bool is_enabled; /* tracks whether video stream is enabled */
unsigned int req_size;
unsigned int max_req_size;
struct list_head ureqs; /* all uvc_requests allocated by uvc_video */
/* USB requests that the video pump thread can encode into */
struct list_head req_free;
/*
* USB requests video pump thread has already encoded into. These are
* ready to be queued to the endpoint.
*/
struct list_head req_ready;
spinlock_t req_lock;
unsigned int req_int_count;
void (*encode) (struct usb_request *req, struct uvc_video *video,
struct uvc_buffer *buf);
/* Context data used by the completion handler */
__u32 payload_size;
__u32 max_payload_size;
struct uvc_video_queue queue;
unsigned int fid;
};
enum uvc_state {
UVC_STATE_DISCONNECTED,
UVC_STATE_CONNECTED,
UVC_STATE_STREAMING,
};
struct uvc_device {
struct video_device vdev;
struct v4l2_device v4l2_dev;
enum uvc_state state;
struct usb_function func;
struct uvc_video video;
struct completion *vdev_release_done;
struct mutex lock; /* protects func_unbound and func_connected */
bool func_unbound;
bool func_connected;
wait_queue_head_t func_connected_queue;
struct uvcg_streaming_header *header;
/* Descriptors */
struct {
const struct uvc_descriptor_header * const *fs_control;
const struct uvc_descriptor_header * const *ss_control;
const struct uvc_descriptor_header * const *fs_streaming;
const struct uvc_descriptor_header * const *hs_streaming;
Annotation
- Immediate include surface: `linux/list.h`, `linux/mutex.h`, `linux/spinlock.h`, `linux/usb/composite.h`, `linux/videodev2.h`, `linux/wait.h`, `media/v4l2-device.h`, `media/v4l2-dev.h`.
- Detected declarations: `struct usb_ep`, `struct usb_request`, `struct uvc_descriptor_header`, `struct uvc_device`, `struct uvc_request`, `struct uvc_video`, `struct uvc_device`, `struct uvc_file_handle`, `enum uvc_state`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.