Commit 62133829 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

ASoC: pxa: Convert e740_wm9705 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>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 7243a4b1
......@@ -525,12 +525,18 @@ static struct platform_device e740_t7l66xb_device = {
.resource = eseries_tmio_resources,
};
static struct platform_device e740_audio_device = {
.name = "e740-audio",
.id = -1,
};
/* ----------------------------------------------------------------------- */
static struct platform_device *e740_devices[] __initdata = {
&e740_fb_device,
&e740_t7l66xb_device,
&e7xx_gpio_vbus,
&e740_audio_device,
};
static void __init e740_init(void)
......
......@@ -137,66 +137,55 @@ static struct snd_soc_card e740 = {
.num_links = ARRAY_SIZE(e740_dai),
};
static struct platform_device *e740_snd_device;
static struct gpio e740_audio_gpios[] = {
{ GPIO_E740_MIC_ON, GPIOF_OUT_INIT_LOW, "Mic amp" },
{ GPIO_E740_AMP_ON, GPIOF_OUT_INIT_LOW, "Output amp" },
{ GPIO_E740_WM9705_nAVDD2, GPIOF_OUT_INIT_HIGH, "Audio power" },
};
static int __init e740_init(void)
static int __devinit e740_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &e740;
int ret;
if (!machine_is_e740())
return -ENODEV;
/* Disable audio */
ret = gpio_request_one(GPIO_E740_MIC_ON, GPIOF_OUT_INIT_LOW, "Mic amp");
ret = gpio_request_array(e740_audio_gpios,
ARRAY_SIZE(e740_audio_gpios));
if (ret)
return ret;
ret = gpio_request_one(GPIO_E740_AMP_ON, GPIOF_OUT_INIT_LOW,
"Output amp");
if (ret)
goto free_mic_amp_gpio;
ret = gpio_request_one(GPIO_E740_WM9705_nAVDD2, GPIOF_OUT_INIT_HIGH,
"Audio power");
if (ret)
goto free_op_amp_gpio;
card->dev = &pdev->dev;
e740_snd_device = platform_device_alloc("soc-audio", -1);
if (!e740_snd_device) {
ret = -ENOMEM;
goto free_apwr_gpio;
ret = snd_soc_register_card(card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
gpio_free_array(e740_audio_gpios, ARRAY_SIZE(e740_audio_gpios));
}
platform_set_drvdata(e740_snd_device, &e740);
ret = platform_device_add(e740_snd_device);
if (!ret)
return 0;
/* Fail gracefully */
platform_device_put(e740_snd_device);
free_apwr_gpio:
gpio_free(GPIO_E740_WM9705_nAVDD2);
free_op_amp_gpio:
gpio_free(GPIO_E740_AMP_ON);
free_mic_amp_gpio:
gpio_free(GPIO_E740_MIC_ON);
return ret;
}
static void __exit e740_exit(void)
static int __devexit e740_remove(struct platform_device *pdev)
{
platform_device_unregister(e740_snd_device);
gpio_free(GPIO_E740_WM9705_nAVDD2);
gpio_free(GPIO_E740_AMP_ON);
gpio_free(GPIO_E740_MIC_ON);
struct snd_soc_card *card = platform_get_drvdata(pdev);
gpio_free_array(e740_audio_gpios, ARRAY_SIZE(e740_audio_gpios));
snd_soc_unregister_card(card);
return 0;
}
module_init(e740_init);
module_exit(e740_exit);
static struct platform_driver e740_driver = {
.driver = {
.name = "e740-audio",
.owner = THIS_MODULE,
},
.probe = e740_probe,
.remove = __devexit_p(e740_remove),
};
module_platform_driver(e740_driver);
/* Module information */
MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
MODULE_DESCRIPTION("ALSA SoC driver for e740");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:e740-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