diff options
author | Mark Brown <broonie@linaro.org> | 2014-01-30 19:55:45 +0000 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-02-03 12:50:59 +0000 |
commit | 7e9614ebcf4d74edba864cc91e1e8a3ec6b32fc2 (patch) | |
tree | 64be61653eb8038e47c705af9546b230b65c8929 /sound/soc/codecs/wm8962.c | |
parent | 38dbfb59d1175ef458d006556061adeaa8751b72 (diff) | |
download | linux-7e9614ebcf4d74edba864cc91e1e8a3ec6b32fc2.tar.gz linux-7e9614ebcf4d74edba864cc91e1e8a3ec6b32fc2.tar.bz2 linux-7e9614ebcf4d74edba864cc91e1e8a3ec6b32fc2.zip |
ASoC: wm8962: Hold a runtime PM reference while handling interrupts
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>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8962.c')
-rw-r--r-- | sound/soc/codecs/wm8962.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 97db3b45b411..1996567346c6 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -3003,9 +3003,16 @@ 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 IRQ_NONE; + } + ret = regmap_read(wm8962->regmap, WM8962_INTERRUPT_STATUS_2_MASK, &mask); if (ret != 0) { + pm_runtime_put(dev); dev_err(dev, "Failed to read interrupt mask: %d\n", ret); return IRQ_NONE; @@ -3013,14 +3020,17 @@ static irqreturn_t wm8962_irq(int irq, void *data) ret = regmap_read(wm8962->regmap, WM8962_INTERRUPT_STATUS_2, &active); if (ret != 0) { + pm_runtime_put(dev); dev_err(dev, "Failed to read interrupt: %d\n", ret); return IRQ_NONE; } 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 +3080,8 @@ static irqreturn_t wm8962_irq(int irq, void *data) msecs_to_jiffies(250)); } + pm_runtime_put(dev); + return IRQ_HANDLED; } |