drivers/media/platform/chips-media/coda/imx-vdoa.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/chips-media/coda/imx-vdoa.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/chips-media/coda/imx-vdoa.c- Extension
.c- Size
- 7899 bytes
- Lines
- 347
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/device.hlinux/interrupt.hlinux/module.hlinux/mod_devicetable.hlinux/dma-mapping.hlinux/platform_device.hlinux/videodev2.hlinux/slab.himx-vdoa.h
Detected Declarations
struct vdoa_datastruct vdoa_q_datastruct vdoa_ctxfunction vdoa_irq_handlerfunction vdoa_wait_for_completionfunction vdoa_device_runfunction vdoa_context_destroyfunction vdoa_context_configurefunction vdoa_probeexport vdoa_wait_for_completionexport vdoa_device_runexport vdoa_context_createexport vdoa_context_destroyexport vdoa_context_configure
Annotated Snippet
struct vdoa_data {
struct vdoa_ctx *curr_ctx;
struct device *dev;
struct clk *vdoa_clk;
void __iomem *regs;
};
struct vdoa_q_data {
unsigned int width;
unsigned int height;
unsigned int bytesperline;
unsigned int sizeimage;
u32 pixelformat;
};
struct vdoa_ctx {
struct vdoa_data *vdoa;
struct completion completion;
struct vdoa_q_data q_data[2];
unsigned int submitted_job;
unsigned int completed_job;
};
static irqreturn_t vdoa_irq_handler(int irq, void *data)
{
struct vdoa_data *vdoa = data;
struct vdoa_ctx *curr_ctx;
u32 val;
/* Disable interrupts */
writel(0, vdoa->regs + VDOAIE);
curr_ctx = vdoa->curr_ctx;
if (!curr_ctx) {
dev_warn(vdoa->dev,
"Instance released before the end of transaction\n");
return IRQ_HANDLED;
}
val = readl(vdoa->regs + VDOAIST);
writel(val, vdoa->regs + VDOAIST);
if (val & VDOAIST_TERR) {
val = readl(vdoa->regs + VDOASR) & VDOASR_ERRW;
dev_err(vdoa->dev, "AXI %s error\n", val ? "write" : "read");
} else if (!(val & VDOAIST_EOT)) {
dev_warn(vdoa->dev, "Spurious interrupt\n");
}
curr_ctx->completed_job++;
complete(&curr_ctx->completion);
return IRQ_HANDLED;
}
int vdoa_wait_for_completion(struct vdoa_ctx *ctx)
{
struct vdoa_data *vdoa = ctx->vdoa;
if (ctx->submitted_job == ctx->completed_job)
return 0;
if (!wait_for_completion_timeout(&ctx->completion,
msecs_to_jiffies(300))) {
dev_err(vdoa->dev,
"Timeout waiting for transfer result\n");
return -ETIMEDOUT;
}
return 0;
}
EXPORT_SYMBOL(vdoa_wait_for_completion);
void vdoa_device_run(struct vdoa_ctx *ctx, dma_addr_t dst, dma_addr_t src)
{
struct vdoa_q_data *src_q_data, *dst_q_data;
struct vdoa_data *vdoa = ctx->vdoa;
u32 val;
if (vdoa->curr_ctx)
vdoa_wait_for_completion(vdoa->curr_ctx);
vdoa->curr_ctx = ctx;
reinit_completion(&ctx->completion);
ctx->submitted_job++;
src_q_data = &ctx->q_data[V4L2_M2M_SRC];
dst_q_data = &ctx->q_data[V4L2_M2M_DST];
/* Progressive, no sync, 1 frame per run */
if (dst_q_data->pixelformat == V4L2_PIX_FMT_YUYV)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/device.h`, `linux/interrupt.h`, `linux/module.h`, `linux/mod_devicetable.h`, `linux/dma-mapping.h`, `linux/platform_device.h`, `linux/videodev2.h`.
- Detected declarations: `struct vdoa_data`, `struct vdoa_q_data`, `struct vdoa_ctx`, `function vdoa_irq_handler`, `function vdoa_wait_for_completion`, `function vdoa_device_run`, `function vdoa_context_destroy`, `function vdoa_context_configure`, `function vdoa_probe`, `export vdoa_wait_for_completion`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
- 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.