ASoC: pxa: Convert spitz to use snd_soc_register_card()
Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
728384a10b
commit
ecf0015161
1 changed files with 28 additions and 24 deletions
|
@ -305,19 +305,15 @@ static struct snd_soc_card snd_soc_spitz = {
|
||||||
.num_dapm_routes = ARRAY_SIZE(spitz_audio_map),
|
.num_dapm_routes = ARRAY_SIZE(spitz_audio_map),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_device *spitz_snd_device;
|
static int spitz_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
static int __init spitz_init(void)
|
|
||||||
{
|
{
|
||||||
|
struct snd_soc_card *card = &snd_soc_spitz;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita()))
|
if (machine_is_akita())
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
if (machine_is_borzoi() || machine_is_spitz())
|
|
||||||
spitz_mic_gpio = SPITZ_GPIO_MIC_BIAS;
|
|
||||||
else
|
|
||||||
spitz_mic_gpio = AKITA_GPIO_MIC_BIAS;
|
spitz_mic_gpio = AKITA_GPIO_MIC_BIAS;
|
||||||
|
else
|
||||||
|
spitz_mic_gpio = SPITZ_GPIO_MIC_BIAS;
|
||||||
|
|
||||||
ret = gpio_request(spitz_mic_gpio, "MIC GPIO");
|
ret = gpio_request(spitz_mic_gpio, "MIC GPIO");
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -327,37 +323,45 @@ static int __init spitz_init(void)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err2;
|
goto err2;
|
||||||
|
|
||||||
spitz_snd_device = platform_device_alloc("soc-audio", -1);
|
card->dev = &pdev->dev;
|
||||||
if (!spitz_snd_device) {
|
|
||||||
ret = -ENOMEM;
|
ret = snd_soc_register_card(card);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
|
||||||
|
ret);
|
||||||
goto err2;
|
goto err2;
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(spitz_snd_device, &snd_soc_spitz);
|
|
||||||
|
|
||||||
ret = platform_device_add(spitz_snd_device);
|
|
||||||
if (ret)
|
|
||||||
goto err3;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err3:
|
|
||||||
platform_device_put(spitz_snd_device);
|
|
||||||
err2:
|
err2:
|
||||||
gpio_free(spitz_mic_gpio);
|
gpio_free(spitz_mic_gpio);
|
||||||
err1:
|
err1:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit spitz_exit(void)
|
static int spitz_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
platform_device_unregister(spitz_snd_device);
|
struct snd_soc_card *card = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
snd_soc_unregister_card(card);
|
||||||
gpio_free(spitz_mic_gpio);
|
gpio_free(spitz_mic_gpio);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(spitz_init);
|
static struct platform_driver spitz_driver = {
|
||||||
module_exit(spitz_exit);
|
.driver = {
|
||||||
|
.name = "spitz-audio",
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
.pm = &snd_soc_pm_ops,
|
||||||
|
},
|
||||||
|
.probe = spitz_probe,
|
||||||
|
.remove = spitz_remove,
|
||||||
|
};
|
||||||
|
|
||||||
|
module_platform_driver(spitz_driver);
|
||||||
|
|
||||||
MODULE_AUTHOR("Richard Purdie");
|
MODULE_AUTHOR("Richard Purdie");
|
||||||
MODULE_DESCRIPTION("ALSA SoC Spitz");
|
MODULE_DESCRIPTION("ALSA SoC Spitz");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
MODULE_ALIAS("platform:spitz-audio");
|
||||||
|
|
Loading…
Add table
Reference in a new issue