login
Header Space

 
 

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

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <unlisted-recipients@...>, <@...>
Cc: <linux-kernel@...>, <jkosina@...>, <akpm@...>
Date: Friday, April 18, 2008 - 12:25 am

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