sound/soc/soc-compress.c
Source file repositories/reference/linux-study-clean/sound/soc/soc-compress.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/soc-compress.c- Extension
.c- Size
- 18000 bytes
- Lines
- 676
- 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/kernel.hlinux/init.hlinux/delay.hlinux/slab.hlinux/workqueue.hsound/core.hsound/compress_params.hsound/compress_driver.hsound/soc.hsound/initval.hsound/soc-dpcm.hsound/soc-link.h
Detected Declarations
function snd_soc_compr_components_openfunction for_each_rtd_componentsfunction snd_soc_compr_components_freefunction for_each_rtd_componentsfunction soc_compr_cleanfunction soc_compr_freefunction soc_compr_openfunction soc_compr_open_fefunction soc_compr_free_fefunction soc_compr_triggerfunction soc_compr_trigger_fefunction soc_compr_set_paramsfunction soc_compr_set_params_fefunction soc_compr_get_paramsfunction soc_compr_ackfunction soc_compr_pointerfunction soc_compr_set_metadatafunction soc_compr_get_metadatafunction snd_soc_new_compressfunction for_each_rtd_componentsexport snd_soc_new_compress
Annotated Snippet
if (ret < 0) {
dev_err(rtd->card->dev,
"Compress ASoC: can't create compressed for %s: %d\n",
rtd->dai_link->name, ret);
return ret;
}
/* inherit atomicity from DAI link */
be_pcm->nonatomic = rtd->dai_link->nonatomic;
rtd->pcm = be_pcm;
rtd->fe_compr = 1;
if (playback)
be_pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd;
if (capture)
be_pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd;
memcpy(compr->ops, &soc_compr_dyn_ops, sizeof(soc_compr_dyn_ops));
} else {
snprintf(new_name, sizeof(new_name), "%s %s-%d",
rtd->dai_link->stream_name, codec_dai->name, rtd->id);
memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops));
}
for_each_rtd_components(rtd, i, component) {
if (!component->driver->compress_ops ||
!component->driver->compress_ops->copy)
continue;
compr->ops->copy = snd_soc_component_compr_copy;
break;
}
ret = snd_compress_new(rtd->card->snd_card, rtd->id, direction,
new_name, compr);
if (ret < 0) {
component = snd_soc_rtd_to_codec(rtd, 0)->component;
dev_err(component->dev,
"Compress ASoC: can't create compress for codec %s: %d\n",
component->name, ret);
return ret;
}
/* DAPM dai link stream work */
rtd->close_delayed_work_func = snd_soc_close_delayed_work;
rtd->compr = compr;
compr->private_data = rtd;
dev_dbg(rtd->card->dev, "Compress ASoC: %s <-> %s mapping ok\n",
codec_dai->name, cpu_dai->name);
return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_new_compress);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/delay.h`, `linux/slab.h`, `linux/workqueue.h`, `sound/core.h`, `sound/compress_params.h`, `sound/compress_driver.h`.
- Detected declarations: `function snd_soc_compr_components_open`, `function for_each_rtd_components`, `function snd_soc_compr_components_free`, `function for_each_rtd_components`, `function soc_compr_clean`, `function soc_compr_free`, `function soc_compr_open`, `function soc_compr_open_fe`, `function soc_compr_free_fe`, `function soc_compr_trigger`.
- 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.