sound/soc/sof/topology.c
Source file repositories/reference/linux-study-clean/sound/soc/sof/topology.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sof/topology.c- Extension
.c- Size
- 75290 bytes
- Lines
- 2657
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/bits.hlinux/device.hlinux/errno.hlinux/firmware.hlinux/workqueue.hsound/tlv.huapi/sound/sof/tokens.hsof-priv.hsof-audio.hops.h
Detected Declarations
struct sof_dai_typesstruct sof_frame_typesfunction sof_update_ipc_objectfunction get_tlv_datafunction vol_shift_64function vol_pow32function vol_compute_gainfunction set_up_volume_tablefunction find_daifunction find_formatfunction get_token_u32function get_token_u16function get_token_uuidfunction get_token_stringfunction get_token_comp_formatfunction get_token_dai_typefunction sof_parse_uuid_tokensfunction sof_copy_tuplesfunction sof_parse_string_tokensfunction sof_parse_word_tokensfunction sof_parse_token_setsfunction sof_parse_tokensfunction sof_control_load_volumefunction sof_control_load_enumfunction sof_control_load_bytesfunction sof_control_loadfunction sof_control_unloadfunction sof_connect_dai_widgetfunction for_each_rtd_cpu_daisfunction sof_disconnect_dai_widgetfunction list_for_each_entryfunction for_each_rtd_cpu_daisfunction spcm_bindfunction sof_get_token_valuefunction sof_widget_parse_tokensfunction sof_free_pin_bindingfunction sof_parse_pin_bindingfunction get_w_no_wname_in_long_namefunction sof_widget_readyfunction sof_route_unloadfunction sof_widget_unloadfunction sof_dai_loadfunction for_each_pcm_streamsfunction sof_dai_unloadfunction sof_link_loadfunction sof_link_unloadfunction sof_route_loadfunction sof_set_widget_pipeline
Annotated Snippet
struct sof_dai_types {
const char *name;
enum sof_ipc_dai_type type;
};
static const struct sof_dai_types sof_dais[] = {
{"SSP", SOF_DAI_INTEL_SSP},
{"HDA", SOF_DAI_INTEL_HDA},
{"DMIC", SOF_DAI_INTEL_DMIC},
{"ALH", SOF_DAI_INTEL_ALH},
{"SAI", SOF_DAI_IMX_SAI},
{"ESAI", SOF_DAI_IMX_ESAI},
{"ACPBT", SOF_DAI_AMD_BT},
{"ACPSP", SOF_DAI_AMD_SP},
{"ACPDMIC", SOF_DAI_AMD_DMIC},
{"ACPHS", SOF_DAI_AMD_HS},
{"AFE", SOF_DAI_MEDIATEK_AFE},
{"ACPSP_VIRTUAL", SOF_DAI_AMD_SP_VIRTUAL},
{"ACPHS_VIRTUAL", SOF_DAI_AMD_HS_VIRTUAL},
{"MICFIL", SOF_DAI_IMX_MICFIL},
{"ACP_SDW", SOF_DAI_AMD_SDW},
};
static enum sof_ipc_dai_type find_dai(const char *name)
{
int i;
for (i = 0; i < ARRAY_SIZE(sof_dais); i++) {
if (strcmp(name, sof_dais[i].name) == 0)
return sof_dais[i].type;
}
return SOF_DAI_INTEL_NONE;
}
/*
* Supported Frame format types and lookup, add new ones to end of list.
*/
struct sof_frame_types {
const char *name;
enum sof_ipc_frame frame;
};
static const struct sof_frame_types sof_frames[] = {
{"s16le", SOF_IPC_FRAME_S16_LE},
{"s24le", SOF_IPC_FRAME_S24_4LE},
{"s32le", SOF_IPC_FRAME_S32_LE},
{"float", SOF_IPC_FRAME_FLOAT},
};
static enum sof_ipc_frame find_format(const char *name)
{
int i;
for (i = 0; i < ARRAY_SIZE(sof_frames); i++) {
if (strcmp(name, sof_frames[i].name) == 0)
return sof_frames[i].frame;
}
/* use s32le if nothing is specified */
return SOF_IPC_FRAME_S32_LE;
}
int get_token_u32(void *elem, void *object, u32 offset)
{
struct snd_soc_tplg_vendor_value_elem *velem = elem;
u32 *val = (u32 *)((u8 *)object + offset);
*val = le32_to_cpu(velem->value);
return 0;
}
int get_token_u16(void *elem, void *object, u32 offset)
{
struct snd_soc_tplg_vendor_value_elem *velem = elem;
u16 *val = (u16 *)((u8 *)object + offset);
*val = (u16)le32_to_cpu(velem->value);
return 0;
}
int get_token_uuid(void *elem, void *object, u32 offset)
{
struct snd_soc_tplg_vendor_uuid_elem *velem = elem;
u8 *dst = (u8 *)object + offset;
memcpy(dst, velem->uuid, UUID_SIZE);
Annotation
- Immediate include surface: `linux/bits.h`, `linux/device.h`, `linux/errno.h`, `linux/firmware.h`, `linux/workqueue.h`, `sound/tlv.h`, `uapi/sound/sof/tokens.h`, `sof-priv.h`.
- Detected declarations: `struct sof_dai_types`, `struct sof_frame_types`, `function sof_update_ipc_object`, `function get_tlv_data`, `function vol_shift_64`, `function vol_pow32`, `function vol_compute_gain`, `function set_up_volume_table`, `function find_dai`, `function find_format`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.