summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2017-06-02 17:51:42 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-06-02 17:54:28 -0700
commit58be76896786b512e97cb743ec271648623a7107 (patch)
tree5b56c601ce5eb4f86d0388ee183944d5b82dc229 /drivers/input
parent49bbbfa8d27a227521a9e07cb1612f60e8f0e8ff (diff)
downloadlinux-stable-58be76896786b512e97cb743ec271648623a7107.tar.gz
linux-stable-58be76896786b512e97cb743ec271648623a7107.tar.bz2
linux-stable-58be76896786b512e97cb743ec271648623a7107.zip
Input: axp20x-pek - add wakeup support
At least on devices with the AXP288 PMIC the device is expected to wakeup from suspend when the power-button gets pressed, add support for this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/misc/axp20x-pek.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
index f11807db6979..d3e9ce27a2be 100644
--- a/drivers/input/misc/axp20x-pek.c
+++ b/drivers/input/misc/axp20x-pek.c
@@ -253,6 +253,9 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
return error;
}
+ if (axp20x_pek->axp20x->variant == AXP288_ID)
+ enable_irq_wake(axp20x_pek->irq_dbr);
+
return 0;
}
@@ -301,10 +304,35 @@ static int axp20x_pek_probe(struct platform_device *pdev)
return 0;
}
+static int __maybe_unused axp20x_pek_resume_noirq(struct device *dev)
+{
+ struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
+
+ if (axp20x_pek->axp20x->variant != AXP288_ID)
+ return 0;
+
+ /*
+ * Clear interrupts from button presses during suspend, to avoid
+ * a wakeup power-button press getting reported to userspace.
+ */
+ regmap_write(axp20x_pek->axp20x->regmap,
+ AXP20X_IRQ1_STATE + AXP288_IRQ_POKN / 8,
+ BIT(AXP288_IRQ_POKN % 8));
+
+ return 0;
+}
+
+static const struct dev_pm_ops axp20x_pek_pm_ops = {
+#ifdef CONFIG_PM_SLEEP
+ .resume_noirq = axp20x_pek_resume_noirq,
+#endif
+};
+
static struct platform_driver axp20x_pek_driver = {
.probe = axp20x_pek_probe,
.driver = {
.name = "axp20x-pek",
+ .pm = &axp20x_pek_pm_ops,
},
};
module_platform_driver(axp20x_pek_driver);