Skip to content

Commit 0e9b12e

Browse files
akashdeep-tialexandrebelloni
authored andcommitted
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: Akashdeep Kaur <a-kaur@ti.com> Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com> Link: https://patch.msgid.link/20260313111740.1492519-1-a-kaur@ti.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent e9f850b commit 0e9b12e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

drivers/rtc/rtc-ti-k3.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,10 +640,18 @@ static int __maybe_unused ti_k3_rtc_suspend(struct device *dev)
640640
static int __maybe_unused ti_k3_rtc_resume(struct device *dev)
641641
{
642642
struct ti_k3_rtc *priv = dev_get_drvdata(dev);
643+
int ret = 0;
644+
645+
if (k3rtc_check_unlocked(priv)) {
646+
/* RTC locked implies low power mode exit where RTC loses context */
647+
ret = k3rtc_configure(dev);
648+
if (ret)
649+
return ret;
650+
}
643651

644652
if (device_may_wakeup(dev))
645653
disable_irq_wake(priv->irq);
646-
return 0;
654+
return ret;
647655
}
648656

649657
static SIMPLE_DEV_PM_OPS(ti_k3_rtc_pm_ops, ti_k3_rtc_suspend, ti_k3_rtc_resume);

0 commit comments

Comments
 (0)