drivers/media/platform/imagination/e5010-jpeg-enc.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/imagination/e5010-jpeg-enc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/imagination/e5010-jpeg-enc.c- Extension
.c- Size
- 46191 bytes
- Lines
- 1631
- 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/clk.hlinux/dma-mapping.hlinux/err.hlinux/interrupt.hlinux/ioctl.hlinux/module.hlinux/of_device.hlinux/pm_runtime.hmedia/jpeg.hmedia/v4l2-common.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-ioctl.hmedia/v4l2-jpeg.hmedia/v4l2-rect.hmedia/v4l2-mem2mem.hmedia/videobuf2-dma-contig.hmedia/videobuf2-v4l2.he5010-jpeg-enc.he5010-jpeg-enc-hw.h
Detected Declarations
function calculate_qp_tablesfunction update_qp_tablesfunction e5010_set_input_subsamplingfunction e5010_querycapfunction e5010_enum_fmtfunction e5010_g_fmtfunction e5010_jpeg_try_fmtfunction e5010_try_fmtfunction e5010_s_fmtfunction e5010_enum_framesizesfunction e5010_g_selectionfunction e5010_s_selectionfunction e5010_subscribe_eventfunction queue_initfunction e5010_s_ctrlfunction e5010_encode_ctrlsfunction e5010_ctrls_setupfunction e5010_jpeg_set_default_paramsfunction e5010_openfunction e5010_releasefunction header_writefunction encode_marker_segmentfunction encode_frame_headerfunction jpg_encode_sos_headerfunction write_headerfunction e5010_irqfunction e5010_init_devicefunction e5010_probefunction e5010_removefunction e5010_vb2_buffers_returnfunction e5010_queue_setupfunction e5010_buf_finishfunction e5010_buf_out_validatefunction e5010_buf_preparefunction e5010_buf_queuefunction e5010_encoder_cmdfunction e5010_start_streamingfunction e5010_stop_streamingfunction e5010_device_runfunction e5010_runtime_resumefunction e5010_runtime_suspendfunction e5010_suspendfunction e5010_resume
Annotated Snippet
if (i % 4 == 3) {
ret |= e5010_hw_set_qpvalue(e5010->core_base,
JASPER_LUMA_QUANTIZATION_TABLE0_OFFSET
+ QP_TABLE_FIELD_OFFSET * ((i - 3) / 4),
lvalue);
ret |= e5010_hw_set_qpvalue(e5010->core_base,
JASPER_CHROMA_QUANTIZATION_TABLE0_OFFSET
+ QP_TABLE_FIELD_OFFSET * ((i - 3) / 4),
cvalue);
lvalue = 0;
cvalue = 0;
}
}
return ret;
}
static int e5010_set_input_subsampling(void __iomem *core_base, int subsampling)
{
switch (subsampling) {
case V4L2_JPEG_CHROMA_SUBSAMPLING_420:
return e5010_hw_set_input_subsampling(core_base, SUBSAMPLING_420);
case V4L2_JPEG_CHROMA_SUBSAMPLING_422:
return e5010_hw_set_input_subsampling(core_base, SUBSAMPLING_422);
default:
return -EINVAL;
};
}
static int e5010_querycap(struct file *file, void *priv, struct v4l2_capability *cap)
{
strscpy(cap->driver, E5010_MODULE_NAME, sizeof(cap->driver));
strscpy(cap->card, E5010_MODULE_NAME, sizeof(cap->card));
return 0;
}
static struct e5010_fmt *find_format(struct v4l2_format *f)
{
int i;
for (i = 0; i < ARRAY_SIZE(e5010_formats); ++i) {
if (e5010_formats[i].fourcc == f->fmt.pix_mp.pixelformat &&
e5010_formats[i].type == f->type)
return &e5010_formats[i];
}
return NULL;
}
static int e5010_enum_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *f)
{
int i, index = 0;
struct e5010_fmt *fmt = NULL;
struct e5010_context *ctx = to_e5010_context(file);
if (!V4L2_TYPE_IS_MULTIPLANAR(f->type)) {
v4l2_err(&ctx->e5010->v4l2_dev, "ENUMFMT with Invalid type: %d\n", f->type);
return -EINVAL;
}
for (i = 0; i < ARRAY_SIZE(e5010_formats); ++i) {
if (e5010_formats[i].type == f->type) {
if (index == f->index) {
fmt = &e5010_formats[i];
break;
}
index++;
}
}
if (!fmt)
return -EINVAL;
f->pixelformat = fmt->fourcc;
return 0;
}
static int e5010_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
{
struct e5010_context *ctx = to_e5010_context(file);
struct e5010_q_data *queue;
int i;
struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
struct v4l2_plane_pix_format *plane_fmt = pix_mp->plane_fmt;
queue = get_queue(ctx, f->type);
pix_mp->flags = 0;
pix_mp->field = V4L2_FIELD_NONE;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/dma-mapping.h`, `linux/err.h`, `linux/interrupt.h`, `linux/ioctl.h`, `linux/module.h`, `linux/of_device.h`, `linux/pm_runtime.h`.
- Detected declarations: `function calculate_qp_tables`, `function update_qp_tables`, `function e5010_set_input_subsampling`, `function e5010_querycap`, `function e5010_enum_fmt`, `function e5010_g_fmt`, `function e5010_jpeg_try_fmt`, `function e5010_try_fmt`, `function e5010_s_fmt`, `function e5010_enum_framesizes`.
- 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.