sound/soc/intel/common/sof-function-topology-lib.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/common/sof-function-topology-lib.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/common/sof-function-topology-lib.c- Extension
.c- Size
- 4333 bytes
- Lines
- 153
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/errno.hlinux/firmware.hsound/soc.hsound/soc-acpi.hsof-function-topology-lib.h
Detected Declarations
enum tplg_device_idfunction BITfunction for_each_card_prelinksexport sof_sdw_get_tplg_files
Annotated Snippet
if (strstr(dai_link->name, "SimpleJack")) {
tplg_dev = TPLG_DEVICE_SDCA_JACK;
tplg_dev_name = "sdca-jack";
} else if (strstr(dai_link->name, "SmartAmp")) {
tplg_dev = TPLG_DEVICE_SDCA_AMP;
tplg_dev_name = devm_kasprintf(card->dev, GFP_KERNEL,
"sdca-%damp", dai_link->num_cpus);
if (!tplg_dev_name)
return -ENOMEM;
} else if (strstr(dai_link->name, "SmartMic")) {
tplg_dev = TPLG_DEVICE_SDCA_MIC;
tplg_dev_name = "sdca-mic";
} else if (strstr(dai_link->name, "dmic")) {
switch (mach_params.dmic_num) {
case 2:
tplg_dev_name = "dmic-2ch";
break;
case 4:
tplg_dev_name = "dmic-4ch";
break;
default:
dev_warn(card->dev,
"unsupported number of dmics: %d\n",
mach_params.dmic_num);
continue;
}
tplg_dev = TPLG_DEVICE_INTEL_PCH_DMIC;
} else if (strstr(dai_link->name, "iDisp")) {
tplg_dev = TPLG_DEVICE_HDMI;
tplg_dev_name = "hdmi-pcm5";
} else if (strstr(dai_link->name, "Loopback_Virtual")) {
tplg_dev = TPLG_DEVICE_LOOPBACK_VIRTUAL;
/*
* Mark the LOOPBACK_VIRTUAL device but no need to create the
* LOOPBACK_VIRTUAL topology. Just to avoid the dai_link is not supported
* error.
*/
tplg_mask |= BIT(tplg_dev);
continue;
} else {
/* The dai link is not supported by separated tplg yet */
dev_dbg(card->dev,
"dai_link %s is not supported by separated tplg yet\n",
dai_link->name);
if (best_effort)
continue;
return 0;
}
if (tplg_mask & BIT(tplg_dev))
continue;
tplg_mask |= BIT(tplg_dev);
/*
* The tplg file naming rule is sof-<platform>-<function>-id<BE id number>.tplg
* where <platform> is only required for the DMIC function as the nhlt blob
* is platform dependent.
*/
switch (tplg_dev) {
case TPLG_DEVICE_INTEL_PCH_DMIC:
(*tplg_files)[tplg_num] = devm_kasprintf(card->dev, GFP_KERNEL,
"%s/sof-%s-%s-id%d.tplg",
prefix, platform,
tplg_dev_name, dai_link->id);
break;
default:
(*tplg_files)[tplg_num] = devm_kasprintf(card->dev, GFP_KERNEL,
"%s/sof-%s-id%d.tplg",
prefix, tplg_dev_name,
dai_link->id);
break;
}
if (!(*tplg_files)[tplg_num])
return -ENOMEM;
tplg_num++;
}
dev_dbg(card->dev, "tplg_mask %#lx tplg_num %d\n", tplg_mask, tplg_num);
/* Check presence of sub-topologies */
for (i = 0; i < tplg_num; i++) {
ret = firmware_request_nowarn(&fw, (*tplg_files)[i], card->dev);
if (!ret) {
release_firmware(fw);
} else {
dev_warn(card->dev,
"Failed to open topology file: %s, you might need to\n",
(*tplg_files)[i]);
dev_warn(card->dev,
Annotation
- Immediate include surface: `linux/device.h`, `linux/errno.h`, `linux/firmware.h`, `sound/soc.h`, `sound/soc-acpi.h`, `sof-function-topology-lib.h`.
- Detected declarations: `enum tplg_device_id`, `function BIT`, `function for_each_card_prelinks`, `export sof_sdw_get_tplg_files`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration 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.