Skip to contentSkip to conversation

ASoC: Prevent system suspend while debouncing wakeup capable GPIO jacks

PATCH In review Mark Brown 2 participants 2 messages Nov 14, 2010 – Nov 15, 2010

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: Prevent system suspend while debouncing wakeup capable GPIO jacks

If the device associated with a GPIO jack is wakeup capable then disable suspend while we're debouncing the jack so that we skip suspends that race with the jack.

Note that currently the GPIO based jack has a CODEC associated with it which we're using right now. These jacks should be reparented against the card itself and this code adjusted.

---
 sound/soc/soc-jack.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
sound/soc/soc-jack.c +4 -0
index 4d95abb..619061d 100644
@@ -209,6 +209,10 @@ static void snd_soc_jack_gpio_detect(struct snd_soc_jack_gpio *gpio)
 static irqreturn_t gpio_handler(int irq, void *data)
 {
 	struct snd_soc_jack_gpio *gpio = data;
+	struct device *dev = gpio->jack->codec->card->dev;
+
+	if (device_may_wakeup(dev))
+		pm_wakeup_event(dev, gpio->debounce_time + 50);
 
 	schedule_delayed_work(&gpio->work,
 			      msecs_to_jiffies(gpio->debounce_time));
Signature · 1 line
1.7.2.3
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Mark Brown

If the device associated with a GPIO jack is wakeup capable then disable suspend while we're debouncing the jack so that we skip suspends that race with the jack.

Note that currently the GPIO based jack has a CODEC associated with it which we're using right now. These jacks should be reparented against the card itself and this code adjusted.

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk