From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: srk@ti.com, linux-sh@vger.kernel.org,
chinyeow.sim.xt@renesas.com, linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: tca6416-keypad: Suspend/Resume wakeup support
Date: Tue, 15 Mar 2011 22:32:02 -0700 [thread overview]
Message-ID: <20110316053202.GA14604@core.coreip.homeip.net> (raw)
In-Reply-To: <20110316051030.2399.19707.sendpatchset@t400s>
On Wed, Mar 16, 2011 at 02:10:30PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
>
> Extend the tca6416 driver to use enable_irq_wake()
> and disable_irq_wake() in the suspend/resume hooks.
>
> This makes it possible to wake up from suspend-to-ram
> using a tca6416 key on the sh7372 mackerel board.
>
Hi Magnus,
Looks good, but why don't we guard PM code with CONFIG_PM_SLEEP, like
below? I also believe we should use bus-specific helpers to access
private driver data since it does not have to stay alias for the
core data pointer.
Thanks.
--
Dmitry
Input: tca6416-keypad - Suspend/Resume wakeup support
From: Magnus Damm <damm@opensource.se>
Extend the tca6416 driver to use enable_irq_wake()
and disable_irq_wake() in the suspend/resume hooks.
This makes it possible to wake up from suspend-to-ram
using a tca6416 key on the sh7372 mackerel board.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/keyboard/tca6416-keypad.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/drivers/input/keyboard/tca6416-keypad.c b/drivers/input/keyboard/tca6416-keypad.c
index 800fbcc..3afea3f 100644
--- a/drivers/input/keyboard/tca6416-keypad.c
+++ b/drivers/input/keyboard/tca6416-keypad.c
@@ -297,6 +297,7 @@ static int __devinit tca6416_keypad_probe(struct i2c_client *client,
}
i2c_set_clientdata(client, chip);
+ device_init_wakeup(&client->dev, 1);
return 0;
@@ -326,10 +327,37 @@ static int __devexit tca6416_keypad_remove(struct i2c_client *client)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+static int tca6416_keypad_suspend(struct device *dev)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct tca6416_keypad_chip *chip = i2c_get_clientdata(client);
+
+ if (device_may_wakeup(dev))
+ enable_irq_wake(chip->irqnum);
+
+ return 0;
+}
+
+static int tca6416_keypad_resume(struct device *dev)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct tca6416_keypad_chip *chip = i2c_get_clientdata(client);
+
+ if (device_may_wakeup(dev))
+ disable_irq_wake(chip->irqnum);
+
+ return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(tca6416_keypad_dev_pm_ops,
+ tca6416_keypad_suspend, tca6416_keypad_resume);
static struct i2c_driver tca6416_keypad_driver = {
.driver = {
.name = "tca6416-keypad",
+ .pm = &tca6416_keypad_dev_pm_ops,
},
.probe = tca6416_keypad_probe,
.remove = __devexit_p(tca6416_keypad_remove),
next prev parent reply other threads:[~2011-03-16 5:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-16 5:10 [PATCH] Input: tca6416-keypad: Suspend/Resume wakeup support Magnus Damm
2011-03-16 5:32 ` Dmitry Torokhov [this message]
2011-03-16 5:45 ` Magnus Damm
2011-03-16 5:51 ` Dmitry Torokhov
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=20110316053202.GA14604@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=chinyeow.sim.xt@renesas.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=srk@ti.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;
as well as URLs for NNTP newsgroup(s).