sound/soc/generic/simple-card.c
Source file repositories/reference/linux-study-clean/sound/soc/generic/simple-card.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/generic/simple-card.c- Extension
.c- Size
- 20481 bytes
- Lines
- 787
- 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/cleanup.hlinux/clk.hlinux/device.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/string.hsound/simple_card_utils.hsound/soc.hsound/soc-dai.h
Detected Declarations
function _simple_retfunction simple_parse_platformfunction simple_parse_daifunction simple_parse_convertfunction simple_parse_nodefunction simple_link_initfunction simple_dai_link_of_dpcmfunction simple_dai_link_offunction __simple_for_each_linkfunction for_each_child_of_node_scopedfunction for_each_child_of_node_scopedfunction simple_for_each_linkfunction simple_depopulate_auxfunction simple_populate_auxfunction simple_parse_offunction simple_count_nomlfunction simple_count_dpcmfunction simple_get_dais_countfunction simple_soc_probefunction simple_probe
Annotated Snippet
if (fallback_dai_name) {
fallback_dai_name = devm_kstrdup_const(dev, fallback_dai_name,
GFP_KERNEL);
ret = -ENOMEM;
if (!fallback_dai_name) {
of_node_put(resolved_dlc.of_node);
goto end;
}
}
dlc->of_node = resolved_dlc.of_node;
dlc->dai_name = fallback_dai_name;
dlc->dai_args = resolved_dlc.dai_args;
}
if (is_single_link)
*is_single_link = !args.args_count;
ret = 0;
end:
return simple_ret(priv, ret);
}
static void simple_parse_convert(struct device *dev,
struct device_node *np,
struct simple_util_data *adata)
{
struct device_node *top = dev->of_node;
struct device_node *node __free(device_node) = of_get_parent(np);
simple_util_parse_convert(top, PREFIX, adata);
simple_util_parse_convert(node, PREFIX, adata);
simple_util_parse_convert(node, NULL, adata);
simple_util_parse_convert(np, NULL, adata);
}
static int simple_parse_node(struct simple_util_priv *priv,
struct device_node *np,
struct link_info *li,
char *prefix,
int *cpu)
{
struct device *dev = simple_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link);
struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link);
struct snd_soc_dai_link_component *dlc;
struct simple_util_dai *dai;
int ret;
if (cpu) {
dlc = snd_soc_link_to_cpu(dai_link, 0);
dai = simple_props_to_dai_cpu(dai_props, 0);
} else {
dlc = snd_soc_link_to_codec(dai_link, 0);
dai = simple_props_to_dai_codec(dai_props, 0);
}
ret = simple_parse_dai(priv, np, dlc, cpu);
if (ret)
goto end;
ret = simple_util_parse_clk(dev, np, dai, dlc);
if (ret)
goto end;
ret = simple_util_parse_tdm(np, dai);
end:
return simple_ret(priv, ret);
}
static int simple_link_init(struct simple_util_priv *priv,
struct device_node *cpu,
struct device_node *codec,
struct link_info *li,
char *prefix, char *name)
{
struct device *dev = simple_priv_to_dev(priv);
struct device_node *top = dev->of_node;
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link);
struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link);
struct device_node *node __free(device_node) = of_get_parent(cpu);
enum snd_soc_trigger_order trigger_start = SND_SOC_TRIGGER_ORDER_DEFAULT;
enum snd_soc_trigger_order trigger_stop = SND_SOC_TRIGGER_ORDER_DEFAULT;
bool playback_only = 0, capture_only = 0;
int ret;
ret = simple_util_parse_daifmt(dev, node, codec,
prefix, &dai_link->dai_fmt);
if (ret < 0)
goto end;
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/clk.h`, `linux/device.h`, `linux/module.h`, `linux/of.h`, `linux/of_platform.h`, `linux/platform_device.h`, `linux/string.h`.
- Detected declarations: `function _simple_ret`, `function simple_parse_platform`, `function simple_parse_dai`, `function simple_parse_convert`, `function simple_parse_node`, `function simple_link_init`, `function simple_dai_link_of_dpcm`, `function simple_dai_link_of`, `function __simple_for_each_link`, `function for_each_child_of_node_scoped`.
- 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.