summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorSundar Iyer <sundar.iyer@stericsson.com>2010-10-22 11:43:17 +0530
committerRobert Marklund <robert.marklund@stericsson.com>2011-10-05 11:13:24 +0200
commit299e614f3b7dff4c697a348f453b42b2c74d8025 (patch)
tree75edf76e5c601612424d9c802202111e9408002c /drivers/input
parent6c7dd916f6147b8da4910310d4d1401c3a874f1f (diff)
input/keypad-stmpe: add suspend/resume support
ST-Ericcson ID: TASK_ER170552 Change-Id: Id814bec06a86e8a3215ef662d5f01a7ee929d26a Signed-off-by: Sundar Iyer <sundar.iyer@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/7526 Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/keyboard/stmpe-keypad.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/drivers/input/keyboard/stmpe-keypad.c b/drivers/input/keyboard/stmpe-keypad.c
index f386e07cf31..a01a18f5735 100644
--- a/drivers/input/keyboard/stmpe-keypad.c
+++ b/drivers/input/keyboard/stmpe-keypad.c
@@ -373,14 +373,14 @@ static int __devinit stmpe_keypad_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "unable to get irq: %d\n", ret);
goto out_unregisterinput;
}
- /* sysfs implementation for dynamic enable/disable the input event */
+
+ /* sysfs implementation for dynamic enable/disable the input event */
ret = sysfs_create_group(&pdev->dev.kobj, &stmpe_attr_group);
if (ret) {
dev_err(&pdev->dev, "failed to create sysfs entries\n");
goto out_free_irq;
}
-
keypad->enable = true;
platform_set_drvdata(pdev, keypad);
@@ -415,9 +415,43 @@ static int __devexit stmpe_keypad_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+static int stmpe_keypad_suspend(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct stmpe_keypad *keypad = platform_get_drvdata(pdev);
+ struct stmpe *stmpe = keypad->stmpe;
+
+ if (!device_may_wakeup(stmpe->dev))
+ stmpe_disable(stmpe, STMPE_BLOCK_KEYPAD);
+
+ return 0;
+}
+
+static int stmpe_keypad_resume(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct stmpe_keypad *keypad = platform_get_drvdata(pdev);
+ struct stmpe *stmpe = keypad->stmpe;
+
+ if (!device_may_wakeup(stmpe->dev))
+ stmpe_enable(stmpe, STMPE_BLOCK_KEYPAD);
+
+ return 0;
+}
+
+static const struct dev_pm_ops stmpe_keypad_dev_pm_ops = {
+ .suspend = stmpe_keypad_suspend,
+ .resume = stmpe_keypad_resume,
+};
+#endif
+
static struct platform_driver stmpe_keypad_driver = {
.driver.name = "stmpe-keypad",
.driver.owner = THIS_MODULE,
+#if CONFIG_PM
+ .driver.pm = &stmpe_keypad_dev_pm_ops,
+#endif
.probe = stmpe_keypad_probe,
.remove = __devexit_p(stmpe_keypad_remove),
};