Skip to content

Commit cf35c00

Browse files
smaeulrepojohnray
authored andcommitted
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>
1 parent 0293c4a commit cf35c00

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/rtc/rtc-sun6i.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,6 @@ static const struct rtc_class_ops sun6i_rtc_ops = {
679679
.alarm_irq_enable = sun6i_rtc_alarm_irq_enable
680680
};
681681

682-
#ifdef CONFIG_PM_SLEEP
683682
/* Enable IRQ wake on suspend, to wake up from RTC. */
684683
static int sun6i_rtc_suspend(struct device *dev)
685684
{
@@ -692,7 +691,7 @@ static int sun6i_rtc_suspend(struct device *dev)
692691
}
693692

694693
/* Disable IRQ wake on resume. */
695-
static int sun6i_rtc_resume(struct device *dev)
694+
static int __maybe_unused sun6i_rtc_resume(struct device *dev)
696695
{
697696
struct sun6i_rtc_dev *chip = dev_get_drvdata(dev);
698697

@@ -701,7 +700,6 @@ static int sun6i_rtc_resume(struct device *dev)
701700

702701
return 0;
703702
}
704-
#endif
705703

706704
static SIMPLE_DEV_PM_OPS(sun6i_rtc_pm_ops,
707705
sun6i_rtc_suspend, sun6i_rtc_resume);
@@ -817,6 +815,11 @@ static int sun6i_rtc_probe(struct platform_device *pdev)
817815
return 0;
818816
}
819817

818+
static void sun6i_rtc_shutdown(struct platform_device *pdev)
819+
{
820+
sun6i_rtc_suspend(&pdev->dev);
821+
}
822+
820823
/*
821824
* As far as RTC functionality goes, all models are the same. The
822825
* datasheets claim that different models have different number of
@@ -839,6 +842,7 @@ MODULE_DEVICE_TABLE(of, sun6i_rtc_dt_ids);
839842

840843
static struct platform_driver sun6i_rtc_driver = {
841844
.probe = sun6i_rtc_probe,
845+
.shutdown = sun6i_rtc_shutdown,
842846
.driver = {
843847
.name = "sun6i-rtc",
844848
.of_match_table = sun6i_rtc_dt_ids,

0 commit comments

Comments
 (0)