|
|
88f3771 |
From fbac4c05ec1d7c2d949f50baf1e934cbfbb6a494 Mon Sep 17 00:00:00 2001
|
|
|
88f3771 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
88f3771 |
Date: Mon, 17 Apr 2017 22:06:25 +0200
|
|
|
88f3771 |
Subject: [PATCH 06/16] Input: axp20x-pek - Add wakeup support
|
|
|
88f3771 |
|
|
|
88f3771 |
At least on devices with the AXP288 PMIC the device is expected to
|
|
|
88f3771 |
wakeup from suspend when the power-button gets pressed, add support
|
|
|
88f3771 |
for this.
|
|
|
88f3771 |
|
|
|
88f3771 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
88f3771 |
---
|
|
|
88f3771 |
drivers/input/misc/axp20x-pek.c | 28 ++++++++++++++++++++++++++++
|
|
|
88f3771 |
1 file changed, 28 insertions(+)
|
|
|
88f3771 |
|
|
|
88f3771 |
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
|
|
|
88f3771 |
index 400869e61a06..5f16fceaae83 100644
|
|
|
88f3771 |
--- a/drivers/input/misc/axp20x-pek.c
|
|
|
88f3771 |
+++ b/drivers/input/misc/axp20x-pek.c
|
|
|
88f3771 |
@@ -253,6 +253,9 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
|
|
|
88f3771 |
return error;
|
|
|
88f3771 |
}
|
|
|
88f3771 |
|
|
|
88f3771 |
+ if (axp20x_pek->axp20x->variant == AXP288_ID)
|
|
|
88f3771 |
+ enable_irq_wake(axp20x_pek->irq_dbr);
|
|
|
88f3771 |
+
|
|
|
88f3771 |
return 0;
|
|
|
88f3771 |
}
|
|
|
88f3771 |
|
|
|
88f3771 |
@@ -331,10 +334,35 @@ static int axp20x_pek_probe(struct platform_device *pdev)
|
|
|
88f3771 |
return 0;
|
|
|
88f3771 |
}
|
|
|
88f3771 |
|
|
|
88f3771 |
+static int __maybe_unused axp20x_pek_resume_noirq(struct device *dev)
|
|
|
88f3771 |
+{
|
|
|
88f3771 |
+ struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
|
|
|
88f3771 |
+
|
|
|
88f3771 |
+ if (axp20x_pek->axp20x->variant != AXP288_ID)
|
|
|
88f3771 |
+ return 0;
|
|
|
88f3771 |
+
|
|
|
88f3771 |
+ /*
|
|
|
88f3771 |
+ * Clear interrupts from button presses during suspend, to avoid
|
|
|
88f3771 |
+ * a wakeup power-button press getting reported to userspace.
|
|
|
88f3771 |
+ */
|
|
|
88f3771 |
+ regmap_write(axp20x_pek->axp20x->regmap,
|
|
|
88f3771 |
+ AXP20X_IRQ1_STATE + AXP288_IRQ_POKN / 8,
|
|
|
88f3771 |
+ BIT(AXP288_IRQ_POKN % 8));
|
|
|
88f3771 |
+
|
|
|
88f3771 |
+ return 0;
|
|
|
88f3771 |
+}
|
|
|
88f3771 |
+
|
|
|
88f3771 |
+const struct dev_pm_ops axp20x_pek_pm_ops = {
|
|
|
88f3771 |
+#ifdef CONFIG_PM_SLEEP
|
|
|
88f3771 |
+ .resume_noirq = axp20x_pek_resume_noirq,
|
|
|
88f3771 |
+#endif
|
|
|
88f3771 |
+};
|
|
|
88f3771 |
+
|
|
|
88f3771 |
static struct platform_driver axp20x_pek_driver = {
|
|
|
88f3771 |
.probe = axp20x_pek_probe,
|
|
|
88f3771 |
.driver = {
|
|
|
88f3771 |
.name = "axp20x-pek",
|
|
|
88f3771 |
+ .pm = &axp20x_pek_pm_ops,
|
|
|
88f3771 |
},
|
|
|
88f3771 |
};
|
|
|
88f3771 |
module_platform_driver(axp20x_pek_driver);
|
|
|
88f3771 |
--
|
|
|
88f3771 |
2.13.0
|
|
|
88f3771 |
|