diff --git a/drivers/rtc/rtc-apple-pmu.c b/drivers/rtc/rtc-apple-pmu.c index dd1abea676f18..cd46c9b9a10b1 100644 --- a/drivers/rtc/rtc-apple-pmu.c +++ b/drivers/rtc/rtc-apple-pmu.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -450,6 +451,7 @@ static void apple_pmu_rtc_release(void *context) struct apple_pmu_rtc *rtc = dev_get_drvdata(dev); disable_irq(rtc->interrupt); + dev_pm_clear_wake_irq(dev); mutex_lock(&rtc->transaction); if (apple_pmu_rtc_stop_alarm(rtc)) dev_err(dev, "cannot disable RTC alarm on removal\n"); @@ -493,14 +495,17 @@ static int apple_pmu_rtc_probe(struct platform_device *pdev) if (error) return error; /* - * This interrupt remains live during retained-power s2idle. The - * thread uses the parent PMIC's SPMI regmap to acknowledge the alarm. - * Off-domain wake routing is not established by this driver. + * Let the IRQ core wake the system before the thread acknowledges the + * alarm over the parent PMIC's SPMI regmap. Off-domain wake routing is + * still supplied by the platform sleep implementation. */ error = devm_request_threaded_irq(dev, rtc->interrupt, NULL, apple_pmu_rtc_interrupt, - IRQF_NO_AUTOEN | IRQF_NO_SUSPEND | IRQF_ONESHOT, + IRQF_NO_AUTOEN | IRQF_ONESHOT, dev_name(dev), dev); + if (error) + goto disable_wakeup; + error = dev_pm_set_wake_irq(dev, rtc->interrupt); if (error) goto disable_wakeup; error = apple_pmu_rtc_init_alarm(rtc); @@ -516,6 +521,7 @@ static int apple_pmu_rtc_probe(struct platform_device *pdev) return 0; disable_wakeup: + dev_pm_clear_wake_irq(dev); device_init_wakeup(dev, false); return error; } diff --git a/drivers/soc/apple/sleep.c b/drivers/soc/apple/sleep.c index 1227c98d0abb4..443ef75b8cfab 100644 --- a/drivers/soc/apple/sleep.c +++ b/drivers/soc/apple/sleep.c @@ -2859,6 +2859,10 @@ static int apple_sleep_begin(suspend_state_t state) { /* The last sleep's cut is its port controller's to take, by its .complete. */ WRITE_ONCE(sleep_debug_link_cut, false); + /* The PM core also calls .begin for s2idle when no s2idle ops are installed. */ + if (state != PM_SUSPEND_MEM) + return 0; + if (apple_sleep) { apple_sleep->apcie_port_stopped = false; apple_sleep->usb_down_ran = false; @@ -2873,7 +2877,8 @@ static int apple_sleep_begin(suspend_state_t state) static void apple_sleep_end(void) { - writel(0, apple_sleep->wdt + WDT_WD2_CTL); + if (pm_suspend_via_firmware()) + writel(0, apple_sleep->wdt + WDT_WD2_CTL); } /*