All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: Allow GPIO jack detection to be configured as a wake source
@ 2011-02-18  0:42 Mark Brown
  2011-02-18  0:42 ` [PATCH 2/2] ASoC: Add kerneldoc for jack_status_check callback Mark Brown
  2011-02-18  9:18 ` [PATCH 1/2] ASoC: Allow GPIO jack detection to be configured as a wake source Liam Girdwood
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Brown @ 2011-02-18  0:42 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Some systems wish to use jacks as wake sources. Provide a wake flag in the
GPIO configuration which causes the driver to enable the IRQ as a wake
source.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 include/sound/soc.h  |    3 +++
 sound/soc/soc-jack.c |    8 ++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 4ccf1e4..fb57c33 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -436,6 +436,7 @@ struct snd_soc_jack_zone {
  * @report:       value to report when jack detected
  * @invert:       report presence in low state
  * @debouce_time: debouce time in ms
+ * @wake:	  enable as wake source
  */
 #ifdef CONFIG_GPIOLIB
 struct snd_soc_jack_gpio {
@@ -444,6 +445,8 @@ struct snd_soc_jack_gpio {
 	int report;
 	int invert;
 	int debounce_time;
+	bool wake;
+
 	struct snd_soc_jack *jack;
 	struct delayed_work work;
 
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index 4579ee0..1382251 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -330,6 +330,14 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
 		if (ret)
 			goto err;
 
+		if (gpios[i].wake) {
+			ret = set_irq_wake(gpio_to_irq(gpios[i].gpio), 1);
+			if (ret != 0)
+				printk(KERN_ERR
+				  "Failed to mark GPIO %d as wake source: %d\n",
+					gpios[i].gpio, ret);
+		}
+
 #ifdef CONFIG_GPIO_SYSFS
 		/* Expose GPIO value over sysfs for diagnostic purposes */
 		gpio_export(gpios[i].gpio, false);
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-18  9:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-18  0:42 [PATCH 1/2] ASoC: Allow GPIO jack detection to be configured as a wake source Mark Brown
2011-02-18  0:42 ` [PATCH 2/2] ASoC: Add kerneldoc for jack_status_check callback Mark Brown
2011-02-18  9:18 ` [PATCH 1/2] ASoC: Allow GPIO jack detection to be configured as a wake source Liam Girdwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.