drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c- Extension
.c- Size
- 2520 bytes
- Lines
- 106
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/of.hlinux/pm_runtime.hmtk_vcodec_enc_drv.hmtk_vcodec_enc_pm.h
Detected Declarations
function Copyrightfunction mtk_vcodec_enc_pw_onfunction mtk_vcodec_enc_pw_offfunction mtk_vcodec_enc_clock_onfunction mtk_vcodec_enc_clock_off
Annotated Snippet
if (ret) {
dev_err(pm->dev, "[MTK VCODEC] venc failed to get clk name %d", i);
return ret;
}
clk_info->vcodec_clk = devm_clk_get(&pdev->dev,
clk_info->clk_name);
if (IS_ERR(clk_info->vcodec_clk)) {
dev_err(pm->dev, "[MTK VCODEC] venc devm_clk_get (%d)%s fail", i,
clk_info->clk_name);
return PTR_ERR(clk_info->vcodec_clk);
}
}
return 0;
}
int mtk_vcodec_enc_pw_on(struct mtk_vcodec_pm *pm)
{
int ret;
ret = pm_runtime_resume_and_get(pm->dev);
if (ret)
dev_err(pm->dev, "pm_runtime_resume_and_get fail: %d", ret);
return ret;
}
void mtk_vcodec_enc_pw_off(struct mtk_vcodec_pm *pm)
{
pm_runtime_put(pm->dev);
}
void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm)
{
struct mtk_vcodec_clk *enc_clk = &pm->venc_clk;
int ret, i = 0;
for (i = 0; i < enc_clk->clk_num; i++) {
ret = clk_prepare_enable(enc_clk->clk_info[i].vcodec_clk);
if (ret) {
dev_err(pm->dev, "[MTK VCODEC] venc clk_prepare_enable %d %s fail %d", i,
enc_clk->clk_info[i].clk_name, ret);
goto clkerr;
}
}
return;
clkerr:
for (i -= 1; i >= 0; i--)
clk_disable_unprepare(enc_clk->clk_info[i].vcodec_clk);
}
void mtk_vcodec_enc_clock_off(struct mtk_vcodec_pm *pm)
{
struct mtk_vcodec_clk *enc_clk = &pm->venc_clk;
int i = 0;
for (i = enc_clk->clk_num - 1; i >= 0; i--)
clk_disable_unprepare(enc_clk->clk_info[i].vcodec_clk);
}
Annotation
- Immediate include surface: `linux/clk.h`, `linux/of.h`, `linux/pm_runtime.h`, `mtk_vcodec_enc_drv.h`, `mtk_vcodec_enc_pm.h`.
- Detected declarations: `function Copyright`, `function mtk_vcodec_enc_pw_on`, `function mtk_vcodec_enc_pw_off`, `function mtk_vcodec_enc_clock_on`, `function mtk_vcodec_enc_clock_off`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source 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.