From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa@the-dreams.de>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Geert Uytterhoeven <geert@linux-m68k.org>,
"linux-rtc@vger.kernel.org" <linux-rtc@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Support Opensource <Support.Opensource@diasemi.com>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH 1/2] rtc: da9063: set range
Date: Tue, 2 Apr 2019 12:42:30 +0200 [thread overview]
Message-ID: <20190402104230.GY3430@piout.net> (raw)
In-Reply-To: <DB7PR10MB2348398516E5744F4CF8C18BFE560@DB7PR10MB2348.EURPRD10.PROD.OUTLOOK.COM>
On 02/04/2019 10:33:37+0000, Steve Twiss wrote:
> Hi,
>
> > > > drivers/rtc/rtc-da9063.c | 3 +++
> > > > 1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c
> > > > index 1b792bcea3c7..53e690b0f3a2 100644
> > > > --- a/drivers/rtc/rtc-da9063.c
> > > > +++ b/drivers/rtc/rtc-da9063.c
> > > > @@ -475,6 +475,9 @@ static int da9063_rtc_probe(struct platform_device *pdev)
> > > > da9063_data_to_tm(data, &rtc->alarm_time, rtc);
> > > > rtc->rtc_sync = false;
> > > >
> > > > + if (config->rtc_data_start != RTC_SEC)
> > > > + rtc->rtc_dev->uie_unsupported = 1;
> > > > +
> > >
> > > I think we should have a comment here, like:
> > > /* FIXME: Make use of the TICK interrupt once the RTC core supports it */
>
> Is this TICK interrupt suggestion to use the DA9063 TICK interrupt to simulate
> a second granularity in the AD alarm?
>
> If I remember correctly, the original DA9063 patch set which was for AD silicon
> only, and which was sent to LKML before I took over looking at DA9063, used the
> DA9063 1-second TICK interrupt to count-down the seconds from the nearest
> minute in order to simulate second resolution on the RTC alarm for AD.
>
> ... yes. Here it is. The original patch was from Krystian Garbaciak and tried to
> support RTC alarms on the AD silicon to a second resolution by counting down
> the DA9063 TICK interrupt:
>
> https://marc.info/?l=lm-sensors&m=134613501230005&w=2
>
> However, I dropped that patch completely and wrote a new RTC device driver
> because it didn't work in my tests.
>
> The problem was: the TICK interrupt was indistinguishable from the ALARM
> interrupt for a wake event and when I tested AD silicon to wake up an Android
> device from suspend or power-off using the RTC IRQ, the device woke up on the
> ALARM minute (0 seconds), discovered it was not the correct time and immediately
> went back to sleep. Then it woke-up and returned back to sleep every TICK IRQ
> second until the correct alarm time was reached (up to 59 times!). At which point
> it woke up properly.
>
No, the suggestion is to use the TICK interrupt to have a proper UIE
support even if the alarm has a minute granularity. As stated, this is
not yet supported by the core and need some work. Some RTCs have the
following in their set_alarm:
if (tm->time.tm_sec) {
time64_t alarm_time = rtc_tm_to_time64(&tm->time);
alarm_time += 60 - tm->time.tm_sec;
rtc_time64_to_tm(alarm_time, &tm->time);
}
But my plan is to actually expose the capability to userspace and the
core so this doesn't have to be handled in the driver.
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2019-04-02 10:43 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-21 10:15 [PATCH 1/2] rtc: da9063: set range Alexandre Belloni
2019-03-21 10:15 ` [PATCH 2/2] rtc: da9063: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
2019-03-22 15:28 ` Steve Twiss
2019-04-01 8:43 ` Wolfram Sang
2019-04-01 12:42 ` Steve Twiss
2019-03-22 15:16 ` [PATCH 1/2] rtc: da9063: set range Steve Twiss
2019-04-01 8:41 ` Wolfram Sang
2019-04-01 8:59 ` Geert Uytterhoeven
2019-04-01 12:39 ` Steve Twiss
2019-04-01 12:42 ` Geert Uytterhoeven
2019-04-01 13:00 ` Steve Twiss
2019-04-01 13:21 ` Wolfram Sang
2019-04-01 13:39 ` Geert Uytterhoeven
2019-04-01 15:07 ` Wolfram Sang
2019-04-01 15:16 ` Alexandre Belloni
2019-04-01 15:52 ` Wolfram Sang
2019-04-01 18:53 ` Alexandre Belloni
2019-04-01 19:34 ` Wolfram Sang
2019-04-02 8:53 ` Alexandre Belloni
2019-04-02 9:33 ` Wolfram Sang
2019-04-02 9:51 ` Alexandre Belloni
2019-04-02 10:33 ` Steve Twiss
2019-04-02 10:42 ` Alexandre Belloni [this message]
2019-04-02 11:14 ` Wolfram Sang
2019-04-02 11:52 ` Steve Twiss
2019-04-02 9:37 ` Steve Twiss
2019-04-02 10:30 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190402104230.GY3430@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=Support.Opensource@diasemi.com \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=stwiss.opensource@diasemi.com \
--cc=wsa+renesas@sang-engineering.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).