drivers/media/usb/go7007/go7007-v4l2.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/go7007/go7007-v4l2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/go7007/go7007-v4l2.c- Extension
.c- Size
- 30526 bytes
- Lines
- 1148
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/delay.hlinux/sched.hlinux/spinlock.hlinux/slab.hlinux/fs.hlinux/unistd.hlinux/time.hlinux/vmalloc.hlinux/pagemap.hlinux/i2c.hlinux/mutex.hlinux/uaccess.hlinux/videodev2.hmedia/v4l2-common.hmedia/v4l2-ioctl.hmedia/v4l2-subdev.hmedia/v4l2-event.hmedia/videobuf2-vmalloc.hmedia/i2c/saa7115.hgo7007-priv.h
Detected Declarations
function Copyrightfunction get_frame_type_flagfunction get_resolutionfunction set_formattingfunction set_capture_sizefunction vidioc_querycapfunction vidioc_enum_fmt_vid_capfunction vidioc_g_fmt_vid_capfunction vidioc_try_fmt_vid_capfunction vidioc_s_fmt_vid_capfunction go7007_queue_setupfunction go7007_buf_queuefunction go7007_buf_preparefunction go7007_buf_finishfunction go7007_start_streamingfunction go7007_stop_streamingfunction vidioc_g_parmfunction vidioc_s_parmfunction vidioc_enum_framesizesfunction vidioc_enum_frameintervalsfunction vidioc_g_stdfunction go7007_s_stdfunction vidioc_s_stdfunction vidioc_querystdfunction vidioc_enum_inputfunction vidioc_g_inputfunction vidioc_enumaudiofunction vidioc_g_audiofunction vidioc_s_audiofunction go7007_s_inputfunction vidioc_s_inputfunction vidioc_g_tunerfunction vidioc_s_tunerfunction vidioc_g_frequencyfunction vidioc_s_frequencyfunction vidioc_log_statusfunction vidioc_subscribe_eventfunction go7007_s_ctrlfunction go7007_v4l2_ctrl_initfunction go7007_v4l2_initfunction go7007_v4l2_remove
Annotated Snippet
switch ((ptr[vb->frame_offset + 4] >> 6) & 0x3) {
case 0:
return V4L2_BUF_FLAG_KEYFRAME;
case 1:
return V4L2_BUF_FLAG_PFRAME;
case 2:
return V4L2_BUF_FLAG_BFRAME;
default:
return 0;
}
case V4L2_PIX_FMT_MPEG1:
case V4L2_PIX_FMT_MPEG2:
switch ((ptr[vb->frame_offset + 5] >> 3) & 0x7) {
case 1:
return V4L2_BUF_FLAG_KEYFRAME;
case 2:
return V4L2_BUF_FLAG_PFRAME;
case 3:
return V4L2_BUF_FLAG_BFRAME;
default:
return 0;
}
}
return 0;
}
static void get_resolution(struct go7007 *go, int *width, int *height)
{
switch (go->standard) {
case GO7007_STD_NTSC:
*width = 720;
*height = 480;
break;
case GO7007_STD_PAL:
*width = 720;
*height = 576;
break;
case GO7007_STD_OTHER:
default:
*width = go->board_info->sensor_width;
*height = go->board_info->sensor_height;
break;
}
}
static void set_formatting(struct go7007 *go)
{
if (go->format == V4L2_PIX_FMT_MJPEG) {
go->pali = 0;
go->aspect_ratio = GO7007_RATIO_1_1;
go->gop_size = 0;
go->ipb = 0;
go->closed_gop = 0;
go->repeat_seqhead = 0;
go->seq_header_enable = 0;
go->gop_header_enable = 0;
go->dvd_mode = 0;
return;
}
switch (go->format) {
case V4L2_PIX_FMT_MPEG1:
go->pali = 0;
break;
default:
case V4L2_PIX_FMT_MPEG2:
go->pali = 0x48;
break;
case V4L2_PIX_FMT_MPEG4:
/* For future reference: this is the list of MPEG4
* profiles that are available, although they are
* untested:
*
* Profile pali
* -------------- ----
* PROFILE_S_L0 0x08
* PROFILE_S_L1 0x01
* PROFILE_S_L2 0x02
* PROFILE_S_L3 0x03
* PROFILE_ARTS_L1 0x91
* PROFILE_ARTS_L2 0x92
* PROFILE_ARTS_L3 0x93
* PROFILE_ARTS_L4 0x94
* PROFILE_AS_L0 0xf0
* PROFILE_AS_L1 0xf1
* PROFILE_AS_L2 0xf2
* PROFILE_AS_L3 0xf3
* PROFILE_AS_L4 0xf4
* PROFILE_AS_L5 0xf5
Annotation
- Immediate include surface: `linux/module.h`, `linux/delay.h`, `linux/sched.h`, `linux/spinlock.h`, `linux/slab.h`, `linux/fs.h`, `linux/unistd.h`, `linux/time.h`.
- Detected declarations: `function Copyright`, `function get_frame_type_flag`, `function get_resolution`, `function set_formatting`, `function set_capture_size`, `function vidioc_querycap`, `function vidioc_enum_fmt_vid_cap`, `function vidioc_g_fmt_vid_cap`, `function vidioc_try_fmt_vid_cap`, `function vidioc_s_fmt_vid_cap`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.