ASoC: pxa: Convert e750_wm9705 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
62133829fa
commit
5eb2c3d927
|
@ -724,12 +724,18 @@ static struct platform_device e750_tc6393xb_device = {
|
||||||
.resource = eseries_tmio_resources,
|
.resource = eseries_tmio_resources,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct platform_device e750_audio_device = {
|
||||||
|
.name = "e750-audio",
|
||||||
|
.id = -1,
|
||||||
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
static struct platform_device *e750_devices[] __initdata = {
|
static struct platform_device *e750_devices[] __initdata = {
|
||||||
&e750_fb_device,
|
&e750_fb_device,
|
||||||
&e750_tc6393xb_device,
|
&e750_tc6393xb_device,
|
||||||
&e7xx_gpio_vbus,
|
&e7xx_gpio_vbus,
|
||||||
|
&e750_audio_device,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init e750_init(void)
|
static void __init e750_init(void)
|
||||||
|
|
|
@ -120,58 +120,54 @@ static struct snd_soc_card e750 = {
|
||||||
.num_links = ARRAY_SIZE(e750_dai),
|
.num_links = ARRAY_SIZE(e750_dai),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_device *e750_snd_device;
|
static struct gpio e750_audio_gpios[] = {
|
||||||
|
{ GPIO_E750_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Headphone amp" },
|
||||||
|
{ GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" },
|
||||||
|
};
|
||||||
|
|
||||||
static int __init e750_init(void)
|
static int __devinit e750_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
|
struct snd_soc_card *card = &e750;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!machine_is_e750())
|
ret = gpio_request_array(e750_audio_gpios,
|
||||||
return -ENODEV;
|
ARRAY_SIZE(e750_audio_gpios));
|
||||||
|
|
||||||
ret = gpio_request_one(GPIO_E750_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH,
|
|
||||||
"Headphone amp");
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = gpio_request_one(GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH,
|
card->dev = &pdev->dev;
|
||||||
"Speaker amp");
|
|
||||||
if (ret)
|
|
||||||
goto free_hp_amp_gpio;
|
|
||||||
|
|
||||||
e750_snd_device = platform_device_alloc("soc-audio", -1);
|
ret = snd_soc_register_card(card);
|
||||||
if (!e750_snd_device) {
|
if (ret) {
|
||||||
ret = -ENOMEM;
|
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
|
||||||
goto free_spk_amp_gpio;
|
ret);
|
||||||
|
gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios));
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(e750_snd_device, &e750);
|
|
||||||
ret = platform_device_add(e750_snd_device);
|
|
||||||
|
|
||||||
if (!ret)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Fail gracefully */
|
|
||||||
platform_device_put(e750_snd_device);
|
|
||||||
free_spk_amp_gpio:
|
|
||||||
gpio_free(GPIO_E750_SPK_AMP_OFF);
|
|
||||||
free_hp_amp_gpio:
|
|
||||||
gpio_free(GPIO_E750_HP_AMP_OFF);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit e750_exit(void)
|
static int __devexit e750_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
platform_device_unregister(e750_snd_device);
|
struct snd_soc_card *card = platform_get_drvdata(pdev);
|
||||||
gpio_free(GPIO_E750_SPK_AMP_OFF);
|
|
||||||
gpio_free(GPIO_E750_HP_AMP_OFF);
|
gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios));
|
||||||
|
snd_soc_unregister_card(card);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(e750_init);
|
static struct platform_driver e750_driver = {
|
||||||
module_exit(e750_exit);
|
.driver = {
|
||||||
|
.name = "e750-audio",
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
},
|
||||||
|
.probe = e750_probe,
|
||||||
|
.remove = __devexit_p(e750_remove),
|
||||||
|
};
|
||||||
|
|
||||||
|
module_platform_driver(e750_driver);
|
||||||
|
|
||||||
/* Module information */
|
/* Module information */
|
||||||
MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
|
MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
|
||||||
MODULE_DESCRIPTION("ALSA SoC driver for e750");
|
MODULE_DESCRIPTION("ALSA SoC driver for e750");
|
||||||
MODULE_LICENSE("GPL v2");
|
MODULE_LICENSE("GPL v2");
|
||||||
|
MODULE_ALIAS("platform:e750-audio");
|
||||||
|
|
Loading…
Reference in New Issue