drivers/media/platform/amphion/vpu_dbg.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/amphion/vpu_dbg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/amphion/vpu_dbg.c- Extension
.c- Size
- 12773 bytes
- Lines
- 522
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/device.hlinux/ioctl.hlinux/list.hlinux/module.hlinux/kernel.hlinux/types.hlinux/pm_runtime.hmedia/v4l2-device.hlinux/debugfs.hvpu.hvpu_defs.hvpu_core.hvpu_helpers.hvpu_cmds.hvpu_rpc.hvpu_v4l2.h
Detected Declarations
struct print_buf_descfunction vpu_dbg_instancefunction vpu_dbg_corefunction vpu_dbg_fwlogfunction vpu_dbg_inst_openfunction vpu_dbg_inst_writefunction vpu_dbg_core_writefunction vpu_dbg_core_openfunction vpu_dbg_fwlog_openfunction vpu_inst_create_dbgfs_filefunction vpu_inst_remove_dbgfs_filefunction vpu_core_create_dbgfs_filefunction vpu_core_remove_dbgfs_filefunction vpu_inst_record_flow
Annotated Snippet
static const struct file_operations vpu_dbg_inst_fops = {
.owner = THIS_MODULE,
.open = vpu_dbg_inst_open,
.release = single_release,
.read = seq_read,
.write = vpu_dbg_inst_write,
};
static const struct file_operations vpu_dbg_core_fops = {
.owner = THIS_MODULE,
.open = vpu_dbg_core_open,
.release = single_release,
.read = seq_read,
.write = vpu_dbg_core_write,
};
static const struct file_operations vpu_dbg_fwlog_fops = {
.owner = THIS_MODULE,
.open = vpu_dbg_fwlog_open,
.release = single_release,
.read = seq_read,
};
int vpu_inst_create_dbgfs_file(struct vpu_inst *inst)
{
struct vpu_dev *vpu;
char name[64];
if (!inst || !inst->core || !inst->core->vpu)
return -EINVAL;
vpu = inst->core->vpu;
if (!vpu->debugfs)
return -EINVAL;
if (inst->debugfs)
return 0;
scnprintf(name, sizeof(name), "instance.%d.%d", inst->core->id, inst->id);
inst->debugfs = debugfs_create_file((const char *)name,
VERIFY_OCTAL_PERMISSIONS(0644),
vpu->debugfs,
inst,
&vpu_dbg_inst_fops);
return 0;
}
int vpu_inst_remove_dbgfs_file(struct vpu_inst *inst)
{
if (!inst)
return 0;
debugfs_remove(inst->debugfs);
inst->debugfs = NULL;
return 0;
}
int vpu_core_create_dbgfs_file(struct vpu_core *core)
{
struct vpu_dev *vpu;
char name[64];
if (!core || !core->vpu)
return -EINVAL;
vpu = core->vpu;
if (!vpu->debugfs)
return -EINVAL;
if (!core->debugfs) {
scnprintf(name, sizeof(name), "core.%d", core->id);
core->debugfs = debugfs_create_file((const char *)name,
VERIFY_OCTAL_PERMISSIONS(0644),
vpu->debugfs,
core,
&vpu_dbg_core_fops);
}
if (!core->debugfs_fwlog) {
scnprintf(name, sizeof(name), "fwlog.%d", core->id);
core->debugfs_fwlog = debugfs_create_file((const char *)name,
VERIFY_OCTAL_PERMISSIONS(0444),
vpu->debugfs,
core,
&vpu_dbg_fwlog_fops);
}
return 0;
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/device.h`, `linux/ioctl.h`, `linux/list.h`, `linux/module.h`, `linux/kernel.h`, `linux/types.h`, `linux/pm_runtime.h`.
- Detected declarations: `struct print_buf_desc`, `function vpu_dbg_instance`, `function vpu_dbg_core`, `function vpu_dbg_fwlog`, `function vpu_dbg_inst_open`, `function vpu_dbg_inst_write`, `function vpu_dbg_core_write`, `function vpu_dbg_core_open`, `function vpu_dbg_fwlog_open`, `function vpu_inst_create_dbgfs_file`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: pattern 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.