From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@slimlogic.co.uk>
Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen <lars@metafoo.de>,
linux-kernel@vger.kernel.org
Subject: [PATCH 5/7] ASoC: Samsung: neo1973: Use gpio_request_array to request gpios
Date: Mon, 7 Feb 2011 00:04:21 +0100 [thread overview]
Message-ID: <1297033463-14577-5-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1297033463-14577-1-git-send-email-lars@metafoo.de>
Using gpio_request_array instead of requesting and setting up each gpio by hand
makes the code more readable and more compact.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/samsung/neo1973_gta02_wm8753.c | 36 +++++++----------------------
1 files changed, 9 insertions(+), 27 deletions(-)
diff --git a/sound/soc/samsung/neo1973_gta02_wm8753.c b/sound/soc/samsung/neo1973_gta02_wm8753.c
index b007dd79..62d2f39 100644
--- a/sound/soc/samsung/neo1973_gta02_wm8753.c
+++ b/sound/soc/samsung/neo1973_gta02_wm8753.c
@@ -370,6 +370,11 @@ static struct snd_soc_card neo1973_gta02 = {
.num_links = ARRAY_SIZE(neo1973_gta02_dai),
};
+static const struct gpio neo1973_gta02_gpios[] = {
+ { GTA02_GPIO_HP_IN, GPIOF_OUT_INIT_HIGH, "GTA02_HP_IN" },
+ { GTA02_GPIO_AMP_SHUT, GPIOF_OUT_INIT_HIGH, "GTA02_AMP_SHUT" },
+};
+
static struct platform_device *neo1973_gta02_snd_device;
static int __init neo1973_gta02_init(void)
@@ -397,37 +402,15 @@ static int __init neo1973_gta02_init(void)
if (ret)
goto err_unregister_dai;
- /* Initialise GPIOs used by amp */
- ret = gpio_request(GTA02_GPIO_HP_IN, "GTA02_HP_IN");
+ ret = gpio_request_array(neo1973_gta02_gpios,
+ ARRAY_SIZE(neo1973_gta02_gpios));
if (ret) {
- pr_err("gta02_wm8753: Failed to register GPIO %d\n", GTA02_GPIO_HP_IN);
+ pr_err("gta02_wm8753: Failed to request gpio\n");
goto err_del_device;
}
- ret = gpio_direction_output(GTA02_GPIO_HP_IN, 1);
- if (ret) {
- pr_err("gta02_wm8753: Failed to configure GPIO %d\n", GTA02_GPIO_HP_IN);
- goto err_free_gpio_hp_in;
- }
-
- ret = gpio_request(GTA02_GPIO_AMP_SHUT, "GTA02_AMP_SHUT");
- if (ret) {
- pr_err("gta02_wm8753: Failed to register GPIO %d\n", GTA02_GPIO_AMP_SHUT);
- goto err_free_gpio_hp_in;
- }
-
- ret = gpio_direction_output(GTA02_GPIO_AMP_SHUT, 1);
- if (ret) {
- pr_err("gta02_wm8753: Failed to configure GPIO %d\n", GTA02_GPIO_AMP_SHUT);
- goto err_free_gpio_amp_shut;
- }
-
return 0;
-err_free_gpio_amp_shut:
- gpio_free(GTA02_GPIO_AMP_SHUT);
-err_free_gpio_hp_in:
- gpio_free(GTA02_GPIO_HP_IN);
err_del_device:
platform_device_del(neo1973_gta02_snd_device);
err_unregister_dai:
@@ -440,10 +423,9 @@ module_init(neo1973_gta02_init);
static void __exit neo1973_gta02_exit(void)
{
+ gpio_free_array(neo1973_gta02_gpios, ARRAY_SIZE(neo1973_gta02_gpios));
snd_soc_unregister_dai(&neo1973_gta02_snd_device->dev);
platform_device_unregister(neo1973_gta02_snd_device);
- gpio_free(GTA02_GPIO_HP_IN);
- gpio_free(GTA02_GPIO_AMP_SHUT);
}
module_exit(neo1973_gta02_exit);
--
1.7.2.3
next prev parent reply other threads:[~2011-02-06 23:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-06 23:04 [PATCH 1/7] ASoC: neo1973_wm8753: Remove scenario management code Lars-Peter Clausen
2011-02-06 23:04 ` [PATCH 2/7] ASoC: neo1973_wm8753: Move lm4857 specefic code to its own module Lars-Peter Clausen
2011-02-07 11:50 ` Mark Brown
2011-02-06 23:04 ` [PATCH 3/7] ASoC: codecs: lm4857: Use dev_pm_ops Lars-Peter Clausen
2011-02-06 23:04 ` [PATCH 4/7] ASoC: neo1973_gta02_wm8753: Remove lm4853_{set,get}_state Lars-Peter Clausen
2011-02-06 23:04 ` Lars-Peter Clausen [this message]
2011-02-06 23:04 ` [PATCH 6/7] ASoC: Samsung: neo1973_gta02: Fix bluetooth DAI registration Lars-Peter Clausen
2011-02-07 11:59 ` Mark Brown
2011-02-07 16:53 ` Lars-Peter Clausen
2011-02-07 17:02 ` Mark Brown
2011-02-07 17:37 ` Lars-Peter Clausen
2011-02-07 17:49 ` Mark Brown
2011-02-07 18:09 ` Lars-Peter Clausen
2011-02-07 18:17 ` Mark Brown
2011-02-07 22:55 ` Adding bluetooth PCM interface support to ASoC (Was: Re: [PATCH 6/7] ASoC: Samsung: neo1973_gta02: Fix bluetooth DAI registration) Lars-Peter Clausen
2011-02-08 13:08 ` Mark Brown
2011-02-06 23:04 ` [PATCH 7/7] ASoC: Samsung: Merge neo1937 and neo1973_gta02 sound board driver Lars-Peter Clausen
2011-02-07 2:25 ` [alsa-devel] [PATCH 1/7] ASoC: neo1973_wm8753: Remove scenario management code Jassi Brar
2011-02-07 11:42 ` Mark Brown
2011-02-07 17:01 ` Lars-Peter Clausen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1297033463-14577-5-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).