From 62133829fa12a55902ac400b74e424c1ecd161b3 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:52:42 +0800 Subject: 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: Axel Lin Signed-off-by: Mark Brown --- arch/arm/mach-pxa/eseries.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'arch/arm/mach-pxa/eseries.c') diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c index d82b7aa3c096..d157ca9f0f3c 100644 --- a/arch/arm/mach-pxa/eseries.c +++ b/arch/arm/mach-pxa/eseries.c @@ -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) -- cgit v1.2.3-55-g7522 From 5eb2c3d9273ae63d6b347cde38fe15bda8be1361 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:53:29 +0800 Subject: 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 Signed-off-by: Mark Brown --- arch/arm/mach-pxa/eseries.c | 6 +++++ sound/soc/pxa/e750_wm9705.c | 66 +++++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 35 deletions(-) (limited to 'arch/arm/mach-pxa/eseries.c') diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c index d157ca9f0f3c..3abfdb908d4c 100644 --- a/arch/arm/mach-pxa/eseries.c +++ b/arch/arm/mach-pxa/eseries.c @@ -724,12 +724,18 @@ static struct platform_device e750_tc6393xb_device = { .resource = eseries_tmio_resources, }; +static struct platform_device e750_audio_device = { + .name = "e750-audio", + .id = -1, +}; + /* ------------------------------------------------------------- */ static struct platform_device *e750_devices[] __initdata = { &e750_fb_device, &e750_tc6393xb_device, &e7xx_gpio_vbus, + &e750_audio_device, }; static void __init e750_init(void) diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c index 55c53d13bea6..27f90cc44234 100644 --- a/sound/soc/pxa/e750_wm9705.c +++ b/sound/soc/pxa/e750_wm9705.c @@ -120,58 +120,54 @@ static struct snd_soc_card e750 = { .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; - if (!machine_is_e750()) - return -ENODEV; - - ret = gpio_request_one(GPIO_E750_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, - "Headphone amp"); + ret = gpio_request_array(e750_audio_gpios, + ARRAY_SIZE(e750_audio_gpios)); if (ret) return ret; - ret = gpio_request_one(GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH, - "Speaker amp"); - if (ret) - goto free_hp_amp_gpio; + card->dev = &pdev->dev; - e750_snd_device = platform_device_alloc("soc-audio", -1); - if (!e750_snd_device) { - ret = -ENOMEM; - goto free_spk_amp_gpio; + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + 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; } -static void __exit e750_exit(void) +static int __devexit e750_remove(struct platform_device *pdev) { - platform_device_unregister(e750_snd_device); - gpio_free(GPIO_E750_SPK_AMP_OFF); - gpio_free(GPIO_E750_HP_AMP_OFF); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios)); + snd_soc_unregister_card(card); + return 0; } -module_init(e750_init); -module_exit(e750_exit); +static struct platform_driver e750_driver = { + .driver = { + .name = "e750-audio", + .owner = THIS_MODULE, + }, + .probe = e750_probe, + .remove = __devexit_p(e750_remove), +}; + +module_platform_driver(e750_driver); /* Module information */ MODULE_AUTHOR("Ian Molton "); MODULE_DESCRIPTION("ALSA SoC driver for e750"); MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:e750-audio"); -- cgit v1.2.3-55-g7522 From 1eb0202dc7e45be5996416bc41489ae5a75485e5 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:54:25 +0800 Subject: ASoC: pxa: Convert e800_wm9712 to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- arch/arm/mach-pxa/eseries.c | 6 +++++ sound/soc/pxa/e800_wm9712.c | 66 +++++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 35 deletions(-) (limited to 'arch/arm/mach-pxa/eseries.c') diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c index 3abfdb908d4c..4bbc3facde69 100644 --- a/arch/arm/mach-pxa/eseries.c +++ b/arch/arm/mach-pxa/eseries.c @@ -936,12 +936,18 @@ static struct platform_device e800_tc6393xb_device = { .resource = eseries_tmio_resources, }; +static struct platform_device e800_audio_device = { + .name = "e800-audio", + .id = -1, +}; + /* ----------------------------------------------------------------------- */ static struct platform_device *e800_devices[] __initdata = { &e800_fb_device, &e800_tc6393xb_device, &e800_gpio_vbus, + &e800_audio_device, }; static void __init e800_init(void) diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c index 478ff191ffb4..858bf94160c5 100644 --- a/sound/soc/pxa/e800_wm9712.c +++ b/sound/soc/pxa/e800_wm9712.c @@ -110,58 +110,54 @@ static struct snd_soc_card e800 = { .num_links = ARRAY_SIZE(e800_dai), }; -static struct platform_device *e800_snd_device; +static struct gpio e800_audio_gpios[] = { + { GPIO_E800_SPK_AMP_ON, GPIOF_OUT_INIT_HIGH, "Headphone amp" }, + { GPIO_E800_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" }, +}; -static int __init e800_init(void) +static int __devinit e800_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &e800; int ret; - if (!machine_is_e800()) - return -ENODEV; - - ret = gpio_request_one(GPIO_E800_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, - "Headphone amp"); + ret = gpio_request_array(e800_audio_gpios, + ARRAY_SIZE(e800_audio_gpios)); if (ret) return ret; - ret = gpio_request_one(GPIO_E800_SPK_AMP_ON, GPIOF_OUT_INIT_HIGH, - "Speaker amp"); - if (ret) - goto free_hp_amp_gpio; + card->dev = &pdev->dev; - e800_snd_device = platform_device_alloc("soc-audio", -1); - if (!e800_snd_device) { - ret = -ENOMEM; - goto free_spk_amp_gpio; + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + gpio_free_array(e800_audio_gpios, ARRAY_SIZE(e800_audio_gpios)); } - - platform_set_drvdata(e800_snd_device, &e800); - ret = platform_device_add(e800_snd_device); - - if (!ret) - return 0; - -/* Fail gracefully */ - platform_device_put(e800_snd_device); -free_spk_amp_gpio: - gpio_free(GPIO_E800_SPK_AMP_ON); -free_hp_amp_gpio: - gpio_free(GPIO_E800_HP_AMP_OFF); - return ret; } -static void __exit e800_exit(void) +static int __devexit e800_remove(struct platform_device *pdev) { - platform_device_unregister(e800_snd_device); - gpio_free(GPIO_E800_SPK_AMP_ON); - gpio_free(GPIO_E800_HP_AMP_OFF); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + gpio_free_array(e800_audio_gpios, ARRAY_SIZE(e800_audio_gpios)); + snd_soc_unregister_card(card); + return 0; } -module_init(e800_init); -module_exit(e800_exit); +static struct platform_driver e800_driver = { + .driver = { + .name = "e800-audio", + .owner = THIS_MODULE, + }, + .probe = e800_probe, + .remove = __devexit_p(e800_remove), +}; + +module_platform_driver(e800_driver); /* Module information */ MODULE_AUTHOR("Ian Molton "); MODULE_DESCRIPTION("ALSA SoC driver for e800"); MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:e800-audio"); -- cgit v1.2.3-55-g7522