Q: use 1s irqs to overcome alarm minute granularity?
Hi,
so alarms of the Renesas RZ-N1 RTC can only have one-minute-granularity. However, it does have a one-second-interrupt. Has it been tried already for some driver to use such an interrupt to emulate second-granularity of the alarm? My searches did not yield results so far.
So the idea is, of course, to the let the alarm fire on the minutes. Then, enable the second-update irqs until reading the seconds matches the requested seconds of the alarm.
It would not only gain us a better resolution for alarms, but also allows for enabling UIE.
I get it that handling the different interrupts may get tricky if e.g. there is a change in the timerqueue while something has already been setup or so. I need to research this, I have currently no idea how this is handled at all.
But while doing so, I wanted to ask if there are already opinions if this approach is feasible or not. I can't imagine that I am the first one to try it, so there probably are experiences out there?
Thanks and happy hacking,
Wolfram
+ Claudiu, Looks RZ/G3S RTC can handle it.
●
Periodic interrupt (PRD)
? 2 seconds, 1 second, 1/2 second, 1/4 second, 1/8 second, 1/16 second, 1/32
Cheers,
Biju
Quoted 29 lines
-----Original Message-----
From: Wolfram Sang <[email protected]>
Sent: 25 February 2025 10:19
To: [email protected]; Alexandre Belloni <[email protected]>
Cc: [email protected]; Miquel Raynal <[email protected]>
Subject: Q: use 1s irqs to overcome alarm minute granularity?Hi,
so alarms of the Renesas RZ-N1 RTC can only have one-minute-granularity.
However, it does have a one-second-interrupt. Has it been tried already for some driver to use such an interrupt to emulate second-granularity of the alarm? My searches did not yield results so far.So the idea is, of course, to the let the alarm fire on the minutes.
Then, enable the second-update irqs until reading the seconds matches the requested seconds of the alarm.It would not only gain us a better resolution for alarms, but also allows for enabling UIE.
I get it that handling the different interrupts may get tricky if e.g.
there is a change in the timerqueue while something has already been setup or so. I need to research this, I have currently no idea how this is handled at all.But while doing so, I wanted to ask if there are already opinions if this approach is feasible or not. I can't imagine that I am the first one to try it, so there probably are experiences out there?
Thanks and happy hacking,
Wolfram
Quoted 4 lines · Biju Das
+ Claudiu, Looks RZ/G3S RTC can handle it.
●
Periodic interrupt (PRD)
? 2 seconds, 1 second, 1/2 second, 1/4 second, 1/8 second, 1/16 second, 1/32
This driver does not have that problem, because the alarms support seconds right away:
408 writeb(RTCA3_AR_ENB | bin2bcd(tm->tm_sec), priv->base + RTCA3_RSECAR);
Alexandre Belloni
maintainerHi,
Quoted 8 lines · Wolfram Sang
so alarms of the Renesas RZ-N1 RTC can only have one-minute-granularity. However, it does have a one-second-interrupt. Has it been tried already for some driver to use such an interrupt to emulate second-granularity of the alarm? My searches did not yield results so far.
So the idea is, of course, to the let the alarm fire on the minutes. Then, enable the second-update irqs until reading the seconds matches the requested seconds of the alarm.
I'd say this is probably useless because you will already be awake anyway so I don't see the clear benefit.
Quoted 3 lines
It would not only gain us a better resolution for alarms, but also allows for enabling UIE.
This is already something you can do. I admit this has become super convoluted since Jon switched UIEs to be handled using the alarm interrupt...
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 7 lines
Quoted 3 lines
It would not only gain us a better resolution for alarms, but also allows for enabling UIE.
This is already something you can do. I admit this has become super convoluted since Jon switched UIEs to be handled using the alarm interrupt...
How can I enable UIE with alarms which do not support one-second-resolution? I found that most, if not all, drivers which have RTC_FEATURE_ALARM_RES_MINUTE or RTC_FEATURE_ALARM_RES_2S set, they all disable RTC_FEATURE_UPDATE_INTERRUPT. Which makes sense to me when I look at the UIE-via-alarms code in the RTC core. But, yes, it is convoluted, so maybe I am missing something?
Thanks for your fast reply!