mirror of
https://github.com/linux-sunxi/meta-sunxi.git
synced 2024-11-14 17:28:23 +01:00
63 lines
1.9 KiB
Diff
63 lines
1.9 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] rtc: sun6i: Allow RTC wakeup after shutdown
|
||
|
|
||
|
Only IRQs that have enable_irq_wake() called on them can wake the system
|
||
|
from sleep or after it has been shut down. Currently, the RTC alarm can
|
||
|
only wake the system from sleep. Run the suspend callback to arm the IRQ
|
||
|
during the shutdown process, so the RTC alarm also works after shutdown.
|
||
|
|
||
|
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
||
|
---
|
||
|
drivers/rtc/rtc-sun6i.c | 10 +++++++---
|
||
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
||
|
|
||
|
--- a/drivers/rtc/rtc-sun6i.c
|
||
|
+++ b/drivers/rtc/rtc-sun6i.c
|
||
|
@@ -641,7 +641,6 @@ static const struct rtc_class_ops sun6i_
|
||
|
.alarm_irq_enable = sun6i_rtc_alarm_irq_enable
|
||
|
};
|
||
|
|
||
|
-#ifdef CONFIG_PM_SLEEP
|
||
|
/* Enable IRQ wake on suspend, to wake up from RTC. */
|
||
|
static int sun6i_rtc_suspend(struct device *dev)
|
||
|
{
|
||
|
@@ -654,7 +653,7 @@ static int sun6i_rtc_suspend(struct devi
|
||
|
}
|
||
|
|
||
|
/* Disable IRQ wake on resume. */
|
||
|
-static int sun6i_rtc_resume(struct device *dev)
|
||
|
+static int __maybe_unused sun6i_rtc_resume(struct device *dev)
|
||
|
{
|
||
|
struct sun6i_rtc_dev *chip = dev_get_drvdata(dev);
|
||
|
|
||
|
@@ -663,7 +662,6 @@ static int sun6i_rtc_resume(struct devic
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
-#endif
|
||
|
|
||
|
static SIMPLE_DEV_PM_OPS(sun6i_rtc_pm_ops,
|
||
|
sun6i_rtc_suspend, sun6i_rtc_resume);
|
||
|
@@ -735,6 +733,11 @@ static int sun6i_rtc_probe(struct platfo
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
+static void sun6i_rtc_shutdown(struct platform_device *pdev)
|
||
|
+{
|
||
|
+ sun6i_rtc_suspend(&pdev->dev);
|
||
|
+}
|
||
|
+
|
||
|
/*
|
||
|
* As far as RTC functionality goes, all models are the same. The
|
||
|
* datasheets claim that different models have different number of
|
||
|
@@ -755,6 +758,7 @@ MODULE_DEVICE_TABLE(of, sun6i_rtc_dt_ids
|
||
|
|
||
|
static struct platform_driver sun6i_rtc_driver = {
|
||
|
.probe = sun6i_rtc_probe,
|
||
|
+ .shutdown = sun6i_rtc_shutdown,
|
||
|
.driver = {
|
||
|
.name = "sun6i-rtc",
|
||
|
.of_match_table = sun6i_rtc_dt_ids,
|