sound/soc/intel/avs/pcm.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/avs/pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/avs/pcm.c- Extension
.c- Size
- 49436 bytes
- Lines
- 1774
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/debugfs.hlinux/device.hsound/hda_register.hsound/hdaudio_ext.hsound/pcm_params.hsound/soc-acpi.hsound/soc-acpi-intel-match.hsound/soc-component.havs.hpath.hpcm.htopology.hutils.h../../codecs/hda.h
Detected Declarations
struct avs_dma_datafunction avs_dai_find_path_templatefunction avs_period_elapsed_workfunction avs_period_elapsedfunction avs_hw_constraints_initfunction avs_dai_startupfunction avs_dai_shutdownfunction avs_dai_hw_paramsfunction avs_dai_be_hw_paramsfunction avs_dai_preparefunction avs_dai_nonhda_be_hw_paramsfunction avs_dai_nonhda_be_hw_freefunction avs_dai_nonhda_be_triggerfunction __avs_dai_hda_be_startupfunction avs_dai_hda_be_startupfunction avs_dai_i2shda_be_startupfunction avs_dai_dmichda_be_startupfunction avs_dai_hda_be_shutdownfunction avs_dai_althda_be_shutdownfunction avs_dai_hda_be_hw_paramsfunction avs_dai_hda_be_hw_freefunction avs_dai_hda_be_preparefunction avs_dai_hda_be_triggerfunction hw_rule_param_sizefunction avs_pcm_hw_constraints_initfunction avs_dai_fe_startupfunction avs_dai_fe_shutdownfunction avs_dai_fe_hw_paramsfunction __avs_dai_fe_hw_freefunction avs_dai_fe_hw_freefunction avs_dai_fe_preparefunction avs_hda_stream_startfunction list_for_each_entryfunction avs_hda_stream_stopfunction list_for_each_entryfunction avs_dai_fe_triggerfunction topology_name_readfunction avs_component_load_librariesfunction avs_component_probefunction avs_component_removefunction avs_dai_resume_hw_paramsfunction avs_dai_resume_fe_preparefunction avs_dai_resume_be_preparefunction avs_dai_suspend_fe_hw_freefunction avs_dai_suspend_be_hw_freefunction avs_component_pm_opfunction for_each_component_daisfunction avs_component_resume_hw_params
Annotated Snippet
static const struct file_operations topology_name_fops = {
.open = simple_open,
.read = topology_name_read,
.llseek = default_llseek,
};
static int avs_component_load_libraries(struct avs_soc_component *acomp)
{
struct avs_tplg *tplg = acomp->tplg;
struct avs_dev *adev = to_avs_dev(acomp->base.dev);
int ret;
if (!tplg->num_libs)
return 0;
/* Parent device may be asleep and library loading involves IPCs. */
ret = pm_runtime_resume_and_get(adev->dev);
if (ret < 0)
return ret;
avs_hda_power_gating_enable(adev, false);
avs_hda_clock_gating_enable(adev, false);
avs_hda_l1sen_enable(adev, false);
ret = avs_dsp_load_libraries(adev, tplg->libs, tplg->num_libs);
avs_hda_l1sen_enable(adev, true);
avs_hda_clock_gating_enable(adev, true);
avs_hda_power_gating_enable(adev, true);
if (!ret)
ret = avs_module_info_init(adev, false);
pm_runtime_put_autosuspend(adev->dev);
return ret;
}
static int avs_component_probe(struct snd_soc_component *component)
{
struct snd_soc_card *card = component->card;
struct snd_soc_acpi_mach *mach;
struct avs_soc_component *acomp;
struct avs_dev *adev;
char *filename;
int ret;
dev_dbg(card->dev, "probing %s card %s\n", component->name, card->name);
mach = dev_get_platdata(card->dev);
acomp = to_avs_soc_component(component);
adev = to_avs_dev(component->dev);
acomp->tplg = avs_tplg_new(component);
if (!acomp->tplg)
return -ENOMEM;
if (!mach->tplg_filename)
goto finalize;
/* Load specified topology and create debugfs for it. */
filename = kasprintf(GFP_KERNEL, "%s/%s", component->driver->topology_name_prefix,
mach->tplg_filename);
if (!filename)
return -ENOMEM;
ret = avs_load_topology(component, filename);
kfree(filename);
if (ret == -ENOENT && !strncmp(mach->tplg_filename, "hda-", 4)) {
unsigned int vendor_id;
if (sscanf(mach->tplg_filename, "hda-%08x-tplg.bin", &vendor_id) != 1)
return ret;
if (((vendor_id >> 16) & 0xFFFF) == 0x8086)
mach->tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL,
"hda-8086-generic-tplg.bin");
else
mach->tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL,
"hda-generic-tplg.bin");
if (!mach->tplg_filename)
return -ENOMEM;
filename = kasprintf(GFP_KERNEL, "%s/%s", component->driver->topology_name_prefix,
mach->tplg_filename);
if (!filename)
return -ENOMEM;
dev_info(card->dev, "trying to load fallback topology %s\n", mach->tplg_filename);
ret = avs_load_topology(component, filename);
kfree(filename);
}
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/device.h`, `sound/hda_register.h`, `sound/hdaudio_ext.h`, `sound/pcm_params.h`, `sound/soc-acpi.h`, `sound/soc-acpi-intel-match.h`, `sound/soc-component.h`.
- Detected declarations: `struct avs_dma_data`, `function avs_dai_find_path_template`, `function avs_period_elapsed_work`, `function avs_period_elapsed`, `function avs_hw_constraints_init`, `function avs_dai_startup`, `function avs_dai_shutdown`, `function avs_dai_hw_params`, `function avs_dai_be_hw_params`, `function avs_dai_prepare`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: pattern 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.