FIXME: なにをするもの?
必要そうなものメモ。
platform_bus を使う場合、
struct hoge_device {
struct snd_soc_card card;
};
static int hoge_probe(struct platform_device *pdev)
{
struct hoge_device *d;
struct device *dev = &pdev->dev;
...
d = devm_kzalloc(dev, sizeof(struct hoge_device));
...
snd_soc_register_platform(dev, &hoge_snd_soc_platform_driver);
...
snd_soc_register_component(dev, &hoge_snd_soc_component_driver,
hoge_snd_soc_dai_drivers, ARRAY_SIZE(hoge_snd_soc_dai_drivers));
...
//FIXME: 他の手立てがありそう
d->card.dev = dev;
snd_soc_card_set_drvdata(&d->card, d);
snd_soc_register_card(&d->card);
...
return 0;
}
static int hoge_remove(struct platform_device *pdev)
{
struct snd_soc_card *card = platform_get_drvdata(pdev);
struct hoge_device *d = snd_soc_card_get_drvdata(card);
struct device *dev = &pdev->dev;
...
snd_soc_unregister_card(&d->card);
...
snd_soc_unregister_component(dev);
...
snd_soc_unregister_platform(dev);
...
return 0;
}
static struct platform_driver hoge_driver = {
.driver = {
.name = "hoge",
},
.probe = hoge_probe,
.remove = hoge_remove,
};
module_platform_driver(hoge_driver);