ASoC: pxa: Convert imote2 to use snd_soc_register_card()
Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
5eb2c3d927
commit
ac1e89860a
2 changed files with 30 additions and 17 deletions
|
@ -593,10 +593,16 @@ static struct pxa2xx_udc_mach_info imote2_udc_info __initdata = {
|
||||||
.udc_command = sg2_udc_command,
|
.udc_command = sg2_udc_command,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct platform_device imote2_audio_device = {
|
||||||
|
.name = "imote2-audio",
|
||||||
|
.id = -1,
|
||||||
|
};
|
||||||
|
|
||||||
static struct platform_device *imote2_devices[] = {
|
static struct platform_device *imote2_devices[] = {
|
||||||
&stargate2_flash_device,
|
&stargate2_flash_device,
|
||||||
&imote2_leds,
|
&imote2_leds,
|
||||||
&sht15,
|
&sht15,
|
||||||
|
&imote2_audio_device,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init imote2_init(void)
|
static void __init imote2_init(void)
|
||||||
|
|
|
@ -70,39 +70,46 @@ static struct snd_soc_dai_link imote2_dai = {
|
||||||
.ops = &imote2_asoc_ops,
|
.ops = &imote2_asoc_ops,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_card snd_soc_imote2 = {
|
static struct snd_soc_card imote2 = {
|
||||||
.name = "Imote2",
|
.name = "Imote2",
|
||||||
.dai_link = &imote2_dai,
|
.dai_link = &imote2_dai,
|
||||||
.num_links = 1,
|
.num_links = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_device *imote2_snd_device;
|
static int __devinit imote2_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
static int __init imote2_asoc_init(void)
|
|
||||||
{
|
{
|
||||||
|
struct snd_soc_card *card = &imote2;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!machine_is_intelmote2())
|
card->dev = &pdev->dev;
|
||||||
return -ENODEV;
|
|
||||||
imote2_snd_device = platform_device_alloc("soc-audio", -1);
|
|
||||||
if (!imote2_snd_device)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
platform_set_drvdata(imote2_snd_device, &snd_soc_imote2);
|
ret = snd_soc_register_card(card);
|
||||||
ret = platform_device_add(imote2_snd_device);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
platform_device_put(imote2_snd_device);
|
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
|
||||||
|
ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
module_init(imote2_asoc_init);
|
|
||||||
|
|
||||||
static void __exit imote2_asoc_exit(void)
|
static int __devexit imote2_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
platform_device_unregister(imote2_snd_device);
|
struct snd_soc_card *card = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
snd_soc_unregister_card(card);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
module_exit(imote2_asoc_exit);
|
|
||||||
|
static struct platform_driver imote2_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = "imote2-audio",
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
},
|
||||||
|
.probe = imote2_probe,
|
||||||
|
.remove = __devexit_p(imote2_remove),
|
||||||
|
};
|
||||||
|
|
||||||
|
module_platform_driver(imote2_driver);
|
||||||
|
|
||||||
MODULE_AUTHOR("Jonathan Cameron");
|
MODULE_AUTHOR("Jonathan Cameron");
|
||||||
MODULE_DESCRIPTION("ALSA SoC Imote 2");
|
MODULE_DESCRIPTION("ALSA SoC Imote 2");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
MODULE_ALIAS("platform:imote2-audio");
|
||||||
|
|
Reference in a new issue