From: Lukasz Majewski <lukma@denx.de>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: Add support for century bits to m41t62 (rv4162) RTC devices
Date: Thu, 3 Oct 2019 16:10:53 +0200 [thread overview]
Message-ID: <20191003161054.1eeae401@jawa> (raw)
In-Reply-To: <20191003134329.GB575@piout.net>
[-- Attachment #1: Type: text/plain, Size: 2727 bytes --]
Hi Alexandre,
> On 03/10/2019 15:14:34+0200, Lukasz Majewski wrote:
> > Hi Alexandre,
> >
> > > On 03/10/2019 14:21:50+0200, Lukasz Majewski wrote:
> > > > >
> > > > > See the datasheet:
> > > > >
> > > > > "During any year which is a multiple of 4, the RV-4162 RTC
> > > > > will automatically insert leap day, February 29. Therefore,
> > > > > the application software must correct for this during the
> > > > > exception years (2100, 2200, etc.) as noted above."
> > > >
> > > > I'm wondering what the phrase "application software" means here?
> > > >
> > > > If it is the userland SW, then we shall at least be able to set
> > > > 2099 in this device and then count on software correction.
> > > >
> > > > If the "application software" is the kernel driver - the date
> > > > correction shall be done there (maybe some lookup table?).
> > > >
> > > > Personally, I do prefer the first option - this means that with
> > > > this patch we can set the time to e.g. 2234 year and then rely
> > > > on userland software (or libc) to do the correction.
> > > >
> > >
> > > It is not possible to ensure this correction is properly done in
> > > software, there is no point in letting the user set those bits.
Sorry, but I do see some inconsistency here.
The application note [1] says that the correction shall be done in
application SW.
The rtc-range.c program [2] sets and reads the time via ioctl (e.g.
RTC_SET_TIME, RTC_RD_TIME).
To pass your tests one needs to do the correction in linux kernel
driver for drivers/rtc/rtc-m41t80.c.
Please correct me if I'm wrong, but IMHO it shall be enough to adjust
2100, 2200, 2300, years in this driver (the submitted patch shall be
adjusted to support it - I can prepare proper v2).
> > >
> > >
> >
> > I see your point.
> >
> > However, could you share your idea on testing setting RTC time to
> > year 2100 on this particular IC (by using hctosys and friends)?
> >
>
> You can use rtc from
> https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/rtc-tools.git/
>
> You can also use rtc-range with your patch to observe that it fails in
> 2100.
Thanks for sharing useful links.
>
Note:
[1] -
https://www.microcrystal.com/fileadmin/Media/Products/RTC/App.Manual/RV-4162-C7_App-Manual.pdf
(point 4.5 and 4.6).
[2] -
https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/rtc-tools.git/tree/rtc-range.c
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-10-03 14:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-11 15:48 [PATCH] rtc: Add support for century bits to m41t62 (rv4162) RTC devices Lukasz Majewski
2019-09-30 7:56 ` Lukasz Majewski
2019-10-03 11:48 ` Alexandre Belloni
2019-10-03 12:21 ` Lukasz Majewski
2019-10-03 12:35 ` Alexandre Belloni
2019-10-03 13:14 ` Lukasz Majewski
2019-10-03 13:43 ` Alexandre Belloni
2019-10-03 14:10 ` Lukasz Majewski [this message]
2019-10-03 14:23 ` Alexandre Belloni
2019-10-03 14:49 ` Lukasz Majewski
2019-10-03 21:34 ` Alexandre Belloni
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=20191003161054.1eeae401@jawa \
--to=lukma@denx.de \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
/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).