drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c- Extension
.c- Size
- 19254 bytes
- Lines
- 787
- 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
linux/module.hlinux/kernel.hlinux/types.hlinux/errno.hlinux/bug.hlinux/interrupt.hlinux/workqueue.hlinux/device.hlinux/platform_device.hlinux/list.hlinux/io.hlinux/slab.hlinux/clk.hmedia/v4l2-ioctl.hgsc-core.h
Detected Declarations
function Copyrightfunction __gsc_m2m_job_abortfunction gsc_m2m_start_streamingfunction __gsc_m2m_cleanup_queuefunction gsc_m2m_stop_streamingfunction gsc_m2m_job_finishfunction gsc_m2m_job_abortfunction gsc_get_bufsfunction gsc_m2m_device_runfunction gsc_m2m_queue_setupfunction gsc_m2m_buf_preparefunction gsc_m2m_buf_queuefunction gsc_m2m_querycapfunction gsc_m2m_enum_fmtfunction gsc_m2m_g_fmt_mplanefunction gsc_m2m_try_fmt_mplanefunction gsc_m2m_s_fmt_mplanefunction gsc_m2m_reqbufsfunction gsc_m2m_expbuffunction gsc_m2m_querybuffunction gsc_m2m_qbuffunction gsc_m2m_dqbuffunction gsc_m2m_streamonfunction gsc_m2m_streamofffunction is_rectangle_enclosedfunction gsc_m2m_g_selectionfunction gsc_m2m_s_selectionfunction queue_initfunction gsc_m2m_openfunction gsc_m2m_releasefunction gsc_m2m_pollfunction gsc_m2m_mmapfunction gsc_register_m2m_devicefunction gsc_unregister_m2m_device
Annotated Snippet
if (gsc_set_scaler_info(ctx)) {
pr_err("Scaler setup error");
goto put_device;
}
gsc_hw_set_input_path(ctx);
gsc_hw_set_in_size(ctx);
gsc_hw_set_in_image_format(ctx);
gsc_hw_set_output_path(ctx);
gsc_hw_set_out_size(ctx);
gsc_hw_set_out_image_format(ctx);
gsc_hw_set_prescaler(ctx);
gsc_hw_set_mainscaler(ctx);
gsc_hw_set_rotation(ctx);
gsc_hw_set_global_alpha(ctx);
}
/* update shadow registers */
gsc_hw_set_sfr_update(ctx);
ctx->state &= ~GSC_PARAMS;
gsc_hw_enable_control(gsc, true);
spin_unlock_irqrestore(&gsc->slock, flags);
return;
put_device:
ctx->state &= ~GSC_PARAMS;
spin_unlock_irqrestore(&gsc->slock, flags);
}
static int gsc_m2m_queue_setup(struct vb2_queue *vq,
unsigned int *num_buffers, unsigned int *num_planes,
unsigned int sizes[], struct device *alloc_devs[])
{
struct gsc_ctx *ctx = vb2_get_drv_priv(vq);
struct gsc_frame *frame;
int i;
frame = ctx_get_frame(ctx, vq->type);
if (IS_ERR(frame))
return PTR_ERR(frame);
if (!frame->fmt)
return -EINVAL;
*num_planes = frame->fmt->num_planes;
for (i = 0; i < frame->fmt->num_planes; i++)
sizes[i] = frame->payload[i];
return 0;
}
static int gsc_m2m_buf_prepare(struct vb2_buffer *vb)
{
struct gsc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
struct gsc_frame *frame;
int i;
frame = ctx_get_frame(ctx, vb->vb2_queue->type);
if (IS_ERR(frame))
return PTR_ERR(frame);
if (V4L2_TYPE_IS_CAPTURE(vb->vb2_queue->type)) {
for (i = 0; i < frame->fmt->num_planes; i++)
vb2_set_plane_payload(vb, i, frame->payload[i]);
}
return 0;
}
static void gsc_m2m_buf_queue(struct vb2_buffer *vb)
{
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
struct gsc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
pr_debug("ctx: %p, ctx->state: 0x%x", ctx, ctx->state);
if (ctx->m2m_ctx)
v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf);
}
static const struct vb2_ops gsc_m2m_qops = {
.queue_setup = gsc_m2m_queue_setup,
.buf_prepare = gsc_m2m_buf_prepare,
.buf_queue = gsc_m2m_buf_queue,
.stop_streaming = gsc_m2m_stop_streaming,
.start_streaming = gsc_m2m_start_streaming,
};
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/types.h`, `linux/errno.h`, `linux/bug.h`, `linux/interrupt.h`, `linux/workqueue.h`, `linux/device.h`.
- Detected declarations: `function Copyright`, `function __gsc_m2m_job_abort`, `function gsc_m2m_start_streaming`, `function __gsc_m2m_cleanup_queue`, `function gsc_m2m_stop_streaming`, `function gsc_m2m_job_finish`, `function gsc_m2m_job_abort`, `function gsc_get_bufs`, `function gsc_m2m_device_run`, `function gsc_m2m_queue_setup`.
- 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.