sound/soc/mediatek/mt6797/mt6797-afe-pcm.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt6797/mt6797-afe-pcm.c- Extension
.c- Size
- 23420 bytes
- Lines
- 901
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/delay.hlinux/module.hlinux/mfd/syscon.hlinux/of.hlinux/of_address.hlinux/pm_runtime.hmt6797-afe-common.hmt6797-afe-clk.hmt6797-interconnection.hmt6797-reg.h../common/mtk-afe-platform-driver.h../common/mtk-afe-fe-dai.h
Detected Declarations
function mt6797_general_rate_transformfunction dai_memif_rate_transformfunction mt6797_rate_transformfunction mt6797_memif_fsfunction mt6797_irq_fsfunction mt6797_afe_irq_handlerfunction mt6797_afe_runtime_suspendfunction mt6797_afe_runtime_resumefunction mt6797_dai_memif_registerfunction mt6797_afe_pcm_dev_probefunction mt6797_afe_pcm_dev_remove
Annotated Snippet
if (ret) {
dev_warn(afe->dev, "dai register i %d fail, ret %d\n",
i, ret);
return ret;
}
}
/* init dai_driver and component_driver */
ret = mtk_afe_combine_sub_dai(afe);
if (ret) {
dev_warn(afe->dev, "mtk_afe_combine_sub_dai fail, ret %d\n",
ret);
return ret;
}
afe->mtk_afe_hardware = &mt6797_afe_hardware;
afe->memif_fs = mt6797_memif_fs;
afe->irq_fs = mt6797_irq_fs;
afe->runtime_resume = mt6797_afe_runtime_resume;
afe->runtime_suspend = mt6797_afe_runtime_suspend;
platform_set_drvdata(pdev, afe);
pm_runtime_enable(dev);
if (!pm_runtime_enabled(dev))
goto err_pm_disable;
pm_runtime_get_sync(&pdev->dev);
/* register component */
ret = devm_snd_soc_register_component(dev, &mtk_afe_pcm_platform,
NULL, 0);
if (ret) {
dev_warn(dev, "err_platform\n");
goto err_pm_disable;
}
ret = devm_snd_soc_register_component(afe->dev,
&mt6797_afe_pcm_dai_component,
afe->dai_drivers,
afe->num_dai_drivers);
if (ret) {
dev_warn(dev, "err_dai_component\n");
goto err_pm_disable;
}
return 0;
err_pm_disable:
pm_runtime_disable(dev);
return ret;
}
static void mt6797_afe_pcm_dev_remove(struct platform_device *pdev)
{
pm_runtime_disable(&pdev->dev);
if (!pm_runtime_status_suspended(&pdev->dev))
mt6797_afe_runtime_suspend(&pdev->dev);
pm_runtime_put_sync(&pdev->dev);
}
static const struct of_device_id mt6797_afe_pcm_dt_match[] = {
{ .compatible = "mediatek,mt6797-audio", },
{},
};
MODULE_DEVICE_TABLE(of, mt6797_afe_pcm_dt_match);
static const struct dev_pm_ops mt6797_afe_pm_ops = {
RUNTIME_PM_OPS(mt6797_afe_runtime_suspend,
mt6797_afe_runtime_resume, NULL)
};
static struct platform_driver mt6797_afe_pcm_driver = {
.driver = {
.name = "mt6797-audio",
.of_match_table = mt6797_afe_pcm_dt_match,
.pm = pm_ptr(&mt6797_afe_pm_ops),
},
.probe = mt6797_afe_pcm_dev_probe,
.remove = mt6797_afe_pcm_dev_remove,
};
module_platform_driver(mt6797_afe_pcm_driver);
MODULE_DESCRIPTION("Mediatek ALSA SoC AFE platform driver for 6797");
MODULE_AUTHOR("KaiChieh Chuang <kaichieh.chuang@mediatek.com>");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/delay.h`, `linux/module.h`, `linux/mfd/syscon.h`, `linux/of.h`, `linux/of_address.h`, `linux/pm_runtime.h`, `mt6797-afe-common.h`, `mt6797-afe-clk.h`.
- Detected declarations: `function mt6797_general_rate_transform`, `function dai_memif_rate_transform`, `function mt6797_rate_transform`, `function mt6797_memif_fs`, `function mt6797_irq_fs`, `function mt6797_afe_irq_handler`, `function mt6797_afe_runtime_suspend`, `function mt6797_afe_runtime_resume`, `function mt6797_dai_memif_register`, `function mt6797_afe_pcm_dev_probe`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.