drivers/media/platform/ti/davinci/vpif_capture.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/ti/davinci/vpif_capture.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/ti/davinci/vpif_capture.c- Extension
.c- Size
- 49245 bytes
- Lines
- 1819
- 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/interrupt.hlinux/of_graph.hlinux/platform_device.hlinux/slab.hmedia/v4l2-fwnode.hmedia/v4l2-ioctl.hmedia/i2c/tvp514x.hmedia/v4l2-mediabus.hlinux/videodev2.hvpif.hvpif_capture.h
Detected Declarations
function vb2_qbuffunction reqbuffunction vpif_buffer_queuefunction vpif_start_streamingfunction vpif_stop_streamingfunction vpif_process_buffer_completefunction vpif_schedule_next_bufferfunction vpif_channel_isrfunction vpif_update_std_infofunction vpif_calculate_offsetsfunction vpif_config_addrfunction vpif_input_to_subdevfunction vpif_set_inputfunction vpif_querystdfunction vpif_g_stdfunction vpif_s_stdfunction vpif_enum_inputfunction vpif_g_inputfunction vpif_s_inputfunction vpif_enum_fmt_vid_capfunction vpif_try_fmt_vid_capfunction vpif_g_fmt_vid_capfunction vpif_s_fmt_vid_capfunction vpif_querycapfunction vpif_enum_dv_timingsfunction vpif_query_dv_timingsfunction vpif_s_dv_timingsfunction vpif_g_dv_timingsfunction vpif_log_statusfunction initialize_vpiffunction free_vpif_objsfunction vpif_async_boundfunction vpif_probe_completefunction vpif_async_completefunction vpif_capture_get_pdatafunction vpif_probefunction vpif_removefunction vpif_suspendfunction vpif_resume
Annotated Snippet
if (ret < 0) {
vpif_dbg(1, debug, "can't set vpif channel mode\n");
goto err;
}
}
ret = v4l2_subdev_call(ch->sd, video, s_stream, 1);
if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) {
vpif_dbg(1, debug, "stream on failed in subdev\n");
goto err;
}
/* Call vpif_set_params function to set the parameters and addresses */
ret = vpif_set_video_params(vpif, ch->channel_id);
if (ret < 0) {
vpif_dbg(1, debug, "can't set video params\n");
goto err;
}
ycmux_mode = ret;
vpif_config_addr(ch, ret);
/* Get the next frame from the buffer queue */
spin_lock_irqsave(&common->irqlock, flags);
common->cur_frm = common->next_frm = list_entry(common->dma_queue.next,
struct vpif_cap_buffer, list);
/* Remove buffer from the buffer queue */
list_del(&common->cur_frm->list);
spin_unlock_irqrestore(&common->irqlock, flags);
addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb.vb2_buf, 0);
common->set_addr(addr + common->ytop_off,
addr + common->ybtm_off,
addr + common->ctop_off,
addr + common->cbtm_off);
/**
* Set interrupt for both the fields in VPIF Register enable channel in
* VPIF register
*/
channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1;
if (VPIF_CHANNEL0_VIDEO == ch->channel_id) {
channel0_intr_assert();
channel0_intr_enable(1);
enable_channel0(1);
}
if (VPIF_CHANNEL1_VIDEO == ch->channel_id ||
ycmux_mode == 2) {
channel1_intr_assert();
channel1_intr_enable(1);
enable_channel1(1);
}
return 0;
err:
spin_lock_irqsave(&common->irqlock, flags);
list_for_each_entry_safe(buf, tmp, &common->dma_queue, list) {
list_del(&buf->list);
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
}
spin_unlock_irqrestore(&common->irqlock, flags);
return ret;
}
/**
* vpif_stop_streaming : Stop the DMA engine
* @vq: ptr to vb2_queue
*
* This callback stops the DMA engine and any remaining buffers
* in the DMA queue are released.
*/
static void vpif_stop_streaming(struct vb2_queue *vq)
{
struct channel_obj *ch = vb2_get_drv_priv(vq);
struct common_obj *common;
unsigned long flags;
int ret;
common = &ch->common[VPIF_VIDEO_INDEX];
/* Disable channel as per its device type and channel id */
if (VPIF_CHANNEL0_VIDEO == ch->channel_id) {
enable_channel0(0);
channel0_intr_enable(0);
}
if (VPIF_CHANNEL1_VIDEO == ch->channel_id ||
ycmux_mode == 2) {
Annotation
- Immediate include surface: `linux/module.h`, `linux/interrupt.h`, `linux/of_graph.h`, `linux/platform_device.h`, `linux/slab.h`, `media/v4l2-fwnode.h`, `media/v4l2-ioctl.h`, `media/i2c/tvp514x.h`.
- Detected declarations: `function vb2_qbuf`, `function reqbuf`, `function vpif_buffer_queue`, `function vpif_start_streaming`, `function vpif_stop_streaming`, `function vpif_process_buffer_complete`, `function vpif_schedule_next_buffer`, `function vpif_channel_isr`, `function vpif_update_std_info`, `function vpif_calculate_offsets`.
- 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.