[PATCH 35/37] Input: bf54x-keys - add infrastructure for keypad wakeups

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Michael Hennerich
Date: Thursday, April 17, 2008 - 9:25 pm

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
 drivers/input/keyboard/bf54x-keys.c |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c
index d87ac33..54ed8e2 100644
--- a/drivers/input/keyboard/bf54x-keys.c
+++ b/drivers/input/keyboard/bf54x-keys.c
@@ -312,6 +312,8 @@ static int __devinit bfin_kpad_probe(struct platform_device *pdev)
 
 	bfin_write_KPAD_CTL(bfin_read_KPAD_CTL() | KPAD_EN);
 
+	device_init_wakeup(&pdev->dev, 1);
+
 	printk(KERN_ERR DRV_NAME
 		": Blackfin BF54x Keypad registered IRQ %d\n", bf54x_kpad->irq);
 
@@ -354,13 +356,40 @@ static int __devexit bfin_kpad_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int bfin_kpad_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
+
+	if (device_may_wakeup(&pdev->dev))
+		enable_irq_wake(bf54x_kpad->irq);
+
+	return 0;
+}
+
+static int bfin_kpad_resume(struct platform_device *pdev)
+{
+	struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
+
+	if (device_may_wakeup(&pdev->dev))
+		disable_irq_wake(bf54x_kpad->irq);
+
+	return 0;
+}
+#else
+# define bfin_kpad_suspend NULL
+# define bfin_kpad_resume  NULL
+#endif
+
 struct platform_driver bfin_kpad_device_driver = {
-	.probe		= bfin_kpad_probe,
-	.remove		= __devexit_p(bfin_kpad_remove),
 	.driver		= {
 		.name	= DRV_NAME,
 		.owner	= THIS_MODULE,
-	}
+	},
+	.probe		= bfin_kpad_probe,
+	.remove		= __devexit_p(bfin_kpad_remove),
+	.suspend	= bfin_kpad_suspend,
+	.resume		= bfin_kpad_resume,
 };
 
 static int __init bfin_kpad_init(void)
-- 
1.5.5.rc2.6.gf58d


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 28/37] Input: add Zhen Hua driver, Martin Kebert, (Mon Mar 10, 5:40 am)
[PATCH 29/37] Input: fix ordering in joystick Makefile, Jiri Kosina, (Mon Mar 10, 5:43 am)
[PATCH 10/37] Input: tosakbd - fix suspend, Dmitry Baryshkov, (Wed Apr 2, 8:22 am)
[PATCH 13/37] Input: xpad - fix inverted Y and RY axes, Anssi Hannula, (Thu Apr 3, 1:18 pm)
[PATCH 19/37] Input: xpad - don't use GFP_ATOMIC, Oliver Neukum, (Thu Apr 3, 1:19 pm)
[PATCH 22/37] Input: add PS/2 serio driver for AVR32 devices, Hans-Christian Egtvedt, (Mon Apr 14, 10:30 pm)
[PATCH 23/37] Input: gpio_keys - irq handling cleanup, David Brownell, (Mon Apr 14, 10:31 pm)
[PATCH 24/37] Input: omap-keypad - fix build warning, David Brownell, (Mon Apr 14, 10:31 pm)
[PATCH 35/37] Input: bf54x-keys - add infrastructure for k ..., Michael Hennerich, (Thu Apr 17, 9:25 pm)
[PATCH 00/37] Input queue for 2.6.26 merge window, Dmitry Torokhov, (Mon Apr 21, 6:14 am)
Re: [PATCH 22/37] Input: add PS/2 serio driver for AVR32 d ..., Hans-Christian Egtvedt, (Mon Apr 21, 6:33 am)
Re: [PATCH 00/37] Input queue for 2.6.26 merge window, Henrique de Moraes H ..., (Mon Apr 21, 8:11 am)
Re: [PATCH 29/37] Input: fix ordering in joystick Makefile, Dmitry Torokhov, (Mon Apr 21, 8:39 am)
Re: [PATCH 00/37] Input queue for 2.6.26 merge window, Dmitry Torokhov, (Mon Apr 21, 8:44 am)
Re: [PATCH 29/37] Input: fix ordering in joystick Makefile, Dmitry Torokhov, (Mon Apr 21, 9:20 am)
Re: [PATCH 00/37] Input queue for 2.6.26 merge window, Henrique de Moraes H ..., (Mon Apr 21, 9:58 am)