sound/soc/amd/acp/acp-sdw-legacy-mach.c
Source file repositories/reference/linux-study-clean/sound/soc/amd/acp/acp-sdw-legacy-mach.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/amd/acp/acp-sdw-legacy-mach.c- Extension
.c- Size
- 16040 bytes
- Lines
- 605
- 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.
- 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/bitmap.hlinux/device.hlinux/dmi.hlinux/module.hlinux/soundwire/sdw.hlinux/soundwire/sdw_type.hsound/soc.hsound/soc-acpi.hsoc_amd_sdw_common.h../../codecs/rt711.h
Detected Declarations
function log_quirksfunction soc_sdw_quirk_cbfunction create_sdw_dailinkfunction list_for_each_entryfunction for_each_pcm_streamsfunction list_for_each_entryfunction list_for_each_entryfunction create_sdw_dailinksfunction create_dmic_dailinksfunction soc_card_dai_links_createfunction mc_probefunction mc_remove
Annotated Snippet
if (soc_end->name_prefix) {
(*codec_conf)->dlc.name = soc_end->codec_name;
(*codec_conf)->name_prefix = soc_end->name_prefix;
(*codec_conf)++;
}
if (soc_end->include_sidecar) {
ret = soc_end->codec_info->add_sidecar(card, dai_links, codec_conf);
if (ret)
return ret;
}
}
for_each_pcm_streams(stream) {
static const char * const sdw_stream_name[] = {
"SDW%d-PIN%d-PLAYBACK",
"SDW%d-PIN%d-CAPTURE",
"SDW%d-PIN%d-PLAYBACK-%s",
"SDW%d-PIN%d-CAPTURE-%s",
};
struct snd_soc_dai_link_ch_map *codec_maps;
struct snd_soc_dai_link_component *codecs;
struct snd_soc_dai_link_component *cpus;
int num_cpus = hweight32(soc_dai->link_mask[stream]);
int num_codecs = soc_dai->num_devs[stream];
int playback, capture;
int j = 0;
char *name;
if (!soc_dai->num_devs[stream])
continue;
soc_end = list_first_entry(&soc_dai->endpoints,
struct asoc_sdw_endpoint, list);
*be_id = soc_end->dai_info->dailink[stream];
if (*be_id < 0) {
dev_err(dev, "Invalid dailink id %d\n", *be_id);
return -EINVAL;
}
switch (amd_ctx->acp_rev) {
case ACP63_PCI_REV:
ret = get_acp63_cpu_pin_id(ffs(soc_end->link_mask - 1),
*be_id, &cpu_pin_id, dev);
if (ret)
return ret;
break;
case ACP70_PCI_REV:
case ACP71_PCI_REV:
case ACP72_PCI_REV:
ret = get_acp70_cpu_pin_id(ffs(soc_end->link_mask - 1),
*be_id, &cpu_pin_id, dev);
if (ret)
return ret;
break;
default:
return -EINVAL;
}
/* create stream name according to first link id */
if (ctx->append_dai_type) {
name = devm_kasprintf(dev, GFP_KERNEL,
sdw_stream_name[stream + 2],
ffs(soc_end->link_mask) - 1,
cpu_pin_id,
type_strings[soc_end->dai_info->dai_type]);
} else {
name = devm_kasprintf(dev, GFP_KERNEL,
sdw_stream_name[stream],
ffs(soc_end->link_mask) - 1,
cpu_pin_id);
}
if (!name)
return -ENOMEM;
cpus = devm_kcalloc(dev, num_cpus, sizeof(*cpus), GFP_KERNEL);
if (!cpus)
return -ENOMEM;
codecs = devm_kcalloc(dev, num_codecs, sizeof(*codecs), GFP_KERNEL);
if (!codecs)
return -ENOMEM;
codec_maps = devm_kcalloc(dev, num_codecs, sizeof(*codec_maps), GFP_KERNEL);
if (!codec_maps)
return -ENOMEM;
list_for_each_entry(soc_end, &soc_dai->endpoints, list) {
if (!soc_end->dai_info->direction[stream])
continue;
Annotation
- Immediate include surface: `linux/bitmap.h`, `linux/device.h`, `linux/dmi.h`, `linux/module.h`, `linux/soundwire/sdw.h`, `linux/soundwire/sdw_type.h`, `sound/soc.h`, `sound/soc-acpi.h`.
- Detected declarations: `function log_quirks`, `function soc_sdw_quirk_cb`, `function create_sdw_dailink`, `function list_for_each_entry`, `function for_each_pcm_streams`, `function list_for_each_entry`, `function list_for_each_entry`, `function create_sdw_dailinks`, `function create_dmic_dailinks`, `function soc_card_dai_links_create`.
- 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.