All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] ASoC: wm8962: Hold a runtime PM reference while handling interrupts
@ 2014-01-31 15:29 Mark Brown
  2014-01-31 15:29 ` [PATCH 2/4] ASoC: wm8962: Check if we runtime resume the device when starting FLL Mark Brown
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Mark Brown @ 2014-01-31 15:29 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, linaro-kernel, Mark Brown

From: Mark Brown <broonie@linaro.org>

If the device is runtime suspended then we can't interact with it as it
may have been powered off and the register map will be in cache only
mode.

Signed-off-by: Mark Brown <broonie@linaro.org>
---
 sound/soc/codecs/wm8962.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 97db3b45b411..aa7ae76d5e28 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3003,6 +3003,12 @@ static irqreturn_t wm8962_irq(int irq, void *data)
 	unsigned int active;
 	int reg, ret;
 
+	ret = pm_runtime_get_sync(dev);
+	if (ret < 0) {
+		dev_err(dev, "Failed to resume: %d\n", ret);
+		return ret;
+	}
+
 	ret = regmap_read(wm8962->regmap, WM8962_INTERRUPT_STATUS_2_MASK,
 			  &mask);
 	if (ret != 0) {
@@ -3019,8 +3025,10 @@ static irqreturn_t wm8962_irq(int irq, void *data)
 
 	active &= ~mask;
 
-	if (!active)
+	if (!active) {
+		pm_runtime_put(dev);
 		return IRQ_NONE;
+	}
 
 	/* Acknowledge the interrupts */
 	ret = regmap_write(wm8962->regmap, WM8962_INTERRUPT_STATUS_2, active);
@@ -3070,6 +3078,8 @@ static irqreturn_t wm8962_irq(int irq, void *data)
 				   msecs_to_jiffies(250));
 	}
 
+	pm_runtime_put(dev);
+
 	return IRQ_HANDLED;
 }
 
-- 
1.9.rc1

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

end of thread, other threads:[~2014-01-31 17:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-31 15:29 [PATCH 1/4] ASoC: wm8962: Hold a runtime PM reference while handling interrupts Mark Brown
2014-01-31 15:29 ` [PATCH 2/4] ASoC: wm8962: Check if we runtime resume the device when starting FLL Mark Brown
2014-01-31 15:30 ` [PATCH 3/4] ASoC: wm8962: Clean up error handling for failed FLL start Mark Brown
2014-01-31 15:30 ` [PATCH 4/4] ASoC: wm8962: Reinitialise the IRQ completion rather than just trying it Mark Brown
2014-01-31 15:48 ` [PATCH 1/4] ASoC: wm8962: Hold a runtime PM reference while handling interrupts Charles Keepax
2014-01-31 17:35 ` Takashi Iwai
2014-01-31 17:40   ` Mark Brown

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.