sound/soc/soc-acpi.c
Source file repositories/reference/linux-study-clean/sound/soc/soc-acpi.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/soc-acpi.c- Extension
.c- Size
- 5379 bytes
- Lines
- 205
- 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/export.hlinux/module.hsound/soc-acpi.h
Detected Declarations
function snd_soc_acpi_id_presentfunction snd_soc_acpi_find_machinefunction snd_soc_acpi_find_packagefunction snd_soc_acpi_find_package_from_hidfunction snd_soc_acpi_sdw_link_slaves_foundexport snd_soc_acpi_find_machineexport snd_soc_acpi_find_package_from_hidexport snd_soc_acpi_codec_listexport snd_soc_acpi_sdw_link_slaves_found
Annotated Snippet
if (acpi_dev_present(comp_ids->codecs[i], NULL, -1)) {
strscpy(machine->id, comp_ids->codecs[i], ACPI_ID_LEN);
return true;
}
}
}
return false;
}
struct snd_soc_acpi_mach *
snd_soc_acpi_find_machine(struct snd_soc_acpi_mach *machines)
{
struct snd_soc_acpi_mach *mach;
struct snd_soc_acpi_mach *mach_alt;
for (mach = machines; mach->id[0] || mach->comp_ids; mach++) {
if (snd_soc_acpi_id_present(mach)) {
if (mach->machine_quirk) {
mach_alt = mach->machine_quirk(mach);
if (!mach_alt)
continue; /* not full match, ignore */
mach = mach_alt;
}
return mach;
}
}
return NULL;
}
EXPORT_SYMBOL_GPL(snd_soc_acpi_find_machine);
static acpi_status snd_soc_acpi_find_package(acpi_handle handle, u32 level,
void *context, void **ret)
{
struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
acpi_status status;
struct snd_soc_acpi_package_context *pkg_ctx = context;
pkg_ctx->data_valid = false;
if (adev && adev->status.present && adev->status.functional) {
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
union acpi_object *myobj = NULL;
status = acpi_evaluate_object_typed(handle, pkg_ctx->name,
NULL, &buffer,
ACPI_TYPE_PACKAGE);
if (ACPI_FAILURE(status))
return AE_OK;
myobj = buffer.pointer;
if (!myobj || myobj->package.count != pkg_ctx->length) {
kfree(buffer.pointer);
return AE_OK;
}
status = acpi_extract_package(myobj,
pkg_ctx->format, pkg_ctx->state);
if (ACPI_FAILURE(status)) {
kfree(buffer.pointer);
return AE_OK;
}
kfree(buffer.pointer);
pkg_ctx->data_valid = true;
return AE_CTRL_TERMINATE;
}
return AE_OK;
}
bool snd_soc_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
struct snd_soc_acpi_package_context *ctx)
{
acpi_status status;
status = acpi_get_devices(hid, snd_soc_acpi_find_package, ctx, NULL);
if (ACPI_FAILURE(status) || !ctx->data_valid)
return false;
return true;
}
EXPORT_SYMBOL_GPL(snd_soc_acpi_find_package_from_hid);
struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg)
{
struct snd_soc_acpi_mach *mach = arg;
struct snd_soc_acpi_codecs *codec_list =
Annotation
- Immediate include surface: `linux/export.h`, `linux/module.h`, `sound/soc-acpi.h`.
- Detected declarations: `function snd_soc_acpi_id_present`, `function snd_soc_acpi_find_machine`, `function snd_soc_acpi_find_package`, `function snd_soc_acpi_find_package_from_hid`, `function snd_soc_acpi_sdw_link_slaves_found`, `export snd_soc_acpi_find_machine`, `export snd_soc_acpi_find_package_from_hid`, `export snd_soc_acpi_codec_list`, `export snd_soc_acpi_sdw_link_slaves_found`.
- 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.