/kernel/sound/soc/soc-core.c
/*soc-core.c -- ALSA SoC Audio Layer*/
/* probes a new socdev */
static int
soc_probe(struct platform_device *pdev)
{
int ret = 0;
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
//得到在platform_device中添加的數據
struct snd_soc_card *card = socdev->card;
//三角關系???
/* Bodge while we push things out of socdev */
card->socdev = socdev;
/* Bodge while we unpick instantiation */
card->dev = &pdev->dev;
ret =
snd_soc_register_card(card);
//注冊snd_soc_card
if (ret != 0) {
dev_err(&pdev->dev, "Failed to register card\n");
return ret;
}
return 0;
}
/* ASoC platform driver */
static struct platform_driver soc_driver = {
.driver = {
.name = "
soc-audio",
.owner = THIS_MODULE,
.pm = &soc_pm_ops,
},
.probe = soc_probe,
.remove = soc_remove,
};
static int __init snd_soc_init(void)
{
return
platform_driver_register(&
soc_driver);
}
module_init(snd_soc_init);