drivers/rtc/rtc-ti-k3.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
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>
---
Tested deep sleep with rtcwake after IO DDR resume on AM62P-SK.
Changes in v2:
-Updated the commit message as suggested in review
-Link to v1: https://lore.kernel.org/all/20260311070214.3589965-1-a-kaur@ti.com/
---
drivers/rtc/rtc-ti-k3.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-ti-k3.c b/drivers/rtc/rtc-ti-k3.c
index ec759d8f7023..e801f5b9d757 100644
--- a/drivers/rtc/rtc-ti-k3.c
+++ b/drivers/rtc/rtc-ti-k3.c
@@ -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);
--
2.34.1
On 3/13/2026 4:47 PM, Akashdeep Kaur wrote:
> 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>
> ---
>
> Tested deep sleep with rtcwake after IO DDR resume on AM62P-SK.
>
> Changes in v2:
> -Updated the commit message as suggested in review
> -Link to v1: https://lore.kernel.org/all/20260311070214.3589965-1-a-kaur@ti.com/
>
> ---
> drivers/rtc/rtc-ti-k3.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-ti-k3.c b/drivers/rtc/rtc-ti-k3.c
> index ec759d8f7023..e801f5b9d757 100644
> --- a/drivers/rtc/rtc-ti-k3.c
> +++ b/drivers/rtc/rtc-ti-k3.c
> @@ -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);
© 2016 - 2026 Red Hat, Inc.