drivers/media/platform/samsung/exynos-gsc/gsc-core.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/samsung/exynos-gsc/gsc-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/samsung/exynos-gsc/gsc-core.c- Extension
.c- Size
- 32185 bytes
- Lines
- 1325
- 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/kernel.hlinux/types.hlinux/errno.hlinux/bug.hlinux/interrupt.hlinux/workqueue.hlinux/device.hlinux/platform_device.hlinux/list.hlinux/io.hlinux/slab.hlinux/clk.hlinux/of.hmedia/v4l2-ioctl.hgsc-core.h
Detected Declarations
function gsc_set_frame_sizefunction gsc_cal_prescaler_ratiofunction gsc_get_prescaler_shfactorfunction gsc_check_src_scale_infofunction gsc_enum_fmtfunction get_plane_infofunction gsc_set_prefbuffunction gsc_try_fmt_mplanefunction gsc_g_fmt_mplanefunction gsc_check_crop_changefunction gsc_try_selectionfunction gsc_check_scaler_ratiofunction gsc_set_scaler_infofunction __gsc_s_ctrlfunction gsc_s_ctrlfunction gsc_ctrls_createfunction gsc_ctrls_deletefunction gsc_prepare_addrfunction gsc_irq_handlerfunction gsc_probefunction gsc_removefunction gsc_m2m_suspendfunction gsc_m2m_resumefunction gsc_runtime_resumefunction gsc_runtime_suspend
Annotated Snippet
else if (pix_mp->field != V4L2_FIELD_NONE) {
pr_debug("Not supported field order(%d)\n", pix_mp->field);
return -EINVAL;
}
max_w = variant->pix_max->target_rot_dis_w;
max_h = variant->pix_max->target_rot_dis_h;
mod_x = ffs(variant->pix_align->org_w) - 1;
if (is_yuv420(fmt->color))
mod_y = ffs(variant->pix_align->org_h) - 1;
else
mod_y = ffs(variant->pix_align->org_h) - 2;
if (V4L2_TYPE_IS_OUTPUT(f->type)) {
min_w = variant->pix_min->org_w;
min_h = variant->pix_min->org_h;
} else {
min_w = variant->pix_min->target_rot_dis_w;
min_h = variant->pix_min->target_rot_dis_h;
pix_mp->colorspace = ctx->out_colorspace;
}
pr_debug("mod_x: %d, mod_y: %d, max_w: %d, max_h = %d",
mod_x, mod_y, max_w, max_h);
/* To check if image size is modified to adjust parameter against
hardware abilities */
tmp_w = pix_mp->width;
tmp_h = pix_mp->height;
v4l_bound_align_image(&pix_mp->width, min_w, max_w, mod_x,
&pix_mp->height, min_h, max_h, mod_y, 0);
if (tmp_w != pix_mp->width || tmp_h != pix_mp->height)
pr_debug("Image size has been modified from %dx%d to %dx%d\n",
tmp_w, tmp_h, pix_mp->width, pix_mp->height);
pix_mp->num_planes = fmt->num_planes;
if (V4L2_TYPE_IS_OUTPUT(f->type))
ctx->out_colorspace = pix_mp->colorspace;
for (i = 0; i < pix_mp->num_planes; ++i) {
struct v4l2_plane_pix_format *plane_fmt = &pix_mp->plane_fmt[i];
u32 bpl = plane_fmt->bytesperline;
if (fmt->num_comp == 1 && /* Packed */
(bpl == 0 || (bpl * 8 / fmt->depth[i]) < pix_mp->width))
bpl = pix_mp->width * fmt->depth[i] / 8;
if (fmt->num_comp > 1 && /* Planar */
(bpl == 0 || bpl < pix_mp->width))
bpl = pix_mp->width;
if (i != 0 && fmt->num_comp == 3)
bpl /= 2;
plane_fmt->bytesperline = bpl;
plane_fmt->sizeimage = max(pix_mp->width * pix_mp->height *
fmt->depth[i] / 8,
plane_fmt->sizeimage);
pr_debug("[%d]: bpl: %d, sizeimage: %d",
i, bpl, pix_mp->plane_fmt[i].sizeimage);
}
return 0;
}
int gsc_g_fmt_mplane(struct gsc_ctx *ctx, struct v4l2_format *f)
{
struct gsc_frame *frame;
struct v4l2_pix_format_mplane *pix_mp;
int i;
frame = ctx_get_frame(ctx, f->type);
if (IS_ERR(frame))
return PTR_ERR(frame);
pix_mp = &f->fmt.pix_mp;
pix_mp->width = frame->f_width;
pix_mp->height = frame->f_height;
pix_mp->field = V4L2_FIELD_NONE;
pix_mp->pixelformat = frame->fmt->pixelformat;
pix_mp->num_planes = frame->fmt->num_planes;
pix_mp->colorspace = ctx->out_colorspace;
for (i = 0; i < pix_mp->num_planes; ++i) {
pix_mp->plane_fmt[i].bytesperline = (frame->f_width *
frame->fmt->depth[i]) / 8;
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 gsc_set_frame_size`, `function gsc_cal_prescaler_ratio`, `function gsc_get_prescaler_shfactor`, `function gsc_check_src_scale_info`, `function gsc_enum_fmt`, `function get_plane_info`, `function gsc_set_prefbuf`, `function gsc_try_fmt_mplane`, `function gsc_g_fmt_mplane`, `function gsc_check_crop_change`.
- 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.