mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 20:53:53 +08:00
ASoC: snappercl15: convert to use snd_soc_register_card()
Current method for machine driver to register with the ASoC core is to use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Reviewed-by: Ryan Mallon <rmallon@gmail.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
d1dc698a54
commit
62e4f7d138
@ -104,37 +104,56 @@ static struct snd_soc_card snd_soc_snappercl15 = {
|
||||
.num_links = 1,
|
||||
};
|
||||
|
||||
static struct platform_device *snappercl15_snd_device;
|
||||
|
||||
static int __init snappercl15_init(void)
|
||||
static int __devinit snappercl15_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct snd_soc_card *card = &snd_soc_snappercl15;
|
||||
int ret;
|
||||
|
||||
if (!machine_is_snapper_cl15())
|
||||
return -ENODEV;
|
||||
|
||||
ret = ep93xx_i2s_acquire(EP93XX_SYSCON_DEVCFG_I2SONAC97,
|
||||
EP93XX_SYSCON_I2SCLKDIV_ORIDE |
|
||||
EP93XX_SYSCON_I2SCLKDIV_SPOL);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
snappercl15_snd_device = platform_device_alloc("soc-audio", -1);
|
||||
if (!snappercl15_snd_device)
|
||||
return -ENOMEM;
|
||||
|
||||
platform_set_drvdata(snappercl15_snd_device, &snd_soc_snappercl15);
|
||||
ret = platform_device_add(snappercl15_snd_device);
|
||||
if (ret)
|
||||
platform_device_put(snappercl15_snd_device);
|
||||
card->dev = &pdev->dev;
|
||||
|
||||
ret = snd_soc_register_card(card);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
|
||||
ret);
|
||||
ep93xx_i2s_release();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __devexit snappercl15_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct snd_soc_card *card = platform_get_drvdata(pdev);
|
||||
|
||||
snd_soc_unregister_card(card);
|
||||
ep93xx_i2s_release();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver snappercl15_driver = {
|
||||
.driver = {
|
||||
.name = "snappercl15-audio",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = snappercl15_probe,
|
||||
.remove = __devexit_p(snappercl15_remove),
|
||||
};
|
||||
|
||||
static int __init snappercl15_init(void)
|
||||
{
|
||||
return platform_driver_register(&snappercl15_driver);
|
||||
}
|
||||
|
||||
static void __exit snappercl15_exit(void)
|
||||
{
|
||||
platform_device_unregister(snappercl15_snd_device);
|
||||
ep93xx_i2s_release();
|
||||
platform_driver_unregister(&snappercl15_driver);
|
||||
}
|
||||
|
||||
module_init(snappercl15_init);
|
||||
@ -143,4 +162,4 @@ module_exit(snappercl15_exit);
|
||||
MODULE_AUTHOR("Ryan Mallon");
|
||||
MODULE_DESCRIPTION("ALSA SoC Snapper CL15");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
MODULE_ALIAS("platform:snappercl15-audio");
|
||||
|
Loading…
Reference in New Issue
Block a user