aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEric Miao <eric.y.miao@gmail.com>2008-06-02 11:20:55 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-06-02 11:20:55 -0400
commit39ab9ddeb3e9573a1ea9a17a1431ea5c81681964 (patch)
treecf5b84c00487e5253369276dc66ea96442a1f43c /drivers
parente8ef4347099584b49ecf74144ad2089b724292cf (diff)
Input: pxa27x_keypad - add wakeup support
Signed-off-by: Eric Miao <eric.miao@marvell.com> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/keyboard/pxa27x_keypad.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index 3dea0c5077a9..c7c9599b315d 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -105,6 +105,8 @@ struct pxa27x_keypad {
105 struct input_dev *input_dev; 105 struct input_dev *input_dev;
106 void __iomem *mmio_base; 106 void __iomem *mmio_base;
107 107
108 int irq;
109
108 /* matrix key code map */ 110 /* matrix key code map */
109 unsigned int matrix_keycodes[MAX_MATRIX_KEY_NUM]; 111 unsigned int matrix_keycodes[MAX_MATRIX_KEY_NUM];
110 112
@@ -385,6 +387,10 @@ static int pxa27x_keypad_suspend(struct platform_device *pdev, pm_message_t stat
385 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 387 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
386 388
387 clk_disable(keypad->clk); 389 clk_disable(keypad->clk);
390
391 if (device_may_wakeup(&pdev->dev))
392 enable_irq_wake(keypad->irq);
393
388 return 0; 394 return 0;
389} 395}
390 396
@@ -393,6 +399,9 @@ static int pxa27x_keypad_resume(struct platform_device *pdev)
393 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 399 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
394 struct input_dev *input_dev = keypad->input_dev; 400 struct input_dev *input_dev = keypad->input_dev;
395 401
402 if (device_may_wakeup(&pdev->dev))
403 disable_irq_wake(keypad->irq);
404
396 mutex_lock(&input_dev->mutex); 405 mutex_lock(&input_dev->mutex);
397 406
398 if (input_dev->users) { 407 if (input_dev->users) {
@@ -497,6 +506,8 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev)
497 goto failed_free_dev; 506 goto failed_free_dev;
498 } 507 }
499 508
509 keypad->irq = irq;
510
500 /* Register the input device */ 511 /* Register the input device */
501 error = input_register_device(input_dev); 512 error = input_register_device(input_dev);
502 if (error) { 513 if (error) {
@@ -504,6 +515,8 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev)
504 goto failed_free_irq; 515 goto failed_free_irq;
505 } 516 }
506 517
518 device_init_wakeup(&pdev->dev, 1);
519
507 return 0; 520 return 0;
508 521
509failed_free_irq: 522failed_free_irq:
@@ -527,7 +540,7 @@ static int __devexit pxa27x_keypad_remove(struct platform_device *pdev)
527 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 540 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
528 struct resource *res; 541 struct resource *res;
529 542
530 free_irq(platform_get_irq(pdev, 0), pdev); 543 free_irq(keypad->irq, pdev);
531 544
532 clk_disable(keypad->clk); 545 clk_disable(keypad->clk);
533 clk_put(keypad->clk); 546 clk_put(keypad->clk);