From: dbaryshkov@gmail.com (Dmitry Eremin-Solenikov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface
Date: Tue, 28 Oct 2014 03:02:04 +0300 [thread overview]
Message-ID: <1414454528-24240-12-git-send-email-dbaryshkov@gmail.com> (raw)
In-Reply-To: <1414454528-24240-1-git-send-email-dbaryshkov@gmail.com>
Since LoCoMo driver has been converted to provide proper gpiolib
interface, make poodle ASoC platform driver use gpiolib API.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
sound/soc/pxa/poodle.c | 51 ++++++++++++++++++++++++--------------------------
1 file changed, 24 insertions(+), 27 deletions(-)
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index 21f3400..a593bff 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -20,12 +20,12 @@
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
+#include <linux/gpio.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <asm/mach-types.h>
-#include <asm/hardware/locomo.h>
#include <mach/poodle.h>
#include <mach/audio.h>
@@ -48,16 +48,12 @@ static void poodle_ext_control(struct snd_soc_dapm_context *dapm)
/* set up jack connection */
if (poodle_jack_func == POODLE_HP) {
/* set = unmute headphone */
- locomo_gpio_write(&poodle_locomo_device.dev,
- POODLE_LOCOMO_GPIO_MUTE_L, 1);
- locomo_gpio_write(&poodle_locomo_device.dev,
- POODLE_LOCOMO_GPIO_MUTE_R, 1);
+ gpio_set_value(POODLE_GPIO_MUTE_L, 1);
+ gpio_set_value(POODLE_GPIO_MUTE_R, 1);
snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
} else {
- locomo_gpio_write(&poodle_locomo_device.dev,
- POODLE_LOCOMO_GPIO_MUTE_L, 0);
- locomo_gpio_write(&poodle_locomo_device.dev,
- POODLE_LOCOMO_GPIO_MUTE_R, 0);
+ gpio_set_value(POODLE_GPIO_MUTE_L, 0);
+ gpio_set_value(POODLE_GPIO_MUTE_R, 0);
snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
}
@@ -85,10 +81,8 @@ static int poodle_startup(struct snd_pcm_substream *substream)
static void poodle_shutdown(struct snd_pcm_substream *substream)
{
/* set = unmute headphone */
- locomo_gpio_write(&poodle_locomo_device.dev,
- POODLE_LOCOMO_GPIO_MUTE_L, 1);
- locomo_gpio_write(&poodle_locomo_device.dev,
- POODLE_LOCOMO_GPIO_MUTE_R, 1);
+ gpio_set_value(POODLE_GPIO_MUTE_L, 1);
+ gpio_set_value(POODLE_GPIO_MUTE_R, 1);
}
static int poodle_hw_params(struct snd_pcm_substream *substream,
@@ -178,12 +172,7 @@ static int poodle_set_spk(struct snd_kcontrol *kcontrol,
static int poodle_amp_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
- if (SND_SOC_DAPM_EVENT_ON(event))
- locomo_gpio_write(&poodle_locomo_device.dev,
- POODLE_LOCOMO_GPIO_AMP_ON, 0);
- else
- locomo_gpio_write(&poodle_locomo_device.dev,
- POODLE_LOCOMO_GPIO_AMP_ON, 1);
+ gpio_set_value(POODLE_GPIO_AMP_ON, !(SND_SOC_DAPM_EVENT_ON(event)));
return 0;
}
@@ -263,25 +252,32 @@ static struct snd_soc_card poodle = {
.num_dapm_routes = ARRAY_SIZE(poodle_audio_map),
};
+struct gpio poodle_gpios[] = {
+ { POODLE_GPIO_AMP_ON, GPIOF_OUT_INIT_HIGH, "Amplifier" },
+ { POODLE_GPIO_MUTE_L, GPIOF_OUT_INIT_LOW, "Mute left" },
+ { POODLE_GPIO_MUTE_R, GPIOF_OUT_INIT_LOW, "Mute right" },
+};
+
static int poodle_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &poodle;
int ret;
- locomo_gpio_set_dir(&poodle_locomo_device.dev,
- POODLE_LOCOMO_GPIO_AMP_ON, 0);
- /* should we mute HP at startup - burning power ?*/
- locomo_gpio_set_dir(&poodle_locomo_device.dev,
- POODLE_LOCOMO_GPIO_MUTE_L, 0);
- locomo_gpio_set_dir(&poodle_locomo_device.dev,
- POODLE_LOCOMO_GPIO_MUTE_R, 0);
+ ret = gpio_request_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
+ if (ret) {
+ dev_err(&pdev->dev, "gpio_request_array() failed: %d\n",
+ ret);
+ return ret;
+ }
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
- if (ret)
+ if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
+ gpio_free_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
+ }
return ret;
}
@@ -290,6 +286,7 @@ static int poodle_remove(struct platform_device *pdev)
struct snd_soc_card *card = platform_get_drvdata(pdev);
snd_soc_unregister_card(card);
+ gpio_free_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
return 0;
}
--
2.1.1
next prev parent reply other threads:[~2014-10-28 0:02 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-28 0:01 [PATCH 00/15] new locomo driver Dmitry Eremin-Solenikov
2014-10-28 0:01 ` [PATCH 01/15] mfd: add new driver for Sharp LoCoMo Dmitry Eremin-Solenikov
2014-10-31 7:42 ` Linus Walleij
2014-10-31 9:54 ` Dmitry Eremin-Solenikov
2014-11-03 13:41 ` Linus Walleij
2014-11-05 20:02 ` Dmitry Eremin-Solenikov
2014-11-05 20:24 ` Mark Brown
2014-11-14 12:47 ` Dmitry Eremin-Solenikov
2014-11-14 15:10 ` Mark Brown
2014-11-14 15:30 ` Dmitry Eremin-Solenikov
2014-11-05 20:32 ` Lars-Peter Clausen
2014-11-05 20:42 ` Lars-Peter Clausen
2014-10-28 0:01 ` [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver Dmitry Eremin-Solenikov
2014-10-31 7:48 ` Linus Walleij
2014-10-31 9:39 ` Dmitry Eremin-Solenikov
2014-11-03 13:43 ` Linus Walleij
2014-11-05 21:33 ` Dmitry Eremin-Solenikov
2014-11-06 6:03 ` Mark Brown
2014-11-11 13:16 ` Dmitry Eremin-Solenikov
2014-11-11 13:23 ` Mark Brown
2014-11-14 10:11 ` Linus Walleij
2014-11-14 12:48 ` Dmitry Eremin-Solenikov
2014-10-28 0:01 ` [PATCH 03/15] leds: port locomo leds driver to new locomo core Dmitry Eremin-Solenikov
2014-10-28 0:01 ` [PATCH 04/15] input: convert LoCoMo keyboard driver to use " Dmitry Eremin-Solenikov
2014-10-28 0:09 ` Dmitry Torokhov
2014-10-28 0:01 ` [PATCH 05/15] video: backlight: add new locomo backlight driver Dmitry Eremin-Solenikov
2014-10-28 0:24 ` Jingoo Han
2014-10-28 0:01 ` [PATCH 06/15] video: lcd: add LoCoMo LCD driver Dmitry Eremin-Solenikov
2014-10-28 0:30 ` Jingoo Han
2014-10-28 16:47 ` Dmitry Eremin-Solenikov
2014-10-28 0:02 ` [PATCH 07/15] video: backlight: drop old locomo bl/lcd driver Dmitry Eremin-Solenikov
2014-10-28 0:02 ` [PATCH 08/15] ARM: sa1100: make collie use new locomo drivers Dmitry Eremin-Solenikov
2014-10-28 0:02 ` [PATCH 09/15] ARM: sa1100: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
2014-10-31 7:50 ` Linus Walleij
2014-10-31 9:33 ` Dmitry Eremin-Solenikov
2014-10-28 0:02 ` [PATCH 10/15] ARM: pxa: poodle: use new LoCoMo driver Dmitry Eremin-Solenikov
2014-10-28 0:02 ` Dmitry Eremin-Solenikov [this message]
2014-10-28 14:58 ` [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface Mark Brown
2014-10-28 16:45 ` Dmitry Eremin-Solenikov
2014-10-29 3:03 ` Alexandre Courbot
2014-10-31 9:52 ` Linus Walleij
2014-10-31 9:58 ` Dmitry Eremin-Solenikov
2014-11-01 5:42 ` Alexandre Courbot
2014-10-28 0:02 ` [PATCH 12/15] ARM: pxa: poodle: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
2014-10-28 19:13 ` Robert Jarzmik
2014-10-28 0:02 ` [PATCH 13/15] ARM: drop old LoCoMo driver Dmitry Eremin-Solenikov
2014-10-28 0:02 ` [PATCH 14/15] gpio: locomo: implement per-pin irq handling Dmitry Eremin-Solenikov
2014-10-31 8:00 ` Linus Walleij
2014-10-31 9:35 ` Dmitry Eremin-Solenikov
2014-10-28 0:02 ` [PATCH 15/15] spi: add locomo SPI driver Dmitry Eremin-Solenikov
2014-10-28 11:03 ` Mark Brown
2014-10-28 0:13 ` [PATCH 00/15] new locomo driver Russell King - ARM Linux
2014-10-28 0:28 ` Dmitry Eremin-Solenikov
2014-10-28 0:29 ` Mark Brown
2014-10-29 18:56 ` Dmitry Eremin-Solenikov
2014-10-29 22:32 ` Greg KH
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=1414454528-24240-12-git-send-email-dbaryshkov@gmail.com \
--to=dbaryshkov@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).