Commit 34be9244 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

ASoC: pxa: Convert corgi to use snd_soc_register_card()

Use snd_soc_register_card() instead of creating a "soc-audio" platform device.
Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarHaojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 748b2178
...@@ -435,6 +435,14 @@ static struct platform_device corgiled_device = { ...@@ -435,6 +435,14 @@ static struct platform_device corgiled_device = {
}, },
}; };
/*
* Corgi Audio
*/
static struct platform_device corgi_audio_device = {
.name = "corgi-audio",
.id = -1,
};
/* /*
* MMC/SD Device * MMC/SD Device
* *
...@@ -641,6 +649,7 @@ static struct platform_device *devices[] __initdata = { ...@@ -641,6 +649,7 @@ static struct platform_device *devices[] __initdata = {
&corgifb_device, &corgifb_device,
&corgikbd_device, &corgikbd_device,
&corgiled_device, &corgiled_device,
&corgi_audio_device,
&sharpsl_nand_device, &sharpsl_nand_device,
&sharpsl_rom_device, &sharpsl_rom_device,
}; };
......
...@@ -291,7 +291,7 @@ static struct snd_soc_dai_link corgi_dai = { ...@@ -291,7 +291,7 @@ static struct snd_soc_dai_link corgi_dai = {
}; };
/* corgi audio machine driver */ /* corgi audio machine driver */
static struct snd_soc_card snd_soc_corgi = { static struct snd_soc_card corgi = {
.name = "Corgi", .name = "Corgi",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.dai_link = &corgi_dai, .dai_link = &corgi_dai,
...@@ -305,38 +305,41 @@ static struct snd_soc_card snd_soc_corgi = { ...@@ -305,38 +305,41 @@ static struct snd_soc_card snd_soc_corgi = {
.num_dapm_routes = ARRAY_SIZE(corgi_audio_map), .num_dapm_routes = ARRAY_SIZE(corgi_audio_map),
}; };
static struct platform_device *corgi_snd_device; static int __devinit corgi_probe(struct platform_device *pdev)
static int __init corgi_init(void)
{ {
struct snd_soc_card *card = &corgi;
int ret; int ret;
if (!(machine_is_corgi() || machine_is_shepherd() || card->dev = &pdev->dev;
machine_is_husky()))
return -ENODEV;
corgi_snd_device = platform_device_alloc("soc-audio", -1);
if (!corgi_snd_device)
return -ENOMEM;
platform_set_drvdata(corgi_snd_device, &snd_soc_corgi);
ret = platform_device_add(corgi_snd_device);
ret = snd_soc_register_card(card);
if (ret) if (ret)
platform_device_put(corgi_snd_device); dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
return ret; return ret;
} }
static void __exit corgi_exit(void) static int __devexit corgi_remove(struct platform_device *pdev)
{ {
platform_device_unregister(corgi_snd_device); struct snd_soc_card *card = platform_get_drvdata(pdev);
snd_soc_unregister_card(card);
return 0;
} }
module_init(corgi_init); static struct platform_driver corgi_driver = {
module_exit(corgi_exit); .driver = {
.name = "corgi-audio",
.owner = THIS_MODULE,
},
.probe = corgi_probe,
.remove = __devexit_p(corgi_remove),
};
module_platform_driver(corgi_driver);
/* Module information */ /* Module information */
MODULE_AUTHOR("Richard Purdie"); MODULE_AUTHOR("Richard Purdie");
MODULE_DESCRIPTION("ALSA SoC Corgi"); MODULE_DESCRIPTION("ALSA SoC Corgi");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:corgi-audio");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment