sound/soc/intel/avs/dsp.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/avs/dsp.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/avs/dsp.c- Extension
.c- Size
- 7898 bytes
- Lines
- 330
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/string_choices.hsound/hdaudio_ext.havs.hregisters.htrace.h
Detected Declarations
function avs_dsp_core_powerfunction avs_dsp_core_resetfunction avs_dsp_core_stallfunction avs_dsp_core_enablefunction avs_dsp_core_disablefunction avs_dsp_enablefunction avs_dsp_disablefunction avs_dsp_get_corefunction avs_dsp_put_corefunction avs_dsp_init_modulefunction avs_dsp_delete_modulefunction avs_dsp_create_pipelinefunction avs_dsp_delete_pipeline
Annotated Snippet
if (ret) {
dev_err(adev->dev, "load modules failed: %d\n", ret);
goto err_mod_entry;
}
was_loaded = true;
}
ret = avs_ipc_init_instance(adev, module_id, id, ppl_instance_id,
core_id, domain, param, param_size);
if (ret) {
ret = AVS_IPC_RET(ret);
goto err_ipc;
}
*instance_id = id;
return 0;
err_ipc:
if (was_loaded)
avs_dsp_op(adev, transfer_mods, false, &mentry, 1);
avs_dsp_put_core(adev, core_id);
err_mod_entry:
avs_module_id_free(adev, module_id, id);
return ret;
}
void avs_dsp_delete_module(struct avs_dev *adev, u16 module_id, u8 instance_id,
u8 ppl_instance_id, u8 core_id)
{
struct avs_module_entry mentry;
int ret;
/* Modules not owned by any pipeline need to be freed explicitly. */
if (ppl_instance_id == INVALID_PIPELINE_ID)
avs_ipc_delete_instance(adev, module_id, instance_id);
avs_module_id_free(adev, module_id, instance_id);
ret = avs_get_module_id_entry(adev, module_id, &mentry);
/* Unload occupied memory if this was the last instance. */
if (!ret && mentry.type.load_type == AVS_MODULE_LOAD_TYPE_LOADABLE) {
if (avs_is_module_ida_empty(adev, module_id)) {
ret = avs_dsp_op(adev, transfer_mods, false, &mentry, 1);
if (ret)
dev_err(adev->dev, "unload modules failed: %d\n", ret);
}
}
avs_dsp_put_core(adev, core_id);
}
int avs_dsp_create_pipeline(struct avs_dev *adev, u16 req_size, u8 priority,
bool lp, u16 attributes, u8 *instance_id)
{
struct avs_fw_cfg *fw_cfg = &adev->fw_cfg;
int ret, id;
id = ida_alloc_max(&adev->ppl_ida, fw_cfg->max_ppl_count - 1, GFP_KERNEL);
if (id < 0)
return id;
ret = avs_ipc_create_pipeline(adev, req_size, priority, id, lp, attributes);
if (ret) {
ida_free(&adev->ppl_ida, id);
return AVS_IPC_RET(ret);
}
*instance_id = id;
return 0;
}
int avs_dsp_delete_pipeline(struct avs_dev *adev, u8 instance_id)
{
int ret;
ret = avs_ipc_delete_pipeline(adev, instance_id);
if (ret)
ret = AVS_IPC_RET(ret);
ida_free(&adev->ppl_ida, instance_id);
return ret;
}
Annotation
- Immediate include surface: `linux/string_choices.h`, `sound/hdaudio_ext.h`, `avs.h`, `registers.h`, `trace.h`.
- Detected declarations: `function avs_dsp_core_power`, `function avs_dsp_core_reset`, `function avs_dsp_core_stall`, `function avs_dsp_core_enable`, `function avs_dsp_core_disable`, `function avs_dsp_enable`, `function avs_dsp_disable`, `function avs_dsp_get_core`, `function avs_dsp_put_core`, `function avs_dsp_init_module`.
- 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.