drivers/media/usb/gspca/pac7311.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/gspca/pac7311.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/gspca/pac7311.c- Extension
.c- Size
- 19356 bytes
- Lines
- 688
- 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.
- 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/input.hgspca.hpac_common.h
Detected Declarations
struct sdfunction reg_w_buffunction reg_wfunction reg_w_seqfunction reg_w_pagefunction reg_w_varfunction sd_configfunction setcontrastfunction setgainfunction setexposurefunction sethvflipfunction sd_initfunction sd_s_ctrlfunction sd_init_controlsfunction sd_startfunction sd_stopNfunction do_autogainfunction pac_start_framefunction sd_probe
Annotated Snippet
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
struct v4l2_ctrl *contrast;
struct v4l2_ctrl *hflip;
u8 sof_read;
u8 autogain_ignore_frames;
atomic_t avg_lum;
};
static const struct v4l2_pix_format vga_mode[] = {
{160, 120, V4L2_PIX_FMT_PJPG, V4L2_FIELD_NONE,
.bytesperline = 160,
.sizeimage = 160 * 120 * 3 / 8 + 590,
.colorspace = V4L2_COLORSPACE_JPEG,
.priv = 2},
{320, 240, V4L2_PIX_FMT_PJPG, V4L2_FIELD_NONE,
.bytesperline = 320,
.sizeimage = 320 * 240 * 3 / 8 + 590,
.colorspace = V4L2_COLORSPACE_JPEG,
.priv = 1},
{640, 480, V4L2_PIX_FMT_PJPG, V4L2_FIELD_NONE,
.bytesperline = 640,
.sizeimage = 640 * 480 * 3 / 8 + 590,
.colorspace = V4L2_COLORSPACE_JPEG,
.priv = 0},
};
#define LOAD_PAGE4 254
#define END_OF_SEQUENCE 0
static const __u8 init_7311[] = {
0xff, 0x01,
0x78, 0x40, /* Bit_0=start stream, Bit_6=LED */
0x78, 0x40, /* Bit_0=start stream, Bit_6=LED */
0x78, 0x44, /* Bit_0=start stream, Bit_6=LED */
0xff, 0x04,
0x27, 0x80,
0x28, 0xca,
0x29, 0x53,
0x2a, 0x0e,
0xff, 0x01,
0x3e, 0x20,
};
static const __u8 start_7311[] = {
/* index, len, [value]* */
0xff, 1, 0x01, /* page 1 */
0x02, 43, 0x48, 0x0a, 0x40, 0x08, 0x00, 0x00, 0x08, 0x00,
0x06, 0xff, 0x11, 0xff, 0x5a, 0x30, 0x90, 0x4c,
0x00, 0x07, 0x00, 0x0a, 0x10, 0x00, 0xa0, 0x10,
0x02, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x3e, 42, 0x00, 0x00, 0x78, 0x52, 0x4a, 0x52, 0x78, 0x6e,
0x48, 0x46, 0x48, 0x6e, 0x5f, 0x49, 0x42, 0x49,
0x5f, 0x5f, 0x49, 0x42, 0x49, 0x5f, 0x6e, 0x48,
0x46, 0x48, 0x6e, 0x78, 0x52, 0x4a, 0x52, 0x78,
0x00, 0x00, 0x09, 0x1b, 0x34, 0x49, 0x5c, 0x9b,
0xd0, 0xff,
0x78, 6, 0x44, 0x00, 0xf2, 0x01, 0x01, 0x80,
0x7f, 18, 0x2a, 0x1c, 0x00, 0xc8, 0x02, 0x58, 0x03, 0x84,
0x12, 0x00, 0x1a, 0x04, 0x08, 0x0c, 0x10, 0x14,
0x18, 0x20,
0x96, 3, 0x01, 0x08, 0x04,
0xa0, 4, 0x44, 0x44, 0x44, 0x04,
0xf0, 13, 0x01, 0x00, 0x00, 0x00, 0x22, 0x00, 0x20, 0x00,
0x3f, 0x00, 0x0a, 0x01, 0x00,
0xff, 1, 0x04, /* page 4 */
0, LOAD_PAGE4, /* load the page 4 */
0x11, 1, 0x01,
0, END_OF_SEQUENCE /* end of sequence */
};
#define SKIP 0xaa
/* page 4 - the value SKIP says skip the index - see reg_w_page() */
static const __u8 page4_7311[] = {
SKIP, SKIP, 0x04, 0x54, 0x07, 0x2b, 0x09, 0x0f,
0x09, 0x00, SKIP, SKIP, 0x07, 0x00, 0x00, 0x62,
0x08, SKIP, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xa0, 0x01, 0xf4, SKIP,
SKIP, 0x00, 0x08, SKIP, 0x03, SKIP, 0x00, 0x68,
0xca, 0x10, 0x06, 0x78, 0x00, 0x00, 0x00, 0x00,
0x23, 0x28, 0x04, 0x11, 0x00, 0x00
};
static void reg_w_buf(struct gspca_dev *gspca_dev,
__u8 index,
Annotation
- Immediate include surface: `linux/input.h`, `gspca.h`, `pac_common.h`.
- Detected declarations: `struct sd`, `function reg_w_buf`, `function reg_w`, `function reg_w_seq`, `function reg_w_page`, `function reg_w_var`, `function sd_config`, `function setcontrast`, `function setgain`, `function setexposure`.
- Atlas domain: Driver Families / drivers/media.
- 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.