drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_intr.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_intr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_intr.c- Extension
.c- Size
- 1752 bytes
- Lines
- 69
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/wait.h../decoder/mtk_vcodec_dec_drv.h../encoder/mtk_vcodec_enc_drv.hmtk_vcodec_intr.h
Detected Declarations
function Copyrightexport mtk_vcodec_wait_for_done_ctx
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2016 MediaTek Inc.
* Author: Tiffany Lin <tiffany.lin@mediatek.com>
*/
#include <linux/errno.h>
#include <linux/wait.h>
#include "../decoder/mtk_vcodec_dec_drv.h"
#include "../encoder/mtk_vcodec_enc_drv.h"
#include "mtk_vcodec_intr.h"
int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsigned int timeout_ms,
unsigned int hw_id)
{
int instance_type = *((int *)priv);
long timeout_jiff, ret;
int ctx_id, ctx_type, status = 0;
int *ctx_int_cond, *ctx_int_type;
wait_queue_head_t *ctx_queue;
struct platform_device *pdev;
if (instance_type == DECODER) {
struct mtk_vcodec_dec_ctx *ctx;
ctx = priv;
ctx_id = ctx->id;
ctx_type = ctx->type;
ctx_int_cond = ctx->int_cond;
ctx_int_type = ctx->int_type;
ctx_queue = ctx->queue;
pdev = ctx->dev->plat_dev;
} else {
struct mtk_vcodec_enc_ctx *ctx;
ctx = priv;
ctx_id = ctx->id;
ctx_type = ctx->type;
ctx_int_cond = ctx->int_cond;
ctx_int_type = ctx->int_type;
ctx_queue = ctx->queue;
pdev = ctx->dev->plat_dev;
}
timeout_jiff = msecs_to_jiffies(timeout_ms);
ret = wait_event_interruptible_timeout(ctx_queue[hw_id],
ctx_int_cond[hw_id],
timeout_jiff);
if (!ret) {
status = -1; /* timeout */
dev_err(&pdev->dev, "[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)",
ctx_id, command, ctx_type, timeout_ms,
ctx_int_cond[hw_id], ctx_int_type[hw_id]);
} else if (-ERESTARTSYS == ret) {
status = -1;
dev_err(&pdev->dev, "[%d] cmd=%d, type=%d, dec inter fail (%d %d)",
ctx_id, command, ctx_type,
ctx_int_cond[hw_id], ctx_int_type[hw_id]);
}
ctx_int_cond[hw_id] = 0;
ctx_int_type[hw_id] = 0;
return status;
}
EXPORT_SYMBOL(mtk_vcodec_wait_for_done_ctx);
Annotation
- Immediate include surface: `linux/errno.h`, `linux/wait.h`, `../decoder/mtk_vcodec_dec_drv.h`, `../encoder/mtk_vcodec_enc_drv.h`, `mtk_vcodec_intr.h`.
- Detected declarations: `function Copyright`, `export mtk_vcodec_wait_for_done_ctx`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
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.