drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/mediatek/mdp/mtk_mdp_vpu.c- Extension
.c- Size
- 3264 bytes
- Lines
- 139
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
mtk_mdp_core.hmtk_mdp_vpu.hmtk_vpu.h
Detected Declarations
function Copyrightfunction mtk_mdp_vpu_handle_init_ackfunction mtk_mdp_vpu_ipi_handlerfunction mtk_mdp_vpu_registerfunction mtk_mdp_vpu_send_msgfunction mtk_mdp_vpu_send_ap_ipifunction mtk_mdp_vpu_initfunction mtk_mdp_vpu_deinitfunction mtk_mdp_vpu_process
Annotated Snippet
switch (msg_id) {
case VPU_MDP_INIT_ACK:
mtk_mdp_vpu_handle_init_ack(data);
break;
case VPU_MDP_DEINIT_ACK:
case VPU_MDP_PROCESS_ACK:
break;
default:
ctx = vpu_to_ctx(vpu);
dev_err(&ctx->mdp_dev->pdev->dev,
"handle unknown ipi msg:0x%x\n",
msg_id);
break;
}
} else {
ctx = vpu_to_ctx(vpu);
mtk_mdp_dbg(0, "[%d]:msg 0x%x, failure:%d", ctx->id,
msg_id, vpu->failure);
}
}
int mtk_mdp_vpu_register(struct platform_device *pdev)
{
struct mtk_mdp_dev *mdp = platform_get_drvdata(pdev);
int err;
err = vpu_ipi_register(mdp->vpu_dev, IPI_MDP,
mtk_mdp_vpu_ipi_handler, "mdp_vpu", NULL);
if (err)
dev_err(&mdp->pdev->dev,
"vpu_ipi_registration fail status=%d\n", err);
return err;
}
static int mtk_mdp_vpu_send_msg(void *msg, int len, struct mtk_mdp_vpu *vpu,
int id)
{
struct mtk_mdp_ctx *ctx = vpu_to_ctx(vpu);
int err;
if (!vpu->pdev) {
mtk_mdp_dbg(1, "[%d]:vpu pdev is NULL", ctx->id);
return -EINVAL;
}
mutex_lock(&ctx->mdp_dev->vpulock);
err = vpu_ipi_send(vpu->pdev, (enum ipi_id)id, msg, len);
if (err)
dev_err(&ctx->mdp_dev->pdev->dev,
"vpu_ipi_send fail status %d\n", err);
mutex_unlock(&ctx->mdp_dev->vpulock);
return err;
}
static int mtk_mdp_vpu_send_ap_ipi(struct mtk_mdp_vpu *vpu, uint32_t msg_id)
{
int err;
struct mdp_ipi_comm msg;
msg.msg_id = msg_id;
msg.ipi_id = IPI_MDP;
msg.vpu_inst_addr = vpu->inst_addr;
msg.ap_inst = (unsigned long)vpu;
err = mtk_mdp_vpu_send_msg((void *)&msg, sizeof(msg), vpu, IPI_MDP);
if (!err && vpu->failure)
err = -EINVAL;
return err;
}
int mtk_mdp_vpu_init(struct mtk_mdp_vpu *vpu)
{
int err;
struct mdp_ipi_init msg;
struct mtk_mdp_ctx *ctx = vpu_to_ctx(vpu);
vpu->pdev = ctx->mdp_dev->vpu_dev;
msg.msg_id = AP_MDP_INIT;
msg.ipi_id = IPI_MDP;
msg.ap_inst = (unsigned long)vpu;
err = mtk_mdp_vpu_send_msg((void *)&msg, sizeof(msg), vpu, IPI_MDP);
if (!err && vpu->failure)
err = -EINVAL;
return err;
}
Annotation
- Immediate include surface: `mtk_mdp_core.h`, `mtk_mdp_vpu.h`, `mtk_vpu.h`.
- Detected declarations: `function Copyright`, `function mtk_mdp_vpu_handle_init_ack`, `function mtk_mdp_vpu_ipi_handler`, `function mtk_mdp_vpu_register`, `function mtk_mdp_vpu_send_msg`, `function mtk_mdp_vpu_send_ap_ipi`, `function mtk_mdp_vpu_init`, `function mtk_mdp_vpu_deinit`, `function mtk_mdp_vpu_process`.
- 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.