drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c- Extension
.c- Size
- 9704 bytes
- Lines
- 428
- 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.
- 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/module.hlinux/of_platform.hlinux/platform_device.hlinux/pm_runtime.hlinux/remoteproc.hlinux/remoteproc/mtk_scp.hmedia/videobuf2-dma-contig.hmtk-mdp3-core.hmtk-mdp3-cfg.hmtk-mdp3-m2m.h
Detected Declarations
function mdp_vpu_get_lockedfunction mdp_vpu_put_lockedfunction mdp_video_device_releasefunction mdp_put_devicefunction mdp_mm_subsys_deployfunction mdp_probefunction mdp_removefunction mdp_suspendfunction mdp_resume
Annotated Snippet
if (ret) {
dev_err(&mdp->pdev->dev,
"vpu_load_firmware failed %d\n", ret);
goto err_load_vpu;
}
ret = mdp_vpu_register(mdp);
if (ret) {
dev_err(&mdp->pdev->dev,
"mdp_vpu register failed %d\n", ret);
goto err_reg_vpu;
}
ret = mdp_vpu_dev_init(&mdp->vpu, mdp->scp, &mdp->vpu_lock);
if (ret) {
dev_err(&mdp->pdev->dev,
"mdp_vpu device init failed %d\n", ret);
goto err_init_vpu;
}
}
return 0;
err_init_vpu:
mdp_vpu_unregister(mdp);
err_reg_vpu:
err_load_vpu:
mdp->vpu_count--;
return ret;
}
void mdp_vpu_put_locked(struct mdp_dev *mdp)
{
if (--mdp->vpu_count == 0) {
mdp_vpu_dev_deinit(&mdp->vpu);
mdp_vpu_unregister(mdp);
}
}
void mdp_video_device_release(struct video_device *vdev)
{
struct mdp_dev *mdp = (struct mdp_dev *)video_get_drvdata(vdev);
int i;
for (i = 0; i < mdp->mdp_data->pp_used; i++)
if (mdp->cmdq_clt[i])
cmdq_mbox_destroy(mdp->cmdq_clt[i]);
scp_put(mdp->scp);
destroy_workqueue(mdp->job_wq);
destroy_workqueue(mdp->clock_wq);
pm_runtime_disable(&mdp->pdev->dev);
vb2_dma_contig_clear_max_seg_size(&mdp->pdev->dev);
mdp_comp_destroy(mdp);
for (i = 0; i < mdp->mdp_data->pipe_info_len; i++) {
enum mdp_mm_subsys_id idx;
struct mtk_mutex *m;
u32 m_id;
idx = mdp->mdp_data->pipe_info[i].sub_id;
m_id = mdp->mdp_data->pipe_info[i].mutex_id;
m = mdp->mm_subsys[idx].mdp_mutex[m_id];
if (!IS_ERR_OR_NULL(m))
mtk_mutex_put(m);
}
mdp_vpu_shared_mem_free(&mdp->vpu);
v4l2_m2m_release(mdp->m2m_dev);
kfree(mdp);
}
static void mdp_put_device(void *_dev)
{
struct device *dev = _dev;
put_device(dev);
}
static int mdp_mm_subsys_deploy(struct mdp_dev *mdp, enum mdp_infra_id id)
{
struct platform_device *mm_pdev = NULL;
struct device **dev;
int ret;
int i;
if (!mdp)
return -EINVAL;
for (i = 0; i < MDP_MM_SUBSYS_MAX; i++) {
Annotation
- Immediate include surface: `linux/clk.h`, `linux/module.h`, `linux/of_platform.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/remoteproc.h`, `linux/remoteproc/mtk_scp.h`, `media/videobuf2-dma-contig.h`.
- Detected declarations: `function mdp_vpu_get_locked`, `function mdp_vpu_put_locked`, `function mdp_video_device_release`, `function mdp_put_device`, `function mdp_mm_subsys_deploy`, `function mdp_probe`, `function mdp_remove`, `function mdp_suspend`, `function mdp_resume`.
- 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.