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>
This commit is contained in:
parent
9e95f4c3c3
commit
e3eaef8ae5
@ -709,6 +709,7 @@ static struct nvmem_config sun6i_rtc_nvmem_cfg = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
|
|
||||||
/* Enable IRQ wake on suspend, to wake up from RTC. */
|
/* Enable IRQ wake on suspend, to wake up from RTC. */
|
||||||
static int sun6i_rtc_suspend(struct device *dev)
|
static int sun6i_rtc_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
@ -721,7 +722,7 @@ static int sun6i_rtc_suspend(struct device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Disable IRQ wake on resume. */
|
/* 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);
|
struct sun6i_rtc_dev *chip = dev_get_drvdata(dev);
|
||||||
|
|
||||||
@ -730,6 +731,7 @@ static int sun6i_rtc_resume(struct device *dev)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static SIMPLE_DEV_PM_OPS(sun6i_rtc_pm_ops,
|
static SIMPLE_DEV_PM_OPS(sun6i_rtc_pm_ops,
|
||||||
@ -851,6 +853,13 @@ static int sun6i_rtc_probe(struct platform_device *pdev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sun6i_rtc_shutdown(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_PM_SLEEP
|
||||||
|
sun6i_rtc_suspend(&pdev->dev);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As far as RTC functionality goes, all models are the same. The
|
* As far as RTC functionality goes, all models are the same. The
|
||||||
* datasheets claim that different models have different number of
|
* datasheets claim that different models have different number of
|
||||||
@ -875,6 +884,7 @@ MODULE_DEVICE_TABLE(of, sun6i_rtc_dt_ids);
|
|||||||
|
|
||||||
static struct platform_driver sun6i_rtc_driver = {
|
static struct platform_driver sun6i_rtc_driver = {
|
||||||
.probe = sun6i_rtc_probe,
|
.probe = sun6i_rtc_probe,
|
||||||
|
.shutdown = sun6i_rtc_shutdown,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "sun6i-rtc",
|
.name = "sun6i-rtc",
|
||||||
.of_match_table = sun6i_rtc_dt_ids,
|
.of_match_table = sun6i_rtc_dt_ids,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user