* [PATCH] rtc: ti-k3: Add support to resume from IO DDR low power mode
@ 2026-03-11 7:02 Akashdeep Kaur
2026-03-13 8:23 ` Vignesh Raghavendra
0 siblings, 1 reply; 3+ messages in thread
From: Akashdeep Kaur @ 2026-03-11 7:02 UTC (permalink / raw)
To: praneeth, nm, vigneshr, alexandre.belloni, linux-rtc,
linux-kernel
Cc: msp, vishalm, sebin.francis, d-gole, k-willis, a-kaur
During IO DDR low power mode, the RTC IP is reset and loses its
register configuration. The DDR memory still preserves all driver states
(reference counts, software context). System clocks are saved and restored
by Device Manager (DM) firmware during the resume sequence.
Add support to reconfigure the RTC IP registers in resume handler only if
resume hook is called during IO DDR low power mode resume.
Signed-off-by: Akashdeep Kaur <a-kaur@ti.com>
---
Tested deep sleep with rtcwake after IO DDR resume on AM62P-SK.
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] rtc: ti-k3: Add support to resume from IO DDR low power mode
2026-03-11 7:02 [PATCH] rtc: ti-k3: Add support to resume from IO DDR low power mode Akashdeep Kaur
@ 2026-03-13 8:23 ` Vignesh Raghavendra
2026-03-13 11:17 ` Akashdeep Kaur
0 siblings, 1 reply; 3+ messages in thread
From: Vignesh Raghavendra @ 2026-03-13 8:23 UTC (permalink / raw)
To: Akashdeep Kaur, praneeth, nm, alexandre.belloni, linux-rtc,
linux-kernel
Cc: msp, vishalm, sebin.francis, d-gole, k-willis
On 11/03/26 12:32, Akashdeep Kaur wrote:
> During IO DDR low power mode, the RTC IP is reset and loses its
> register configuration.
> The DDR memory still preserves all driver states
> (reference counts, software context).
That's the definition of Suspend to RAM
> System clocks are saved and restored
> by Device Manager (DM) firmware during the resume sequence.
Not relevant for this patch in particular.
> Add support to reconfigure the RTC IP registers in resume handler only if
> resume hook is called during IO DDR low power mode resume.
>
Above all is probably bit too verbose. Below text is all thats needed:
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.
>
> ---
> 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);
--
Regards
Vignesh
https://ti.com/opensource
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] rtc: ti-k3: Add support to resume from IO DDR low power mode
2026-03-13 8:23 ` Vignesh Raghavendra
@ 2026-03-13 11:17 ` Akashdeep Kaur
0 siblings, 0 replies; 3+ messages in thread
From: Akashdeep Kaur @ 2026-03-13 11:17 UTC (permalink / raw)
To: Vignesh Raghavendra, praneeth, nm, alexandre.belloni, linux-rtc,
linux-kernel
Cc: msp, vishalm, sebin.francis, d-gole, k-willis
Hi Vignesh,
On 13/03/26 13:53, Vignesh Raghavendra wrote:
>
>
> On 11/03/26 12:32, Akashdeep Kaur wrote:
>> During IO DDR low power mode, the RTC IP is reset and loses its
>> register configuration.
>
>> The DDR memory still preserves all driver states
>> (reference counts, software context).
>
> That's the definition of Suspend to RAM
>
>> System clocks are saved and restored
>> by Device Manager (DM) firmware during the resume sequence.
>
> Not relevant for this patch in particular.
>
>> Add support to reconfigure the RTC IP registers in resume handler only if
>> resume hook is called during IO DDR low power mode resume.
>>
>
> Above all is probably bit too verbose. Below text is all thats needed:
>
> 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.
Updated the commit message as suggested.
Regards,
Akashdeep Kaur
>
>> Signed-off-by: Akashdeep Kaur <a-kaur@ti.com>
>> ---
>>
>> Tested deep sleep with rtcwake after IO DDR resume on AM62P-SK.
>>
>> ---
>> 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);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-13 11:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-11 7:02 [PATCH] rtc: ti-k3: Add support to resume from IO DDR low power mode Akashdeep Kaur
2026-03-13 8:23 ` Vignesh Raghavendra
2026-03-13 11:17 ` Akashdeep Kaur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox