sound/soc/mediatek/mt7986/mt7986-wm8960.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt7986/mt7986-wm8960.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt7986/mt7986-wm8960.c- Extension
.c- Size
- 4613 bytes
- Lines
- 176
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hsound/soc.hmt7986-afe-common.h
Detected Declarations
function mt7986_wm8960_machine_probefunction for_each_card_prelinksfunction for_each_card_prelinks
Annotated Snippet
if (!platform_dai_node) {
dev_err(&pdev->dev, "Failed to parse platform/sound-dai property\n");
return -EINVAL;
}
} else {
dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
return -EINVAL;
}
for_each_card_prelinks(card, i, dai_link) {
if (dai_link->platforms->name)
continue;
dai_link->platforms->of_node = platform_dai_node;
}
codec = of_get_child_by_name(pdev->dev.of_node, "codec");
if (codec) {
codec_dai_node = of_parse_phandle(codec, "sound-dai", 0);
of_node_put(codec);
if (!codec_dai_node) {
of_node_put(platform_dai_node);
dev_err(&pdev->dev, "Failed to parse codec/sound-dai property\n");
return -EINVAL;
}
} else {
of_node_put(platform_dai_node);
dev_err(&pdev->dev, "Property 'codec' missing or invalid\n");
return -EINVAL;
}
for_each_card_prelinks(card, i, dai_link) {
if (dai_link->codecs->name)
continue;
dai_link->codecs->of_node = codec_dai_node;
}
ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
if (ret) {
dev_err(&pdev->dev, "Failed to parse audio-routing: %d\n", ret);
goto err_of_node_put;
}
ret = devm_snd_soc_register_card(&pdev->dev, card);
if (ret) {
dev_err_probe(&pdev->dev, ret, "%s snd_soc_register_card fail\n", __func__);
goto err_of_node_put;
}
err_of_node_put:
of_node_put(platform_dai_node);
of_node_put(codec_dai_node);
return ret;
}
static const struct of_device_id mt7986_wm8960_machine_dt_match[] = {
{.compatible = "mediatek,mt7986-wm8960-sound"},
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mt7986_wm8960_machine_dt_match);
static struct platform_driver mt7986_wm8960_machine = {
.driver = {
.name = "mt7986-wm8960",
.of_match_table = mt7986_wm8960_machine_dt_match,
},
.probe = mt7986_wm8960_machine_probe,
};
module_platform_driver(mt7986_wm8960_machine);
/* Module information */
MODULE_DESCRIPTION("MT7986 WM8960 ALSA SoC machine driver");
MODULE_AUTHOR("Vic Wu <vic.wu@mediatek.com>");
MODULE_LICENSE("GPL");
MODULE_ALIAS("mt7986 wm8960 soc card");
Annotation
- Immediate include surface: `linux/module.h`, `sound/soc.h`, `mt7986-afe-common.h`.
- Detected declarations: `function mt7986_wm8960_machine_probe`, `function for_each_card_prelinks`, `function for_each_card_prelinks`.
- 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.