sound/soc/sdca/sdca_functions.c
Source file repositories/reference/linux-study-clean/sound/soc/sdca/sdca_functions.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sdca/sdca_functions.c- Extension
.c- Size
- 73196 bytes
- Lines
- 2349
- 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.
- 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/acpi.hlinux/byteorder/generic.hlinux/cleanup.hlinux/device.hlinux/dev_printk.hlinux/module.hlinux/property.hlinux/soundwire/sdw.hlinux/string.hlinux/types.hsound/sdca.hsound/sdca_function.hsound/sdca_hid.h
Detected Declarations
struct raw_init_writestruct raw_ge_modefunction patch_sdca_function_typefunction find_sdca_functionfunction descriptorfunction find_sdca_init_tablefunction find_sdca_control_bitsfunction find_sdca_control_datatypefunction find_sdca_control_volatilefunction find_sdca_control_rangefunction find_sdca_control_valuefunction BITS_PER_TYPEfunction find_sdca_control_resetfunction find_sdca_entity_controlfunction find_sdca_entity_controlsfunction BITS_PER_TYPEfunction find_sdca_iot_dataportfunction find_sdca_entity_iotfunction find_sdca_entity_csfunction find_sdca_entity_pdefunction find_sdca_entity_gefunction find_sdca_entity_hidefunction find_sdca_entity_xufunction find_sdca_entityfunction find_sdca_entitiesfunction find_sdca_entity_connection_iotfunction find_sdca_entity_connection_pdefunction find_sdca_entity_connection_gefunction find_sdca_entity_connectionfunction find_sdca_connectionsfunction find_sdca_cluster_channelfunction find_sdca_cluster_channelsfunction find_sdca_clustersfunction find_sdca_filesetsfunction sdca_parse_function
Annotated Snippet
struct raw_init_write {
__le32 addr;
u8 val;
} __packed;
static int find_sdca_init_table(struct device *dev,
struct fwnode_handle *function_node,
struct sdca_function_data *function)
{
struct raw_init_write *raw __free(kfree) = NULL;
struct sdca_init_write *init_write;
int i, num_init_writes;
num_init_writes = fwnode_property_count_u8(function_node,
"mipi-sdca-function-initialization-table");
if (!num_init_writes || num_init_writes == -EINVAL) {
return 0;
} else if (num_init_writes < 0) {
dev_err(dev, "%pfwP: failed to read initialization table: %d\n",
function_node, num_init_writes);
return num_init_writes;
} else if (num_init_writes % sizeof(*raw) != 0) {
dev_err(dev, "%pfwP: init table size invalid\n", function_node);
return -EINVAL;
}
raw = kzalloc(num_init_writes, GFP_KERNEL);
if (!raw)
return -ENOMEM;
fwnode_property_read_u8_array(function_node,
"mipi-sdca-function-initialization-table",
(u8 *)raw, num_init_writes);
num_init_writes /= sizeof(*raw);
init_write = devm_kcalloc(dev, num_init_writes, sizeof(*init_write), GFP_KERNEL);
if (!init_write)
return -ENOMEM;
for (i = 0; i < num_init_writes; i++) {
init_write[i].addr = le32_to_cpu(raw[i].addr);
init_write[i].val = raw[i].val;
}
function->num_init_table = num_init_writes;
function->init_table = init_write;
return 0;
}
static const char *find_sdca_control_label(struct device *dev,
const struct sdca_entity *entity,
const struct sdca_control *control)
{
switch (SDCA_CTL_TYPE(entity->type, control->sel)) {
case SDCA_CTL_TYPE_S(IT, MIC_BIAS):
return SDCA_CTL_MIC_BIAS_NAME;
case SDCA_CTL_TYPE_S(IT, USAGE):
case SDCA_CTL_TYPE_S(OT, USAGE):
return SDCA_CTL_USAGE_NAME;
case SDCA_CTL_TYPE_S(IT, LATENCY):
case SDCA_CTL_TYPE_S(OT, LATENCY):
case SDCA_CTL_TYPE_S(MU, LATENCY):
case SDCA_CTL_TYPE_S(SU, LATENCY):
case SDCA_CTL_TYPE_S(FU, LATENCY):
case SDCA_CTL_TYPE_S(XU, LATENCY):
case SDCA_CTL_TYPE_S(CRU, LATENCY):
case SDCA_CTL_TYPE_S(UDMPU, LATENCY):
case SDCA_CTL_TYPE_S(MFPU, LATENCY):
case SDCA_CTL_TYPE_S(SMPU, LATENCY):
case SDCA_CTL_TYPE_S(SAPU, LATENCY):
case SDCA_CTL_TYPE_S(PPU, LATENCY):
return SDCA_CTL_LATENCY_NAME;
case SDCA_CTL_TYPE_S(IT, CLUSTERINDEX):
case SDCA_CTL_TYPE_S(CRU, CLUSTERINDEX):
case SDCA_CTL_TYPE_S(UDMPU, CLUSTERINDEX):
case SDCA_CTL_TYPE_S(MFPU, CLUSTERINDEX):
return SDCA_CTL_CLUSTERINDEX_NAME;
case SDCA_CTL_TYPE_S(IT, DATAPORT_SELECTOR):
case SDCA_CTL_TYPE_S(OT, DATAPORT_SELECTOR):
return SDCA_CTL_DATAPORT_SELECTOR_NAME;
case SDCA_CTL_TYPE_S(IT, MATCHING_GUID):
case SDCA_CTL_TYPE_S(OT, MATCHING_GUID):
case SDCA_CTL_TYPE_S(ENTITY_0, MATCHING_GUID):
return SDCA_CTL_MATCHING_GUID_NAME;
case SDCA_CTL_TYPE_S(IT, KEEP_ALIVE):
case SDCA_CTL_TYPE_S(OT, KEEP_ALIVE):
return SDCA_CTL_KEEP_ALIVE_NAME;
case SDCA_CTL_TYPE_S(IT, NDAI_STREAM):
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/byteorder/generic.h`, `linux/cleanup.h`, `linux/device.h`, `linux/dev_printk.h`, `linux/module.h`, `linux/property.h`, `linux/soundwire/sdw.h`.
- Detected declarations: `struct raw_init_write`, `struct raw_ge_mode`, `function patch_sdca_function_type`, `function find_sdca_function`, `function descriptor`, `function find_sdca_init_table`, `function find_sdca_control_bits`, `function find_sdca_control_datatype`, `function find_sdca_control_volatile`, `function find_sdca_control_range`.
- 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.