]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: sun6i: Add support for linear day storage
authorAndre Przywara <andre.przywara@arm.com>
Fri, 11 Feb 2022 12:26:29 +0000 (12:26 +0000)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 23 Mar 2022 18:58:37 +0000 (19:58 +0100)
commit3349dfd9dbf60d5abb3a8b78ff1099ffa0446306
tree01019a500f092b5b93a9e0b43f09974dc2a8b112
parent0b50e1f771d03255054ba176a7dfd8125d2bb37d
rtc: sun6i: Add support for linear day storage

Newer versions of the Allwinner RTC, as for instance found in the H616
SoC, no longer store a broken-down day/month/year representation in the
RTC_DAY_REG, but just a linear day number.
The user manual does not give any indication about the expected epoch
time of this day count, but the BSP kernel uses the UNIX epoch, which
allows easy support due to existing conversion functions in the kernel.

Allow tagging a compatible string with a flag, and use that to mark
those new RTCs. Then convert between a UNIX day number (converted into
seconds) and the broken-down day representation using mktime64() and
time64_to_tm() in the set_time/get_time functions.

That enables support for the RTC in those new chips.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220211122643.1343315-5-andre.przywara@arm.com
drivers/rtc/rtc-sun6i.c