drivers/media/platform/qcom/venus/core.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/qcom/venus/core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/qcom/venus/core.c- Extension
.c- Size
- 31858 bytes
- Lines
- 1205
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/init.hlinux/interconnect.hlinux/io.hlinux/ioctl.hlinux/delay.hlinux/devcoredump.hlinux/list.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/slab.hlinux/types.hlinux/pm_domain.hlinux/pm_runtime.hlinux/videodev2.hmedia/videobuf2-v4l2.hmedia/v4l2-ctrls.hmedia/v4l2-mem2mem.hmedia/v4l2-ioctl.hcore.hfirmware.hpm_helpers.hhfi_venus_io.h
Detected Declarations
function Copyrightfunction venus_event_notifyfunction venus_sys_error_handlerfunction to_v4l2_codec_typefunction venus_enumerate_codecsfunction venus_assign_register_offsetsfunction venus_isr_threadfunction venus_add_video_corefunction venus_add_dynamic_nodesfunction venus_remove_dynamic_nodesfunction venus_add_dynamic_nodesfunction venus_remove_dynamic_nodesfunction venus_removefunction venus_core_shutdownfunction venus_runtime_suspendfunction venus_close_commonfunction venus_runtime_resumeexport venus_close_common
Annotated Snippet
if (IS_AR50_LITE(core)) {
core->vbif_base = NULL;
core->aon_base = NULL;
} else {
core->vbif_base = core->base + VBIF_BASE;
core->aon_base = core->base + AON_BASE_V6;
}
} else {
core->vbif_base = core->base + VBIF_BASE;
core->cpu_base = core->base + CPU_BASE;
core->cpu_cs_base = core->base + CPU_CS_BASE;
core->cpu_ic_base = core->base + CPU_IC_BASE;
core->wrapper_base = core->base + WRAPPER_BASE;
core->wrapper_tz_base = NULL;
core->aon_base = NULL;
}
}
static irqreturn_t venus_isr_thread(int irq, void *dev_id)
{
struct venus_core *core = dev_id;
irqreturn_t ret;
ret = hfi_isr_thread(irq, dev_id);
if (ret == IRQ_HANDLED && venus_fault_inject_ssr())
hfi_core_trigger_ssr(core, HFI_TEST_SSR_SW_ERR_FATAL);
return ret;
}
#if defined(CONFIG_OF_DYNAMIC)
static int venus_add_video_core(struct venus_core *core, const char *node_name,
const char *compat)
{
struct of_changeset *ocs = core->ocs;
struct device *dev = core->dev;
struct device_node *np, *enp;
int ret;
if (!node_name)
return 0;
enp = of_find_node_by_name(dev->of_node, node_name);
if (enp) {
of_node_put(enp);
return 0;
}
np = of_changeset_create_node(ocs, dev->of_node, node_name);
if (!np) {
dev_err(dev, "Unable to create new node\n");
return -ENODEV;
}
ret = of_changeset_add_prop_string(ocs, np, "compatible", compat);
if (ret)
dev_err(dev, "unable to add %s\n", compat);
of_node_put(np);
return ret;
}
static int venus_add_dynamic_nodes(struct venus_core *core)
{
struct device *dev = core->dev;
int ret;
core->ocs = kmalloc_obj(*core->ocs);
if (!core->ocs)
return -ENOMEM;
of_changeset_init(core->ocs);
ret = venus_add_video_core(core, core->res->dec_nodename, "venus-decoder");
if (ret)
goto err;
ret = venus_add_video_core(core, core->res->enc_nodename, "venus-encoder");
if (ret)
goto err;
ret = of_changeset_apply(core->ocs);
if (ret) {
dev_err(dev, "applying changeset fail ret %d\n", ret);
goto err;
}
return 0;
Annotation
- Immediate include surface: `linux/init.h`, `linux/interconnect.h`, `linux/io.h`, `linux/ioctl.h`, `linux/delay.h`, `linux/devcoredump.h`, `linux/list.h`, `linux/module.h`.
- Detected declarations: `function Copyright`, `function venus_event_notify`, `function venus_sys_error_handler`, `function to_v4l2_codec_type`, `function venus_enumerate_codecs`, `function venus_assign_register_offsets`, `function venus_isr_thread`, `function venus_add_video_core`, `function venus_add_dynamic_nodes`, `function venus_remove_dynamic_nodes`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.