[PATCH] Input: tca6416-keypad: Suspend/Resume wakeup support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Magnus Damm <damm@xxxxxxxxxxxxx>

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

 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),
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux