drivers/media/usb/pwc/pwc.h
Source file repositories/reference/linux-study-clean/drivers/media/usb/pwc/pwc.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/pwc/pwc.h- Extension
.h- Size
- 12852 bytes
- Lines
- 384
- 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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/usb.hlinux/spinlock.hlinux/wait.hlinux/mutex.hlinux/mm.hlinux/slab.hasm/errno.hlinux/videodev2.hmedia/v4l2-common.hmedia/v4l2-device.hmedia/v4l2-ioctl.hmedia/v4l2-ctrls.hmedia/v4l2-fh.hmedia/v4l2-event.hmedia/videobuf2-v4l2.hmedia/videobuf2-vmalloc.hlinux/input.hpwc-dec1.hpwc-dec23.h
Detected Declarations
struct pwc_raw_framestruct pwc_frame_bufstruct pwc_device
Annotated Snippet
struct pwc_raw_frame {
__le16 type; /* type of the webcam */
__le16 vbandlength; /* Size of 4 lines compressed (used by the
decompressor) */
__u8 cmd[4]; /* the four byte of the command (in case of
nala, only the first 3 bytes is filled) */
__u8 rawframe[]; /* frame_size = H / 4 * vbandlength */
} __packed;
/* intermediate buffers with raw data from the USB cam */
struct pwc_frame_buf
{
/* common v4l buffer stuff -- must be first */
struct vb2_v4l2_buffer vb;
struct list_head list;
void *data;
int filled; /* number of bytes filled */
};
struct pwc_device
{
struct video_device vdev;
struct v4l2_device v4l2_dev;
/* videobuf2 queue and queued buffers list */
struct vb2_queue vb_queue;
struct list_head queued_bufs;
spinlock_t queued_bufs_lock; /* Protects queued_bufs */
/* If taking both locks vb_queue_lock must always be locked first! */
struct mutex v4l2_lock; /* Protects everything else */
struct mutex vb_queue_lock; /* Protects vb_queue and capt_file */
/* Pointer to our usb_device, will be NULL after unplug */
struct usb_device *udev; /* Both mutexes most be hold when setting! */
/* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */
int type;
int release; /* release number */
int features; /* feature bits */
/*** Video data ***/
int vendpoint; /* video isoc endpoint */
int vcinterface; /* video control interface */
int valternate; /* alternate interface needed */
int vframes; /* frames-per-second */
int pixfmt; /* pixelformat: V4L2_PIX_FMT_YUV420 or _PWCX */
int vframe_count; /* received frames */
int vmax_packet_size; /* USB maxpacket size */
int vlast_packet_size; /* for frame synchronisation */
int visoc_errors; /* number of contiguous ISOC errors */
int vbandlength; /* compressed band length; 0 is uncompressed */
char vsync; /* used by isoc handler */
char vmirror; /* for ToUCaM series */
char power_save; /* Do powersaving for this cam */
unsigned char cmd_buf[13];
unsigned char *ctrl_buf;
struct urb *urbs[MAX_ISO_BUFS];
/*
* Frame currently being filled, this only gets touched by the
* isoc urb complete handler, and by stream start / stop since
* start / stop touch it before / after starting / killing the urbs
* no locking is needed around this
*/
struct pwc_frame_buf *fill_buf;
int frame_header_size, frame_trailer_size;
int frame_size;
int frame_total_size; /* including header & trailer */
int drop_frames;
union { /* private data for decompression engine */
struct pwc_dec1_private dec1;
struct pwc_dec23_private dec23;
};
/*
* We have an 'image' and a 'view', where 'image' is the fixed-size img
* as delivered by the camera, and 'view' is the size requested by the
* program. The camera image is centered in this viewport, laced with
* a gray or black border. view_min <= image <= view <= view_max;
*/
int image_mask; /* supported sizes */
int width, height; /* current resolution */
#ifdef CONFIG_USB_PWC_INPUT_EVDEV
struct input_dev *button_dev; /* webcam snapshot button input */
Annotation
- Immediate include surface: `linux/module.h`, `linux/usb.h`, `linux/spinlock.h`, `linux/wait.h`, `linux/mutex.h`, `linux/mm.h`, `linux/slab.h`, `asm/errno.h`.
- Detected declarations: `struct pwc_raw_frame`, `struct pwc_frame_buf`, `struct pwc_device`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
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.