drivers/media/platform/st/sti/delta/delta-ipc.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/st/sti/delta/delta-ipc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/st/sti/delta/delta-ipc.c- Extension
.c- Size
- 14853 bytes
- Lines
- 592
- 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/rpmsg.hdelta.hdelta-ipc.hdelta-mem.h
Detected Declarations
struct delta_ipc_header_msgstruct delta_ipc_open_msgstruct delta_ipc_set_stream_msgstruct delta_ipc_decode_msgstruct delta_ipc_close_msgstruct delta_ipc_cb_msgenum delta_ipc_fw_commandfunction to_paddrfunction is_valid_datafunction build_msg_headerfunction delta_ipc_openfunction delta_ipc_set_streamfunction delta_ipc_decodefunction delta_ipc_closefunction delta_ipc_cbfunction delta_ipc_probefunction delta_ipc_removefunction delta_ipc_initfunction delta_ipc_exit
Annotated Snippet
struct delta_ipc_header_msg {
u32 tag;
void *host_hdl;
u32 copro_hdl;
u32 command;
};
#define to_host_hdl(ctx) ((void *)ctx)
#define msg_to_ctx(msg) ((struct delta_ipc_ctx *)(msg)->header.host_hdl)
#define msg_to_copro_hdl(msg) ((msg)->header.copro_hdl)
static inline dma_addr_t to_paddr(struct delta_ipc_ctx *ctx, void *vaddr)
{
return (ctx->ipc_buf->paddr + (vaddr - ctx->ipc_buf->vaddr));
}
static inline bool is_valid_data(struct delta_ipc_ctx *ctx,
void *data, u32 size)
{
return ((data >= ctx->ipc_buf->vaddr) &&
((data + size) <= (ctx->ipc_buf->vaddr + ctx->ipc_buf->size)));
}
/*
* IPC shared memory (@ipc_buf_size, @ipc_buf_paddr) is sent to copro
* at each instance opening. This memory is allocated by IPC client
* and given through delta_ipc_open(). All messages parameters
* (open, set_stream, decode) will have their phy address within
* this IPC shared memory, avoiding de-facto recopies inside delta-ipc.
* All the below messages structures are used on both host and firmware
* side and are packed (use only of 32 bits size fields in messages
* structures to ensure packing):
* - struct delta_ipc_open_msg
* - struct delta_ipc_set_stream_msg
* - struct delta_ipc_decode_msg
* - struct delta_ipc_close_msg
* - struct delta_ipc_cb_msg
*/
struct delta_ipc_open_msg {
struct delta_ipc_header_msg header;
u32 ipc_buf_size;
dma_addr_t ipc_buf_paddr;
char name[32];
u32 param_size;
dma_addr_t param_paddr;
};
struct delta_ipc_set_stream_msg {
struct delta_ipc_header_msg header;
u32 param_size;
dma_addr_t param_paddr;
};
struct delta_ipc_decode_msg {
struct delta_ipc_header_msg header;
u32 param_size;
dma_addr_t param_paddr;
u32 status_size;
dma_addr_t status_paddr;
};
struct delta_ipc_close_msg {
struct delta_ipc_header_msg header;
};
struct delta_ipc_cb_msg {
struct delta_ipc_header_msg header;
int err;
};
static void build_msg_header(struct delta_ipc_ctx *ctx,
enum delta_ipc_fw_command command,
struct delta_ipc_header_msg *header)
{
header->tag = IPC_SANITY_TAG;
header->host_hdl = to_host_hdl(ctx);
header->copro_hdl = ctx->copro_hdl;
header->command = command;
}
int delta_ipc_open(struct delta_ctx *pctx, const char *name,
struct delta_ipc_param *param, u32 ipc_buf_size,
struct delta_buf **ipc_buf, void **hdl)
{
struct delta_dev *delta = pctx->dev;
struct rpmsg_device *rpmsg_device = delta->rpmsg_device;
struct delta_ipc_ctx *ctx = &pctx->ipc_ctx;
struct delta_ipc_open_msg msg;
struct delta_buf *buf = &ctx->ipc_buf_struct;
Annotation
- Immediate include surface: `linux/rpmsg.h`, `delta.h`, `delta-ipc.h`, `delta-mem.h`.
- Detected declarations: `struct delta_ipc_header_msg`, `struct delta_ipc_open_msg`, `struct delta_ipc_set_stream_msg`, `struct delta_ipc_decode_msg`, `struct delta_ipc_close_msg`, `struct delta_ipc_cb_msg`, `enum delta_ipc_fw_command`, `function to_paddr`, `function is_valid_data`, `function build_msg_header`.
- 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.