Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions drivers/rtc/rtc-apple-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/nvmem-consumer.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_wakeirq.h>
#include <linux/regmap.h>
#include <linux/rtc.h>
#include <linux/slab.h>
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
7 changes: 6 additions & 1 deletion drivers/soc/apple/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

/*
Expand Down
Loading