drivers/media/platform/amphion/vpu_rpc.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/amphion/vpu_rpc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/amphion/vpu_rpc.c- Extension
.c- Size
- 6602 bytes
- Lines
- 258
- 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/init.hlinux/interconnect.hlinux/ioctl.hlinux/list.hlinux/kernel.hlinux/module.hlinux/platform_device.hlinux/firmware/imx/ipc.hlinux/firmware/imx/svc/misc.hvpu.hvpu_rpc.hvpu_imx8q.hvpu_windsor.hvpu_malone.h
Detected Declarations
function vpu_iface_check_memory_regionfunction vpu_rpc_check_buffer_spacefunction vpu_rpc_send_cmd_buffunction vpu_rpc_check_msgfunction vpu_rpc_receive_msg_buf
Annotated Snippet
if (wptr >= desc->end) {
wptr = desc->start;
data = shared->cmd_mem_vir;
}
}
/*update wptr after data is written*/
mb();
desc->wptr = wptr;
return 0;
}
static bool vpu_rpc_check_msg(struct vpu_shared_addr *shared)
{
struct vpu_rpc_buffer_desc *desc;
u32 space = 0;
u32 msgword;
u32 msgnum;
desc = shared->msg_desc;
space = vpu_rpc_check_buffer_space(desc, 0);
space = (space >> 2);
if (space) {
msgword = *(u32 *)(shared->msg_mem_vir + desc->rptr - desc->start);
msgnum = (msgword & 0xff0000) >> 16;
if (msgnum <= space)
return true;
}
return false;
}
static int vpu_rpc_receive_msg_buf(struct vpu_shared_addr *shared, struct vpu_rpc_event *msg)
{
struct vpu_rpc_buffer_desc *desc;
u32 *data;
u32 msgword;
u32 rptr;
u32 i;
if (!vpu_rpc_check_msg(shared))
return -EINVAL;
desc = shared->msg_desc;
data = (u32 *)(shared->msg_mem_vir + desc->rptr - desc->start);
rptr = desc->rptr;
msgword = *data;
data++;
rptr += 4;
if (rptr >= desc->end) {
rptr = desc->start;
data = shared->msg_mem_vir;
}
msg->hdr.index = (msgword >> 24) & 0xff;
msg->hdr.num = (msgword >> 16) & 0xff;
msg->hdr.id = msgword & 0x3fff;
if (msg->hdr.num > ARRAY_SIZE(msg->data))
return -EINVAL;
for (i = 0; i < msg->hdr.num; i++) {
msg->data[i] = *data;
data++;
rptr += 4;
if (rptr >= desc->end) {
rptr = desc->start;
data = shared->msg_mem_vir;
}
}
/*update rptr after data is read*/
mb();
desc->rptr = rptr;
return 0;
}
static struct vpu_iface_ops imx8q_rpc_ops[] = {
[VPU_CORE_TYPE_ENC] = {
.check_codec = vpu_imx8q_check_codec,
.check_fmt = vpu_imx8q_check_fmt,
.boot_core = vpu_imx8q_boot_core,
.get_power_state = vpu_imx8q_get_power_state,
.on_firmware_loaded = vpu_imx8q_on_firmware_loaded,
.get_data_size = vpu_windsor_get_data_size,
.check_memory_region = vpu_imx8q_check_memory_region,
.init_rpc = vpu_windsor_init_rpc,
Annotation
- Immediate include surface: `linux/init.h`, `linux/interconnect.h`, `linux/ioctl.h`, `linux/list.h`, `linux/kernel.h`, `linux/module.h`, `linux/platform_device.h`, `linux/firmware/imx/ipc.h`.
- Detected declarations: `function vpu_iface_check_memory_region`, `function vpu_rpc_check_buffer_space`, `function vpu_rpc_send_cmd_buf`, `function vpu_rpc_check_msg`, `function vpu_rpc_receive_msg_buf`.
- 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.