sound/soc/sdw_utils/soc_sdw_rt_mf_sdca.c
Source file repositories/reference/linux-study-clean/sound/soc/sdw_utils/soc_sdw_rt_mf_sdca.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sdw_utils/soc_sdw_rt_mf_sdca.c- Extension
.c- Size
- 2465 bytes
- Lines
- 85
- 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/soundwire/sdw.hlinux/soundwire/sdw_type.hsound/control.hsound/soc.hsound/soc-acpi.hsound/soc-dapm.hsound/soc_sdw_utils.h
Detected Declarations
struct codec_route_mapfunction asoc_sdw_rt_mf_sdca_spk_rtd_init
Annotated Snippet
struct codec_route_map {
const char *codec_name;
const struct snd_soc_dapm_route *route_map;
size_t route_size;
};
/* Codec route maps array */
static const struct codec_route_map codec_routes[] = {
{ "rt712", rt712_spk_map, ARRAY_SIZE(rt712_spk_map) },
{ "rt721", rt721_spk_map, ARRAY_SIZE(rt721_spk_map) },
{ "rt722", rt722_spk_map, ARRAY_SIZE(rt722_spk_map) },
};
static const struct codec_route_map *get_codec_route_map(const char *codec_name)
{
for (size_t i = 0; i < ARRAY_SIZE(codec_routes); i++) {
if (strcmp(codec_routes[i].codec_name, codec_name) == 0)
return &codec_routes[i];
}
return NULL;
}
int asoc_sdw_rt_mf_sdca_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai)
{
struct snd_soc_card *card = rtd->card;
struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
char codec_name[CODEC_NAME_SIZE];
int ret;
/* acquire codec name */
snprintf(codec_name, CODEC_NAME_SIZE, "%s", dai->name);
/* acquire corresponding route map and size */
const struct codec_route_map *route_map = get_codec_route_map(codec_name);
if (!route_map) {
dev_err(rtd->dev, "failed to get codec name and route map\n");
return -EINVAL;
}
/* Add routes */
ret = snd_soc_dapm_add_routes(dapm, route_map->route_map, route_map->route_size);
if (ret)
dev_err(rtd->dev, "failed to add rt sdca spk map: %d\n", ret);
return ret;
}
EXPORT_SYMBOL_NS(asoc_sdw_rt_mf_sdca_spk_rtd_init, "SND_SOC_SDW_UTILS");
Annotation
- Immediate include surface: `linux/device.h`, `linux/errno.h`, `linux/soundwire/sdw.h`, `linux/soundwire/sdw_type.h`, `sound/control.h`, `sound/soc.h`, `sound/soc-acpi.h`, `sound/soc-dapm.h`.
- Detected declarations: `struct codec_route_map`, `function asoc_sdw_rt_mf_sdca_spk_rtd_init`.
- 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.