Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269511
b: refs/heads/master
c: 81e8f2b
h: refs/heads/master
i:
  269509: 1ad2e68
  269507: 13da601
  269503: 0bf35c5
v: v3
  • Loading branch information
Hui Wang authored and Dmitry Torokhov committed Oct 13, 2011
1 parent 5fc93d6 commit 20f1230
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 05be8b81aafd4f95106a91ff3fd8581fa984fad9
refs/heads/master: 81e8f2bc82cd591a749c0cc5694f57676db749ae
44 changes: 44 additions & 0 deletions trunk/drivers/input/keyboard/imx_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,54 @@ static int __devexit imx_keypad_remove(struct platform_device *pdev)
return 0;
}

#ifdef CONFIG_PM_SLEEP
static int imx_kbd_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct imx_keypad *kbd = platform_get_drvdata(pdev);
struct input_dev *input_dev = kbd->input_dev;

/* imx kbd can wake up system even clock is disabled */
mutex_lock(&input_dev->mutex);

if (input_dev->users)
clk_disable(kbd->clk);

mutex_unlock(&input_dev->mutex);

if (device_may_wakeup(&pdev->dev))
enable_irq_wake(kbd->irq);

return 0;
}

static int imx_kbd_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct imx_keypad *kbd = platform_get_drvdata(pdev);
struct input_dev *input_dev = kbd->input_dev;

if (device_may_wakeup(&pdev->dev))
disable_irq_wake(kbd->irq);

mutex_lock(&input_dev->mutex);

if (input_dev->users)
clk_enable(kbd->clk);

mutex_unlock(&input_dev->mutex);

return 0;
}
#endif

static SIMPLE_DEV_PM_OPS(imx_kbd_pm_ops, imx_kbd_suspend, imx_kbd_resume);

static struct platform_driver imx_keypad_driver = {
.driver = {
.name = "imx-keypad",
.owner = THIS_MODULE,
.pm = &imx_kbd_pm_ops,
},
.probe = imx_keypad_probe,
.remove = __devexit_p(imx_keypad_remove),
Expand Down

0 comments on commit 20f1230

Please sign in to comment.