drivers/media/platform/qcom/venus/firmware.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/qcom/venus/firmware.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/qcom/venus/firmware.c- Extension
.c- Size
- 8859 bytes
- Lines
- 385
- 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/device.hlinux/firmware.hlinux/kernel.hlinux/iommu.hlinux/io.hlinux/of.hlinux/of_reserved_mem.hlinux/platform_device.hlinux/of_device.hlinux/firmware/qcom/qcom_scm.hlinux/sizes.hlinux/soc/qcom/mdt_loader.hcore.hfirmware.hhfi_venus_io.h
Detected Declarations
function Copyrightfunction venus_set_hw_statefunction venus_load_fwfunction venus_boot_no_tzfunction venus_shutdown_no_tzfunction venus_firmware_cfgfunction venus_bootfunction venus_shutdownfunction venus_firmware_checkfunction venus_firmware_initfunction venus_firmware_deinit
Annotated Snippet
if (ret) {
qcom_scm_pas_shutdown(VENUS_PAS_ID);
dev_err(dev, "set virtual address ranges fail (%d)\n",
ret);
return ret;
}
}
return 0;
}
int venus_shutdown(struct venus_core *core)
{
int ret;
if (core->use_tz)
ret = qcom_scm_pas_shutdown(VENUS_PAS_ID);
else
ret = venus_shutdown_no_tz(core);
return ret;
}
int venus_firmware_check(struct venus_core *core)
{
const struct firmware_version *req = core->res->min_fw;
const struct firmware_version *run = &core->venus_ver;
if (!req)
return 0;
if (!is_fw_rev_or_newer(core, req->major, req->minor, req->rev))
goto error;
return 0;
error:
dev_err(core->dev, "Firmware v%d.%d.%d < v%d.%d.%d\n",
run->major, run->minor, run->rev,
req->major, req->minor, req->rev);
return -EINVAL;
}
int venus_firmware_init(struct venus_core *core)
{
struct platform_device_info info;
struct iommu_domain *iommu_dom;
struct platform_device *pdev;
struct device_node *np;
int ret;
np = of_get_child_by_name(core->dev->of_node, "video-firmware");
if (!np) {
core->use_tz = true;
return 0;
}
memset(&info, 0, sizeof(info));
info.fwnode = &np->fwnode;
info.parent = core->dev;
info.name = np->name;
info.dma_mask = DMA_BIT_MASK(32);
pdev = platform_device_register_full(&info);
if (IS_ERR(pdev)) {
of_node_put(np);
return PTR_ERR(pdev);
}
pdev->dev.of_node = np;
ret = of_dma_configure(&pdev->dev, np, true);
if (ret) {
dev_err(core->dev, "dma configure fail\n");
goto err_unregister;
}
core->fw.dev = &pdev->dev;
iommu_dom = iommu_paging_domain_alloc(core->fw.dev);
if (IS_ERR(iommu_dom)) {
dev_err(core->fw.dev, "Failed to allocate iommu domain\n");
ret = PTR_ERR(iommu_dom);
goto err_unregister;
}
ret = iommu_attach_device(iommu_dom, core->fw.dev);
if (ret) {
dev_err(core->fw.dev, "could not attach device\n");
goto err_iommu_free;
Annotation
- Immediate include surface: `linux/device.h`, `linux/firmware.h`, `linux/kernel.h`, `linux/iommu.h`, `linux/io.h`, `linux/of.h`, `linux/of_reserved_mem.h`, `linux/platform_device.h`.
- Detected declarations: `function Copyright`, `function venus_set_hw_state`, `function venus_load_fw`, `function venus_boot_no_tz`, `function venus_shutdown_no_tz`, `function venus_firmware_cfg`, `function venus_boot`, `function venus_shutdown`, `function venus_firmware_check`, `function venus_firmware_init`.
- 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.