meta-sunxi/recipes-kernel/linux/linux-mainline/sunxi-kmeta/bsp/orange-pi-3lts/Input-axp20x-pek-allow-wakeup-after-shutdown-6_1.patch

53 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 2 Jan 2021 15:52:27 -0600
Subject: [PATCH] Input: axp20x-pek - allow wakeup after shutdown
While the AXP20x PMIC handles the power button itself after shutting
down, it is not always possible to use the PMIC's built-in shutdown
feature, such as when other wakeup sources are needed (for example, an
IR remote or wake-on-LAN) that require firmware support. In that case,
the PMIC remains on, but suspended, until the board is powered back on.
During this "fake" off state, IRQ configuration is similar to system
sleep, where enable_irq_wake() must be call on an IRQ for it to be
wakeup capable. Run the suspend callback to arm the power button IRQs
during the shutdown process, so the power button works in this state.
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
drivers/input/misc/axp20x-pek.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/drivers/input/misc/axp20x-pek.c
+++ b/drivers/input/misc/axp20x-pek.c
@@ -354,7 +354,7 @@ static int axp20x_pek_probe(struct platf
return 0;
}
-static int __maybe_unused axp20x_pek_suspend(struct device *dev)
+static int axp20x_pek_suspend(struct device *dev)
{
struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
@@ -413,6 +413,11 @@ static const struct dev_pm_ops axp20x_pe
#endif
};
+static void axp20x_pek_shutdown(struct platform_device *pdev)
+{
+ axp20x_pek_suspend(&pdev->dev);
+}
+
static const struct platform_device_id axp_pek_id_match[] = {
{
.name = "axp20x-pek",
@@ -428,6 +433,7 @@ MODULE_DEVICE_TABLE(platform, axp_pek_id
static struct platform_driver axp20x_pek_driver = {
.probe = axp20x_pek_probe,
+ .shutdown = axp20x_pek_shutdown,
.id_table = axp_pek_id_match,
.driver = {
.name = "axp20x-pek",