sound/soc/qcom/qdsp6/topology.c
Source file repositories/reference/linux-study-clean/sound/soc/qcom/qdsp6/topology.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/qcom/qdsp6/topology.c- Extension
.c- Size
- 36415 bytes
- Lines
- 1343
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/cleanup.hsound/soc.hsound/soc-dapm.hsound/pcm.hsound/control.hsound/asound.hlinux/firmware.hsound/soc-topology.hsound/soc-dpcm.huapi/sound/snd_ar_tokens.hlinux/kernel.hlinux/wait.hq6apm.haudioreach.h
Detected Declarations
struct snd_ar_controlfunction audioreach_tplg_add_sub_graphfunction audioreach_get_sg_arrayfunction audioreach_get_cont_arrayfunction audioreach_get_module_arrayfunction audioreach_get_module_priv_datafunction audioreach_widget_load_module_commonfunction audioreach_widget_load_enc_dec_cnvfunction audioreach_widget_log_module_loadfunction audioreach_widget_dma_module_loadfunction audioreach_widget_i2s_module_loadfunction audioreach_widget_dp_module_loadfunction audioreach_widget_load_bufferfunction audioreach_widget_load_mixerfunction audioreach_pga_eventfunction audioreach_widget_load_pgafunction audioreach_widget_readyfunction audioreach_widget_unloadfunction list_for_each_entryfunction idr_for_each_entryfunction audioreach_route_loadfunction audioreach_route_unloadfunction audioreach_tplg_completefunction audioreach_link_loadfunction audioreach_connect_sub_graphsfunction audioreach_is_vmixer_connectedfunction audioreach_get_audio_mixerfunction audioreach_put_audio_mixerfunction audioreach_get_vol_ctrl_audio_mixerfunction audioreach_put_vol_ctrl_audio_mixerfunction audioreach_control_load_mixfunction audioreach_control_loadfunction audioreach_control_unloadfunction audioreach_tplg_initexport audioreach_tplg_init
Annotated Snippet
struct snd_ar_control {
u32 graph_id; /* Graph ID */
u32 sgid; /* Sub Graph ID */
u32 module_instance_id; /* Connected Module Instance ID */
struct snd_soc_dapm_widget *w;
struct list_head node;
struct snd_soc_component *scomp;
};
static struct audioreach_graph_info *audioreach_tplg_alloc_graph_info(struct q6apm *apm,
uint32_t graph_id,
bool *found)
{
struct audioreach_graph_info *info;
int ret;
mutex_lock(&apm->lock);
info = idr_find(&apm->graph_info_idr, graph_id);
mutex_unlock(&apm->lock);
if (info) {
*found = true;
return info;
}
*found = false;
info = kzalloc_obj(*info);
if (!info)
return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&info->sg_list);
mutex_lock(&apm->lock);
ret = idr_alloc_u32(&apm->graph_info_idr, info, &graph_id, graph_id, GFP_KERNEL);
mutex_unlock(&apm->lock);
if (ret < 0) {
dev_err(apm->dev, "Failed to allocate Graph ID (%x)\n", graph_id);
kfree(info);
return ERR_PTR(ret);
}
info->id = graph_id;
return info;
}
static void audioreach_tplg_add_sub_graph(struct audioreach_sub_graph *sg,
struct audioreach_graph_info *info)
{
list_add_tail(&sg->node, &info->sg_list);
sg->info = info;
info->num_sub_graphs++;
}
static struct audioreach_sub_graph *audioreach_tplg_alloc_sub_graph(struct q6apm *apm,
uint32_t sub_graph_id,
bool *found)
{
struct audioreach_sub_graph *sg;
int ret;
if (!sub_graph_id)
return ERR_PTR(-EINVAL);
/* Find if there is already a matching sub-graph */
mutex_lock(&apm->lock);
sg = idr_find(&apm->sub_graphs_idr, sub_graph_id);
mutex_unlock(&apm->lock);
if (sg) {
*found = true;
return sg;
}
*found = false;
sg = kzalloc_obj(*sg);
if (!sg)
return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&sg->container_list);
mutex_lock(&apm->lock);
ret = idr_alloc_u32(&apm->sub_graphs_idr, sg, &sub_graph_id, sub_graph_id, GFP_KERNEL);
mutex_unlock(&apm->lock);
if (ret < 0) {
dev_err(apm->dev, "Failed to allocate Sub-Graph Instance ID (%x)\n", sub_graph_id);
kfree(sg);
return ERR_PTR(ret);
Annotation
- Immediate include surface: `linux/cleanup.h`, `sound/soc.h`, `sound/soc-dapm.h`, `sound/pcm.h`, `sound/control.h`, `sound/asound.h`, `linux/firmware.h`, `sound/soc-topology.h`.
- Detected declarations: `struct snd_ar_control`, `function audioreach_tplg_add_sub_graph`, `function audioreach_get_sg_array`, `function audioreach_get_cont_array`, `function audioreach_get_module_array`, `function audioreach_get_module_priv_data`, `function audioreach_widget_load_module_common`, `function audioreach_widget_load_enc_dec_cnv`, `function audioreach_widget_log_module_load`, `function audioreach_widget_dma_module_load`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.