drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.c- Extension
.c- Size
- 2079 bytes
- Lines
- 79
- 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
../decoder/mtk_vcodec_dec_drv.h../encoder/mtk_vcodec_enc_drv.hmtk_vcodec_fw_priv.h
Detected Declarations
function mtk_vcodec_fw_releasefunction mtk_vcodec_fw_load_firmwarefunction mtk_vcodec_fw_get_vdec_capafunction mtk_vcodec_fw_get_venc_capafunction mtk_vcodec_fw_ipi_registerfunction mtk_vcodec_fw_ipi_sendfunction mtk_vcodec_fw_get_typeexport mtk_vcodec_fw_selectexport mtk_vcodec_fw_releaseexport mtk_vcodec_fw_load_firmwareexport mtk_vcodec_fw_get_vdec_capaexport mtk_vcodec_fw_get_venc_capaexport mtk_vcodec_fw_map_dm_addrexport mtk_vcodec_fw_ipi_registerexport mtk_vcodec_fw_ipi_sendexport mtk_vcodec_fw_get_type
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include "../decoder/mtk_vcodec_dec_drv.h"
#include "../encoder/mtk_vcodec_enc_drv.h"
#include "mtk_vcodec_fw_priv.h"
struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type type,
enum mtk_vcodec_fw_use fw_use)
{
struct platform_device *plat_dev;
if (fw_use == ENCODER)
plat_dev = ((struct mtk_vcodec_enc_dev *)priv)->plat_dev;
else
plat_dev = ((struct mtk_vcodec_dec_dev *)priv)->plat_dev;
switch (type) {
case VPU:
return mtk_vcodec_fw_vpu_init(priv, fw_use);
case SCP:
return mtk_vcodec_fw_scp_init(priv, fw_use);
default:
dev_err(&plat_dev->dev, "Invalid vcodec fw type");
return ERR_PTR(-EINVAL);
}
}
EXPORT_SYMBOL_GPL(mtk_vcodec_fw_select);
void mtk_vcodec_fw_release(struct mtk_vcodec_fw *fw)
{
fw->ops->release(fw);
}
EXPORT_SYMBOL_GPL(mtk_vcodec_fw_release);
int mtk_vcodec_fw_load_firmware(struct mtk_vcodec_fw *fw)
{
return fw->ops->load_firmware(fw);
}
EXPORT_SYMBOL_GPL(mtk_vcodec_fw_load_firmware);
unsigned int mtk_vcodec_fw_get_vdec_capa(struct mtk_vcodec_fw *fw)
{
return fw->ops->get_vdec_capa(fw);
}
EXPORT_SYMBOL_GPL(mtk_vcodec_fw_get_vdec_capa);
unsigned int mtk_vcodec_fw_get_venc_capa(struct mtk_vcodec_fw *fw)
{
return fw->ops->get_venc_capa(fw);
}
EXPORT_SYMBOL_GPL(mtk_vcodec_fw_get_venc_capa);
void *mtk_vcodec_fw_map_dm_addr(struct mtk_vcodec_fw *fw, u32 mem_addr)
{
return fw->ops->map_dm_addr(fw, mem_addr);
}
EXPORT_SYMBOL_GPL(mtk_vcodec_fw_map_dm_addr);
int mtk_vcodec_fw_ipi_register(struct mtk_vcodec_fw *fw, int id,
mtk_vcodec_ipi_handler handler,
const char *name, void *priv)
{
return fw->ops->ipi_register(fw, id, handler, name, priv);
}
EXPORT_SYMBOL_GPL(mtk_vcodec_fw_ipi_register);
int mtk_vcodec_fw_ipi_send(struct mtk_vcodec_fw *fw, int id, void *buf,
unsigned int len, unsigned int wait)
{
return fw->ops->ipi_send(fw, id, buf, len, wait);
}
EXPORT_SYMBOL_GPL(mtk_vcodec_fw_ipi_send);
int mtk_vcodec_fw_get_type(struct mtk_vcodec_fw *fw)
{
return fw->type;
}
EXPORT_SYMBOL_GPL(mtk_vcodec_fw_get_type);
Annotation
- Immediate include surface: `../decoder/mtk_vcodec_dec_drv.h`, `../encoder/mtk_vcodec_enc_drv.h`, `mtk_vcodec_fw_priv.h`.
- Detected declarations: `function mtk_vcodec_fw_release`, `function mtk_vcodec_fw_load_firmware`, `function mtk_vcodec_fw_get_vdec_capa`, `function mtk_vcodec_fw_get_venc_capa`, `function mtk_vcodec_fw_ipi_register`, `function mtk_vcodec_fw_ipi_send`, `function mtk_vcodec_fw_get_type`, `export mtk_vcodec_fw_select`, `export mtk_vcodec_fw_release`, `export mtk_vcodec_fw_load_firmware`.
- 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.