sound/soc/meson/meson-card-utils.c
Source file repositories/reference/linux-study-clean/sound/soc/meson/meson-card-utils.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/meson/meson-card-utils.c- Extension
.c- Size
- 7748 bytes
- Lines
- 335
- 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/module.hlinux/of_platform.hsound/soc.hmeson-card.h
Detected Declarations
function meson_card_i2s_set_sysclkfunction for_each_rtd_codec_daisfunction meson_card_reallocate_linksfunction meson_card_parse_daifunction meson_card_set_link_namefunction meson_card_parse_daifmtfunction meson_card_set_be_linkfunction for_each_child_of_node_scopedfunction meson_card_set_fe_linkfunction meson_card_add_linksfunction meson_card_parse_of_optionalfunction meson_card_clean_referencesfunction meson_card_probefunction meson_card_removeexport meson_card_i2s_set_sysclkexport meson_card_reallocate_linksexport meson_card_parse_daiexport meson_card_parse_daifmtexport meson_card_set_be_linkexport meson_card_set_fe_linkexport meson_card_probeexport meson_card_remove
Annotated Snippet
for_each_card_prelinks(card, i, link) {
if (link->cpus)
of_node_put(link->cpus->of_node);
for_each_link_codecs(link, j, codec)
of_node_put(codec->of_node);
}
}
if (card->aux_dev) {
for_each_card_pre_auxs(card, i, aux)
of_node_put(aux->dlc.of_node);
}
kfree(card->dai_link);
kfree(priv->link_data);
}
int meson_card_probe(struct platform_device *pdev)
{
const struct meson_card_match_data *data;
struct device *dev = &pdev->dev;
struct meson_card *priv;
int ret;
data = of_device_get_match_data(dev);
if (!data) {
dev_err(dev, "failed to match device\n");
return -ENODEV;
}
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
platform_set_drvdata(pdev, priv);
snd_soc_card_set_drvdata(&priv->card, priv);
priv->card.owner = THIS_MODULE;
priv->card.dev = dev;
priv->card.driver_name = dev->driver->name;
priv->match_data = data;
ret = snd_soc_of_parse_card_name(&priv->card, "model");
if (ret < 0)
return ret;
ret = meson_card_parse_of_optional(&priv->card, "audio-routing",
snd_soc_of_parse_audio_routing);
if (ret) {
dev_err(dev, "error while parsing routing\n");
return ret;
}
ret = meson_card_parse_of_optional(&priv->card, "audio-widgets",
snd_soc_of_parse_audio_simple_widgets);
if (ret) {
dev_err(dev, "error while parsing widgets\n");
return ret;
}
ret = meson_card_add_links(&priv->card);
if (ret)
goto out_err;
ret = snd_soc_of_parse_aux_devs(&priv->card, "audio-aux-devs");
if (ret)
goto out_err;
ret = devm_snd_soc_register_card(dev, &priv->card);
if (ret)
goto out_err;
return 0;
out_err:
meson_card_clean_references(priv);
return ret;
}
EXPORT_SYMBOL_GPL(meson_card_probe);
void meson_card_remove(struct platform_device *pdev)
{
struct meson_card *priv = platform_get_drvdata(pdev);
meson_card_clean_references(priv);
}
EXPORT_SYMBOL_GPL(meson_card_remove);
MODULE_DESCRIPTION("Amlogic Sound Card Utils");
MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
Annotation
- Immediate include surface: `linux/module.h`, `linux/of_platform.h`, `sound/soc.h`, `meson-card.h`.
- Detected declarations: `function meson_card_i2s_set_sysclk`, `function for_each_rtd_codec_dais`, `function meson_card_reallocate_links`, `function meson_card_parse_dai`, `function meson_card_set_link_name`, `function meson_card_parse_daifmt`, `function meson_card_set_be_link`, `function for_each_child_of_node_scoped`, `function meson_card_set_fe_link`, `function meson_card_add_links`.
- 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.