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.

Dependency Surface

Detected Declarations

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

Implementation Notes