public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Samuel Ortiz <sameo@linux.intel.com>
Cc: linux-kernel@vger.kernel.org,
	patches@opensource.wolfsonmicro.com,
	Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH 10/10] mfd: arizona: Disable interrupts during resume
Date: Sun, 27 Jan 2013 12:07:32 +0800	[thread overview]
Message-ID: <1359259652-8565-10-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1359259652-8565-1-git-send-email-broonie@opensource.wolfsonmicro.com>

Runtime power management does not function during system suspend but the
Arizona devices need to use runtime power management to power up the device
in order to handle interrupts. Try to avoid interrupts firing during
resume by disabling the primary IRQ before interrupts are reenabled on
resume and only reenabling it again during main resume.

The goal is to avoid issues in the situation where an interrupt is asserted
during resume (eg, due to it being the wake source) and the interrupt
handling gets scheduled prior to the device being able to handle runtime
PM.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/mfd/arizona-core.c |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index 5f0de90..0bb79c8 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -263,10 +263,36 @@ static int arizona_runtime_suspend(struct device *dev)
 }
 #endif
 
+#ifdef CONFIG_PM_SLEEP
+static int arizona_resume_noirq(struct device *dev)
+{
+	struct arizona *arizona = dev_get_drvdata(dev);
+
+	dev_dbg(arizona->dev, "Early resume, disabling IRQ\n");
+	disable_irq(arizona->irq);
+
+	return 0;
+}
+
+static int arizona_resume(struct device *dev)
+{
+	struct arizona *arizona = dev_get_drvdata(dev);
+
+	dev_dbg(arizona->dev, "Late resume, reenabling IRQ\n");
+	enable_irq(arizona->irq);
+
+	return 0;
+}
+#endif
+
 const struct dev_pm_ops arizona_pm_ops = {
 	SET_RUNTIME_PM_OPS(arizona_runtime_suspend,
 			   arizona_runtime_resume,
 			   NULL)
+	SET_SYSTEM_SLEEP_PM_OPS(NULL, arizona_resume)
+#ifdef CONFIG_PM_SLEEP
+	.resume_noirq = arizona_resume_noirq,
+#endif
 };
 EXPORT_SYMBOL_GPL(arizona_pm_ops);
 
-- 
1.7.10.4


  parent reply	other threads:[~2013-01-27  4:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-27  4:07 [PATCH 01/10] mfd: wm5102: Mark DSP memory regions as volatile and readable Mark Brown
2013-01-27  4:07 ` [PATCH 02/10] mfd: wm5102: Mark only extant DSP registers volatile Mark Brown
2013-01-27  4:07 ` [PATCH 03/10] mfd: arizona: Register MICVDD supply first to ensure no retries Mark Brown
2013-01-27  4:07 ` [PATCH 04/10] mfd: arizona: Disable control interface reporting for WM5102 and WM5110 Mark Brown
2013-01-27  4:07 ` [PATCH 05/10] mfd: arizona: Check errors from regcache_sync() Mark Brown
2013-01-27  4:07 ` [PATCH 06/10] mfd: arizona: Allow customisation of microphone detection levels Mark Brown
2013-01-27  9:44   ` Mark Brown
2013-01-27 23:56     ` Samuel Ortiz
2013-01-27  4:07 ` [PATCH 07/10] mfd: wm5102: Add registers for microphone detection level configuration Mark Brown
2013-02-03 17:00   ` Samuel Ortiz
2013-01-27  4:07 ` [PATCH 08/10] mfd: wm5102: Refresh register defaults Mark Brown
2013-02-03 17:00   ` Samuel Ortiz
2013-01-27  4:07 ` [PATCH 09/10] mfd: wm5102: Update rev B patch for latest evaluation Mark Brown
2013-01-27  4:07 ` Mark Brown [this message]
2013-02-03 17:00 ` [PATCH 01/10] mfd: wm5102: Mark DSP memory regions as volatile and readable Samuel Ortiz

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=1359259652-8565-10-git-send-email-broonie@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=sameo@linux.intel.com \
    /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