Re: [PATCH 2/4] rtc: s3c: Add time range

From: Alexandre Belloni
Date: Tue Oct 19 2021 - 17:04:52 EST


On 19/10/2021 22:12:09+0300, Sam Protsenko wrote:
> > It would be better to pass the proper values because else nobody will
> > ever come back and fix it (hence why I didn't move that driver to
> > devm_rtc_register_device yet).
> >
>
> Krzysztof, do you have by chance the doc for different SoCs supported
> by S3C RTC driver? I can implement proper values for min/max range for
> each SoC, as Alexandre asked, by adding those to driver data. But I
> need max year register value (100, 1000, etc) for each of those chips:
>
> - "samsung,s3c2410-rtc"
> - "samsung,s3c2416-rtc"
> - "samsung,s3c2443-rtc"
> - "samsung,s3c6410-rtc"
> - "samsung,exynos3250-rtc"
>
> For example Exynos850 TRM states that BCDYEAR register has [11:0] bits
> for holding the year value in BCD format, so it's 10^(12/4)=1000 years
> max.
>

And the question will be whether time is contiguous over this period. A
very common thing is that the RTC will think that years divisible by 100
are not leap years, even if the register accepts higher values. This
makes it work for 2000 but fails in 2100.

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