Re: [PATCH] rtc: Add support for century bits to m41t62 (rv4162) RTC devices

From: Alexandre Belloni
Date: Thu Oct 03 2019 - 10:23:45 EST


On 03/10/2019 16:10:53+0200, Lukasz Majewski wrote:
> 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).
>

There is no way you will be able to know when to adjust the date because
Linux may or may not be running when the boundary is crossed.

The only useful range for an RTC is its fully contiguous range. If it
needs software to run to support an extended range, it can't be used in
the context of Linux.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com