linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: dmitry.torokhov@gmail.com
Cc: srk@ti.com, Magnus Damm <magnus.damm@gmail.com>,
	linux-sh@vger.kernel.org, chinyeow.sim.xt@renesas.com,
	linux-input@vger.kernel.org
Subject: [PATCH] Input: tca6416-keypad: Suspend/Resume wakeup support
Date: Wed, 16 Mar 2011 14:10:30 +0900	[thread overview]
Message-ID: <20110316051030.2399.19707.sendpatchset@t400s> (raw)

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>
---

 drivers/input/keyboard/tca6416-keypad.c |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

--- 0001/drivers/input/keyboard/tca6416-keypad.c
+++ work/drivers/input/keyboard/tca6416-keypad.c	2011-03-16 12:53:34.000000000 +0900
@@ -297,6 +297,7 @@ static int __devinit tca6416_keypad_prob
 	}
 
 	i2c_set_clientdata(client, chip);
+	device_init_wakeup(&client->dev, 1);
 
 	return 0;
 
@@ -326,10 +327,35 @@ static int __devexit tca6416_keypad_remo
 	return 0;
 }
 
+static int tca6416_keypad_suspend(struct device *dev)
+{
+	struct tca6416_keypad_chip *chip = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev))
+		enable_irq_wake(chip->irqnum);
+
+	return 0;
+}
+
+static int tca6416_keypad_resume(struct device *dev)
+{
+	struct tca6416_keypad_chip *chip = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev))
+		disable_irq_wake(chip->irqnum);
+
+	return 0;
+}
+
+static const struct dev_pm_ops tca6416_keypad_dev_pm_ops = {
+	.suspend = tca6416_keypad_suspend,
+	.resume = 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),

             reply	other threads:[~2011-03-16  5:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16  5:10 Magnus Damm [this message]
2011-03-16  5:32 ` [PATCH] Input: tca6416-keypad: Suspend/Resume wakeup support Dmitry Torokhov
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=20110316051030.2399.19707.sendpatchset@t400s \
    --to=magnus.damm@gmail.com \
    --cc=chinyeow.sim.xt@renesas.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --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).