Commit 0e9b12ee authored by Akashdeep Kaur's avatar Akashdeep Kaur Committed by Alexandre Belloni
Browse files

rtc: ti-k3: Add support to resume from IO DDR low power mode



Restore the RTC HW context which may be lost when system enters
certain low power mode (IO+DDR mode).
Check if the RTC registers are locked which would indicate loss of
context (reset) and restore the context as needed.

Signed-off-by: default avatarAkashdeep Kaur <a-kaur@ti.com>
Reviewed-by: default avatarVignesh Raghavendra <vigneshr@ti.com>
Link: https://patch.msgid.link/20260313111740.1492519-1-a-kaur@ti.com


Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent e9f850ba
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -640,10 +640,18 @@ static int __maybe_unused ti_k3_rtc_suspend(struct device *dev)
static int __maybe_unused ti_k3_rtc_resume(struct device *dev)
{
	struct ti_k3_rtc *priv = dev_get_drvdata(dev);
	int ret = 0;

	if (k3rtc_check_unlocked(priv)) {
		/* RTC locked implies low power mode exit where RTC loses context */
		ret = k3rtc_configure(dev);
		if (ret)
			return ret;
	}

	if (device_may_wakeup(dev))
		disable_irq_wake(priv->irq);
	return 0;
	return ret;
}

static SIMPLE_DEV_PM_OPS(ti_k3_rtc_pm_ops, ti_k3_rtc_suspend, ti_k3_rtc_resume);