sound/soc/sof/sof-client-probes-ipc3.c
Source file repositories/reference/linux-study-clean/sound/soc/sof/sof-client-probes-ipc3.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sof/sof-client-probes-ipc3.c- Extension
.c- Size
- 6709 bytes
- Lines
- 244
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- 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/stddef.hsound/soc.hsound/sof/header.hsof-client.hsof-client-probes.h
Detected Declarations
struct sof_probe_dmastruct sof_ipc_probe_dma_add_paramsstruct sof_ipc_probe_info_paramsstruct sof_ipc_probe_point_add_paramsstruct sof_ipc_probe_point_remove_paramsfunction ipc3_probes_initfunction ipc3_probes_deinitfunction ipc3_probes_infofunction ipc3_probes_points_infofunction ipc3_probes_points_addfunction ipc3_probes_points_remove
Annotated Snippet
struct sof_probe_dma {
unsigned int stream_tag;
unsigned int dma_buffer_size;
} __packed;
struct sof_ipc_probe_dma_add_params {
struct sof_ipc_cmd_hdr hdr;
unsigned int num_elems;
struct sof_probe_dma dma[];
} __packed;
struct sof_ipc_probe_info_params {
struct sof_ipc_reply rhdr;
unsigned int num_elems;
union {
DECLARE_FLEX_ARRAY(struct sof_probe_dma, dma);
DECLARE_FLEX_ARRAY(struct sof_probe_point_desc, desc);
};
} __packed;
struct sof_ipc_probe_point_add_params {
struct sof_ipc_cmd_hdr hdr;
unsigned int num_elems;
struct sof_probe_point_desc desc[];
} __packed;
struct sof_ipc_probe_point_remove_params {
struct sof_ipc_cmd_hdr hdr;
unsigned int num_elems;
unsigned int buffer_id[];
} __packed;
/**
* ipc3_probes_init - initialize data probing
* @cdev: SOF client device
* @stream_tag: Extractor stream tag
* @buffer_size: DMA buffer size to set for extractor
*
* Host chooses whether extraction is supported or not by providing
* valid stream tag to DSP. Once specified, stream described by that
* tag will be tied to DSP for extraction for the entire lifetime of
* probe.
*
* Probing is initialized only once and each INIT request must be
* matched by DEINIT call.
*/
static int ipc3_probes_init(struct sof_client_dev *cdev, u32 stream_tag,
size_t buffer_size)
{
struct sof_ipc_probe_dma_add_params *msg;
size_t size = struct_size(msg, dma, 1);
int ret;
msg = kmalloc(size, GFP_KERNEL);
if (!msg)
return -ENOMEM;
msg->hdr.size = size;
msg->hdr.cmd = SOF_IPC_GLB_PROBE | SOF_IPC_PROBE_INIT;
msg->num_elems = 1;
msg->dma[0].stream_tag = stream_tag;
msg->dma[0].dma_buffer_size = buffer_size;
ret = sof_client_ipc_tx_message_no_reply(cdev, msg);
kfree(msg);
return ret;
}
/**
* ipc3_probes_deinit - cleanup after data probing
* @cdev: SOF client device
*
* Host sends DEINIT request to free previously initialized probe
* on DSP side once it is no longer needed. DEINIT only when there
* are no probes connected and with all injectors detached.
*/
static int ipc3_probes_deinit(struct sof_client_dev *cdev)
{
struct sof_ipc_cmd_hdr msg;
msg.size = sizeof(msg);
msg.cmd = SOF_IPC_GLB_PROBE | SOF_IPC_PROBE_DEINIT;
return sof_client_ipc_tx_message_no_reply(cdev, &msg);
}
static int ipc3_probes_info(struct sof_client_dev *cdev, unsigned int cmd,
void **params, size_t *num_params,
enum sof_probe_info_type type)
{
size_t max_msg_size = sof_client_get_ipc_max_payload_size(cdev);
Annotation
- Immediate include surface: `linux/stddef.h`, `sound/soc.h`, `sound/sof/header.h`, `sof-client.h`, `sof-client-probes.h`.
- Detected declarations: `struct sof_probe_dma`, `struct sof_ipc_probe_dma_add_params`, `struct sof_ipc_probe_info_params`, `struct sof_ipc_probe_point_add_params`, `struct sof_ipc_probe_point_remove_params`, `function ipc3_probes_init`, `function ipc3_probes_deinit`, `function ipc3_probes_info`, `function ipc3_probes_points_info`, `function ipc3_probes_points_add`.
- Atlas domain: Driver Families / sound/soc.
- 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.