drivers/media/platform/samsung/exynos4-is/fimc-isp-video.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/samsung/exynos4-is/fimc-isp-video.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/samsung/exynos4-is/fimc-isp-video.c- Extension
.c- Size
- 17027 bytes
- Lines
- 658
- 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/bitops.hlinux/device.hlinux/delay.hlinux/errno.hlinux/kernel.hlinux/module.hlinux/types.hlinux/printk.hlinux/pm_runtime.hlinux/slab.hlinux/videodev2.hmedia/v4l2-device.hmedia/v4l2-ioctl.hmedia/videobuf2-v4l2.hmedia/videobuf2-dma-contig.hmedia/drv-intf/exynos-fimc.hcommon.hmedia-dev.hfimc-is.hfimc-isp-video.hfimc-is-param.h
Detected Declarations
function Copyrightfunction isp_video_capture_start_streamingfunction isp_video_capture_stop_streamingfunction isp_video_capture_buffer_preparefunction isp_video_capture_buffer_queuefunction fimc_isp_video_irq_handlerfunction isp_video_openfunction isp_video_releasefunction isp_video_querycapfunction isp_video_enum_fmtfunction isp_video_g_fmt_mplanefunction __isp_video_try_fmtfunction isp_video_try_fmt_mplanefunction isp_video_s_fmt_mplanefunction isp_video_pipeline_validatefunction isp_video_streamonfunction isp_video_streamofffunction isp_video_reqbufsfunction fimc_isp_video_device_registerfunction fimc_isp_video_device_unregister
Annotated Snippet
if (vb2_plane_size(vb, i) < size) {
v4l2_err(&video->ve.vdev,
"User buffer too small (%ld < %ld)\n",
vb2_plane_size(vb, i), size);
return -EINVAL;
}
vb2_set_plane_payload(vb, i, size);
}
/* Check if we get one of the already known buffers. */
if (test_bit(ST_ISP_VID_CAP_BUF_PREP, &isp->state)) {
dma_addr_t dma_addr = vb2_dma_contig_plane_dma_addr(vb, 0);
int i;
for (i = 0; i < video->buf_count; i++)
if (video->buffers[i]->dma_addr[0] == dma_addr)
return 0;
return -ENXIO;
}
return 0;
}
static void isp_video_capture_buffer_queue(struct vb2_buffer *vb)
{
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
struct fimc_isp *isp = vb2_get_drv_priv(vb->vb2_queue);
struct fimc_is_video *video = &isp->video_capture;
struct fimc_is *is = fimc_isp_to_is(isp);
struct isp_video_buf *ivb = to_isp_video_buf(vbuf);
unsigned long flags;
unsigned int i;
if (test_bit(ST_ISP_VID_CAP_BUF_PREP, &isp->state)) {
spin_lock_irqsave(&is->slock, flags);
video->buf_mask |= BIT(ivb->index);
spin_unlock_irqrestore(&is->slock, flags);
} else {
unsigned int num_planes = video->format->memplanes;
ivb->index = video->buf_count;
video->buffers[ivb->index] = ivb;
for (i = 0; i < num_planes; i++) {
int buf_index = ivb->index * num_planes + i;
ivb->dma_addr[i] = vb2_dma_contig_plane_dma_addr(vb, i);
is->is_p_region->shared[32 + buf_index] =
ivb->dma_addr[i];
isp_dbg(2, &video->ve.vdev,
"dma_buf %d (%d/%d/%d) addr: %pad\n",
buf_index, ivb->index, i, vb->index,
&ivb->dma_addr[i]);
}
if (++video->buf_count < video->reqbufs_count)
return;
video->buf_mask = (1UL << video->buf_count) - 1;
set_bit(ST_ISP_VID_CAP_BUF_PREP, &isp->state);
}
if (!test_bit(ST_ISP_VID_CAP_STREAMING, &isp->state))
isp_video_capture_start_streaming(vb->vb2_queue, 0);
}
/*
* FIMC-IS ISP input and output DMA interface interrupt handler.
* Locking: called with is->slock spinlock held.
*/
void fimc_isp_video_irq_handler(struct fimc_is *is)
{
struct fimc_is_video *video = &is->isp.video_capture;
struct vb2_v4l2_buffer *vbuf;
int buf_index;
/* TODO: Ensure the DMA is really stopped in stop_streaming callback */
if (!test_bit(ST_ISP_VID_CAP_STREAMING, &is->isp.state))
return;
buf_index = (is->i2h_cmd.args[1] - 1) % video->buf_count;
vbuf = &video->buffers[buf_index]->vb;
vbuf->vb2_buf.timestamp = ktime_get_ns();
vb2_buffer_done(&vbuf->vb2_buf, VB2_BUF_STATE_DONE);
video->buf_mask &= ~BIT(buf_index);
fimc_is_hw_set_isp_buf_mask(is, video->buf_mask);
}
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/device.h`, `linux/delay.h`, `linux/errno.h`, `linux/kernel.h`, `linux/module.h`, `linux/types.h`, `linux/printk.h`.
- Detected declarations: `function Copyright`, `function isp_video_capture_start_streaming`, `function isp_video_capture_stop_streaming`, `function isp_video_capture_buffer_prepare`, `function isp_video_capture_buffer_queue`, `function fimc_isp_video_irq_handler`, `function isp_video_open`, `function isp_video_release`, `function isp_video_querycap`, `function isp_video_enum_fmt`.
- 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.