drivers/media/usb/cx231xx/cx231xx-video.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/cx231xx/cx231xx-video.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/cx231xx/cx231xx-video.c- Extension
.c- Size
- 51575 bytes
- Lines
- 1922
- 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.
- 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
cx231xx.hlinux/init.hlinux/list.hlinux/module.hlinux/kernel.hlinux/bitmap.hlinux/i2c.hlinux/mm.hlinux/mutex.hlinux/slab.hmedia/v4l2-common.hmedia/v4l2-ioctl.hmedia/v4l2-event.hmedia/drv-intf/msp3400.hmedia/tuner.hmedia/dvb_frontend.hcx231xx-vbi.h
Detected Declarations
function cx231xx_enable_analog_tunerfunction list_for_each_entryfunction buffer_filledfunction print_err_statusfunction get_next_buffunction cx231xx_isoc_copyfunction cx231xx_bulk_copyfunction cx231xx_find_boundary_SAV_EAVfunction cx231xx_find_next_SAV_EAVfunction cx231xx_get_video_linefunction cx231xx_copy_video_linefunction cx231xx_reset_video_bufferfunction cx231xx_do_copyfunction cx231xx_swabfunction cx231xx_is_buffer_donefunction queue_setupfunction buffer_queuefunction return_all_buffersfunction start_streamingfunction stop_streamingfunction video_muxfunction vidioc_g_fmt_vid_capfunction vidioc_try_fmt_vid_capfunction vidioc_s_fmt_vid_capfunction vidioc_g_stdfunction vidioc_s_stdfunction cx231xx_v4l2_create_entitiesfunction cx231xx_enum_inputfunction cx231xx_g_inputfunction cx231xx_s_inputfunction cx231xx_g_tunerfunction cx231xx_s_tunerfunction cx231xx_g_frequencyfunction cx231xx_s_frequencyfunction cx231xx_g_chip_infofunction cx231xx_g_registerfunction cx231xx_s_registerfunction vidioc_g_pixelaspectfunction vidioc_g_selectionfunction cx231xx_querycapfunction vidioc_enum_fmt_vid_capfunction vidioc_g_fmt_vbi_capfunction vidioc_try_fmt_vbi_capfunction vidioc_s_fmt_vbi_capfunction radio_g_tunerfunction radio_s_tunerfunction cx231xx_v4l2_openfunction cx231xx_realease_resources
Annotated Snippet
if (entity->function == MEDIA_ENT_F_ATV_DECODER) {
decoder = entity;
break;
}
}
if (!decoder)
return 0;
list_for_each_entry(link, &decoder->links, list) {
if (link->sink->entity == decoder) {
found_link = link;
if (link->flags & MEDIA_LNK_FL_ENABLED)
active_links++;
break;
}
}
if (active_links == 1 || !found_link)
return 0;
source = found_link->source->entity;
list_for_each_entry(link, &source->links, list) {
struct media_entity *sink;
int flags = 0;
sink = link->sink->entity;
if (sink == entity)
flags = MEDIA_LNK_FL_ENABLED;
ret = media_entity_setup_link(link, flags);
if (ret) {
dev_err(dev->dev,
"Couldn't change link %s->%s to %s. Error %d\n",
source->name, sink->name,
flags ? "enabled" : "disabled",
ret);
return ret;
} else
dev_dbg(dev->dev,
"link %s->%s was %s\n",
source->name, sink->name,
flags ? "ENABLED" : "disabled");
}
#endif
return 0;
}
/* ------------------------------------------------------------------
Video buffer and parser functions
------------------------------------------------------------------*/
/*
* Announces that a buffer were filled and request the next
*/
static inline void buffer_filled(struct cx231xx *dev,
struct cx231xx_dmaqueue *dma_q,
struct cx231xx_buffer *buf)
{
/* Advice that buffer was filled */
cx231xx_isocdbg("[%p/%d] wakeup\n", buf, buf->vb.vb2_buf.index);
buf->vb.sequence = dma_q->sequence++;
buf->vb.field = V4L2_FIELD_INTERLACED;
buf->vb.vb2_buf.timestamp = ktime_get_ns();
vb2_set_plane_payload(&buf->vb.vb2_buf, 0, dev->size);
if (dev->USE_ISO)
dev->video_mode.isoc_ctl.buf = NULL;
else
dev->video_mode.bulk_ctl.buf = NULL;
list_del(&buf->list);
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
}
static inline void print_err_status(struct cx231xx *dev, int packet, int status)
{
char *errmsg = "Unknown";
switch (status) {
case -ENOENT:
errmsg = "unlinked synchronously";
break;
case -ECONNRESET:
errmsg = "unlinked asynchronously";
break;
case -ENOSR:
errmsg = "Buffer error (overrun)";
break;
case -EPIPE:
Annotation
- Immediate include surface: `cx231xx.h`, `linux/init.h`, `linux/list.h`, `linux/module.h`, `linux/kernel.h`, `linux/bitmap.h`, `linux/i2c.h`, `linux/mm.h`.
- Detected declarations: `function cx231xx_enable_analog_tuner`, `function list_for_each_entry`, `function buffer_filled`, `function print_err_status`, `function get_next_buf`, `function cx231xx_isoc_copy`, `function cx231xx_bulk_copy`, `function cx231xx_find_boundary_SAV_EAV`, `function cx231xx_find_next_SAV_EAV`, `function cx231xx_get_video_line`.
- 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.