drivers/media/platform/samsung/exynos4-is/fimc-lite.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/samsung/exynos4-is/fimc-lite.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/samsung/exynos4-is/fimc-lite.c- Extension
.c- Size
- 43872 bytes
- Lines
- 1665
- 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/bug.hlinux/clk.hlinux/device.hlinux/errno.hlinux/interrupt.hlinux/kernel.hlinux/list.hlinux/module.hlinux/of.hlinux/types.hlinux/platform_device.hlinux/pm_runtime.hlinux/slab.hlinux/videodev2.hmedia/v4l2-device.hmedia/v4l2-ioctl.hmedia/v4l2-mem2mem.hmedia/v4l2-rect.hmedia/videobuf2-v4l2.hmedia/videobuf2-dma-contig.hmedia/drv-intf/exynos-fimc.hcommon.hfimc-core.hfimc-lite.hfimc-lite-reg.h
Detected Declarations
function fimc_lite_hw_initfunction suspendingfunction fimc_lite_stop_capturefunction fimc_lite_config_updatefunction flite_irq_handlerfunction start_streamingfunction stop_streamingfunction queue_setupfunction buffer_preparefunction buffer_queuefunction fimc_lite_clear_event_countersfunction fimc_lite_openfunction fimc_lite_releasefunction fimc_lite_try_cropfunction fimc_lite_try_composefunction fimc_lite_querycapfunction fimc_lite_enum_fmtfunction fimc_lite_g_fmt_mplanefunction fimc_lite_try_fmtfunction fimc_lite_try_fmt_mplanefunction fimc_lite_s_fmt_mplanefunction fimc_pipeline_validatefunction fimc_lite_streamonfunction fimc_lite_streamofffunction fimc_lite_reqbufsfunction fimc_lite_g_selectionfunction fimc_lite_s_selectionfunction fimc_lite_link_setupfunction fimc_lite_subdev_enum_mbus_codefunction fimc_lite_subdev_get_fmtfunction fimc_lite_subdev_set_fmtfunction fimc_lite_subdev_get_selectionfunction fimc_lite_subdev_set_selectionfunction fimc_lite_subdev_s_streamfunction fimc_lite_log_statusfunction fimc_lite_subdev_registeredfunction fimc_lite_subdev_unregisteredfunction fimc_lite_s_ctrlfunction fimc_lite_set_default_configfunction fimc_lite_create_capture_subdevfunction fimc_lite_unregister_capture_subdevfunction fimc_lite_clk_putfunction fimc_lite_clk_getfunction fimc_lite_probefunction fimc_lite_runtime_resumefunction fimc_lite_runtime_suspendfunction fimc_lite_resumefunction fimc_lite_suspend
Annotated Snippet
if (vb2_plane_size(vb, i) < size) {
v4l2_err(&fimc->ve.vdev,
"User buffer too small (%ld < %ld)\n",
vb2_plane_size(vb, i), size);
return -EINVAL;
}
vb2_set_plane_payload(vb, i, size);
}
return 0;
}
static void buffer_queue(struct vb2_buffer *vb)
{
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
struct flite_buffer *buf
= container_of(vbuf, struct flite_buffer, vb);
struct fimc_lite *fimc = vb2_get_drv_priv(vb->vb2_queue);
unsigned long flags;
spin_lock_irqsave(&fimc->slock, flags);
buf->addr = vb2_dma_contig_plane_dma_addr(vb, 0);
buf->index = fimc->buf_index++;
if (fimc->buf_index >= fimc->reqbufs_count)
fimc->buf_index = 0;
if (!test_bit(ST_FLITE_SUSPENDED, &fimc->state) &&
!test_bit(ST_FLITE_STREAM, &fimc->state) &&
list_empty(&fimc->active_buf_q)) {
flite_hw_set_dma_buffer(fimc, buf);
fimc_lite_active_queue_add(fimc, buf);
} else {
fimc_lite_pending_queue_add(fimc, buf);
}
if (vb2_is_streaming(&fimc->vb_queue) &&
!list_empty(&fimc->pending_buf_q) &&
!test_and_set_bit(ST_FLITE_STREAM, &fimc->state)) {
flite_hw_capture_start(fimc);
spin_unlock_irqrestore(&fimc->slock, flags);
if (!test_and_set_bit(ST_SENSOR_STREAM, &fimc->state))
fimc_pipeline_call(&fimc->ve, set_stream, 1);
return;
}
spin_unlock_irqrestore(&fimc->slock, flags);
}
static const struct vb2_ops fimc_lite_qops = {
.queue_setup = queue_setup,
.buf_prepare = buffer_prepare,
.buf_queue = buffer_queue,
.start_streaming = start_streaming,
.stop_streaming = stop_streaming,
};
static void fimc_lite_clear_event_counters(struct fimc_lite *fimc)
{
unsigned long flags;
spin_lock_irqsave(&fimc->slock, flags);
memset(&fimc->events, 0, sizeof(fimc->events));
spin_unlock_irqrestore(&fimc->slock, flags);
}
static int fimc_lite_open(struct file *file)
{
struct fimc_lite *fimc = video_drvdata(file);
struct media_entity *me = &fimc->ve.vdev.entity;
int ret;
mutex_lock(&fimc->lock);
if (atomic_read(&fimc->out_path) != FIMC_IO_DMA) {
ret = -EBUSY;
goto unlock;
}
set_bit(ST_FLITE_IN_USE, &fimc->state);
ret = pm_runtime_resume_and_get(&fimc->pdev->dev);
if (ret < 0)
goto err_in_use;
ret = v4l2_fh_open(file);
if (ret < 0)
goto err_pm;
if (!v4l2_fh_is_singular_file(file) ||
atomic_read(&fimc->out_path) != FIMC_IO_DMA)
goto unlock;
Annotation
- Immediate include surface: `linux/bug.h`, `linux/clk.h`, `linux/device.h`, `linux/errno.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/list.h`, `linux/module.h`.
- Detected declarations: `function fimc_lite_hw_init`, `function suspending`, `function fimc_lite_stop_capture`, `function fimc_lite_config_update`, `function flite_irq_handler`, `function start_streaming`, `function stop_streaming`, `function queue_setup`, `function buffer_prepare`, `function buffer_queue`.
- 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.