sound/soc/sof/ipc3-topology.c
Source file repositories/reference/linux-study-clean/sound/soc/sof/ipc3-topology.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sof/ipc3-topology.c- Extension
.c- Size
- 85147 bytes
- Lines
- 2722
- 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
uapi/sound/sof/tokens.hsound/pcm_params.hsof-priv.hsof-audio.hipc3-priv.hops.h
Detected Declarations
struct sof_widget_datastruct sof_process_typesfunction find_processfunction get_token_process_typefunction sof_dbg_comp_configfunction sof_ipc3_widget_setup_comp_hostfunction sof_ipc3_widget_free_compfunction sof_ipc3_widget_setup_comp_tonefunction sof_ipc3_widget_setup_comp_mixerfunction sof_ipc3_widget_setup_comp_pipelinefunction sof_ipc3_widget_setup_comp_bufferfunction sof_ipc3_widget_setup_comp_srcfunction sof_ipc3_widget_setup_comp_asrcfunction sof_ipc3_widget_setup_comp_muxfunction sof_ipc3_widget_setup_comp_pgafunction list_for_each_entryfunction sof_get_control_datafunction sof_process_loadfunction find_process_comp_typefunction sof_widget_update_ipc_comp_processfunction sof_link_hda_loadfunction sof_dai_set_formatfunction sof_link_sai_loadfunction sof_link_esai_loadfunction sof_link_micfil_loadfunction sof_link_acp_dmic_loadfunction sof_link_acp_bt_loadfunction sof_link_acp_sp_loadfunction sof_link_acp_hs_loadfunction sof_link_acp_sdw_loadfunction sof_link_afe_loadfunction sof_link_ssp_loadfunction sof_link_dmic_loadfunction sof_link_alh_loadfunction sof_ipc3_widget_setup_comp_daifunction sof_ipc3_widget_free_comp_daifunction sof_ipc3_route_setupfunction sof_ipc3_control_load_bytesfunction sof_ipc3_control_load_volumefunction sof_ipc3_control_load_enumfunction sof_ipc3_control_setupfunction sof_ipc3_control_freefunction sof_ipc3_keyword_detect_pcm_paramsfunction sof_ipc3_keyword_detect_triggerfunction sof_ipc3_keyword_dapm_eventfunction sof_ipc3_widget_bind_eventfunction sof_ipc3_complete_pipelinefunction sof_ipc3_widget_free
Annotated Snippet
struct sof_widget_data {
int ctrl_type;
int ipc_cmd;
void *pdata;
size_t pdata_size;
struct snd_sof_control *control;
};
struct sof_process_types {
const char *name;
enum sof_ipc_process_type type;
enum sof_comp_type comp_type;
};
static const struct sof_process_types sof_process[] = {
{"EQFIR", SOF_PROCESS_EQFIR, SOF_COMP_EQ_FIR},
{"EQIIR", SOF_PROCESS_EQIIR, SOF_COMP_EQ_IIR},
{"KEYWORD_DETECT", SOF_PROCESS_KEYWORD_DETECT, SOF_COMP_KEYWORD_DETECT},
{"KPB", SOF_PROCESS_KPB, SOF_COMP_KPB},
{"CHAN_SELECTOR", SOF_PROCESS_CHAN_SELECTOR, SOF_COMP_SELECTOR},
{"MUX", SOF_PROCESS_MUX, SOF_COMP_MUX},
{"DEMUX", SOF_PROCESS_DEMUX, SOF_COMP_DEMUX},
{"DCBLOCK", SOF_PROCESS_DCBLOCK, SOF_COMP_DCBLOCK},
{"SMART_AMP", SOF_PROCESS_SMART_AMP, SOF_COMP_SMART_AMP},
};
static enum sof_ipc_process_type find_process(const char *name)
{
int i;
for (i = 0; i < ARRAY_SIZE(sof_process); i++) {
if (strcmp(name, sof_process[i].name) == 0)
return sof_process[i].type;
}
return SOF_PROCESS_NONE;
}
static int get_token_process_type(void *elem, void *object, u32 offset)
{
u32 *val = (u32 *)((u8 *)object + offset);
*val = find_process((const char *)elem);
return 0;
}
/* Buffers */
static const struct sof_topology_token buffer_tokens[] = {
{SOF_TKN_BUF_SIZE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc_buffer, size)},
{SOF_TKN_BUF_CAPS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc_buffer, caps)},
{SOF_TKN_BUF_FLAGS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc_buffer, flags)},
};
/* DAI */
static const struct sof_topology_token dai_tokens[] = {
{SOF_TKN_DAI_TYPE, SND_SOC_TPLG_TUPLE_TYPE_STRING, get_token_dai_type,
offsetof(struct sof_ipc_comp_dai, type)},
{SOF_TKN_DAI_INDEX, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc_comp_dai, dai_index)},
{SOF_TKN_DAI_DIRECTION, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc_comp_dai, direction)},
};
/* BE DAI link */
static const struct sof_topology_token dai_link_tokens[] = {
{SOF_TKN_DAI_TYPE, SND_SOC_TPLG_TUPLE_TYPE_STRING, get_token_dai_type,
offsetof(struct sof_ipc_dai_config, type)},
{SOF_TKN_DAI_INDEX, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc_dai_config, dai_index)},
};
/* scheduling */
static const struct sof_topology_token sched_tokens[] = {
{SOF_TKN_SCHED_PERIOD, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc_pipe_new, period)},
{SOF_TKN_SCHED_PRIORITY, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc_pipe_new, priority)},
{SOF_TKN_SCHED_MIPS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc_pipe_new, period_mips)},
{SOF_TKN_SCHED_CORE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc_pipe_new, core)},
{SOF_TKN_SCHED_FRAMES, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc_pipe_new, frames_per_sched)},
{SOF_TKN_SCHED_TIME_DOMAIN, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
offsetof(struct sof_ipc_pipe_new, time_domain)},
};
Annotation
- Immediate include surface: `uapi/sound/sof/tokens.h`, `sound/pcm_params.h`, `sof-priv.h`, `sof-audio.h`, `ipc3-priv.h`, `ops.h`.
- Detected declarations: `struct sof_widget_data`, `struct sof_process_types`, `function find_process`, `function get_token_process_type`, `function sof_dbg_comp_config`, `function sof_ipc3_widget_setup_comp_host`, `function sof_ipc3_widget_free_comp`, `function sof_ipc3_widget_setup_comp_tone`, `function sof_ipc3_widget_setup_comp_mixer`, `function sof_ipc3_widget_setup_comp_pipeline`.
- 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.