The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Samuel Ortiz <sameo@linux.intel.com>
To: Wei Ni <wni@nvidia.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"ccross@android.com" <ccross@android.com>,
	Varun Wadekar <vwadekar@nvidia.com>,
	Emily Jiang <ejiang@nvidia.com>
Subject: Re: [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume
Date: Mon, 2 May 2011 15:16:25 +0200	[thread overview]
Message-ID: <20110502131624.GB740@sortiz-mobl> (raw)
In-Reply-To: <6B4D417B830BC44B8026029FD256F7F1C2CB3DD4C0@HKMAIL01.nvidia.com>

Hi Wei,

> When use rtc tps6586x wakealarm to suspend/resume system,
> it will show a lot error messages:
> "tps6586x 4-0034: failed to read interrupt status
> tps6586x 4-0034: failed reading from 0xb5"
> After resume, the system will call the mfd tps6586x driver's interrupt handle
> tps6586x_irq(). This handle will read tps6586x interrupt status (0xb5), but at
> that time the i2c driver didn't resume yet, so the reading will be failed.
> I call the disble_irq in the suspend, and enable_irq in the resume, which will
> delay the delivery of the irq until the i2c driver has been resumed.
I think something like this would make more sense:

diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index bba26d9..a5feeb5 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -569,10 +569,36 @@ static const struct i2c_device_id tps6586x_id_table[] = {
 };
 MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
 
+#ifdef CONFIG_PM
+static int tps6586x_suspend(struct device *dev)
+{
+	struct i2c_client *i2c = to_i2c_client(dev);
+
+	if (device_may_wakeup(&i2c->dev) && i2c->irq)
+		enable_irq_wake(i2c->irq);
+
+	return 0;
+}
+
+static int tps6586x_resume(struct device *dev)
+{
+	struct i2c_client *i2c = to_i2c_client(dev);
+
+	if (device_may_wakeup(&i2c->dev) && i2c->irq)
+		disable_irq_wake(i2c->irq);
+
+	return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(tps6586x_pm_ops, tps6586x_suspend, tps6586x_resume,
+			    NULL);
+
 static struct i2c_driver tps6586x_driver = {
 	.driver	= {
 		.name	= "tps6586x",
 		.owner	= THIS_MODULE,
+		.pm     = tps6586x_pm_ops,
 	},
 	.probe		= tps6586x_i2c_probe,
 	.remove		= __devexit_p(tps6586x_i2c_remove),

Could you please try ?

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

  reply	other threads:[~2011-05-02 13:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-29  6:16 [PATCH] mfd: call disable_irq()/enable_irq() in suspend/resume wni
2011-03-30  6:19 ` Wei Ni
2011-04-18  9:57   ` Wei Ni
2011-05-02 13:16     ` Samuel Ortiz [this message]
2011-05-04  6:49       ` Wei Ni
2011-05-10  8:23         ` Wei Ni
  -- strict thread matches above, loose matches on Subject: below --
2011-03-29  5:51 wni
2011-03-29  5:58 ` Varun Wadekar
2011-03-29  6:04   ` Wei Ni

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=20110502131624.GB740@sortiz-mobl \
    --to=sameo@linux.intel.com \
    --cc=ccross@android.com \
    --cc=ejiang@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vwadekar@nvidia.com \
    --cc=wni@nvidia.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