]> git.ipfire.org Git - thirdparty/linux.git/commit
rtc: mt6359: Add RTC hardware range and add support for start-year
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Mon, 23 Sep 2024 10:00:09 +0000 (12:00 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 11 Nov 2024 21:00:34 +0000 (22:00 +0100)
commit34bbdc12d04e2f18a2ca96351c59e40b62da3314
tree89537cef92819c4b1d7b7c274c8b717c5c142d61
parent9beeecbd63d5187a3f86be57e7d06a072777433c
rtc: mt6359: Add RTC hardware range and add support for start-year

Add the RTC hardware range parameters to enable the possibility
of using the `start-year` devicetree property which, if present,
will set the start_secs parameter by overriding the defaults
that this driver is setting;

To keep compatibility with (hence have the same date/time reading
as) the old behavior, set:
 - range_min to 1900-01-01 00:00:00
 - range_max to 2027-12-31 23:59:59 (HW year max range is 0-127)
 - start_secs defaulting to 1968-01-02 00:00:00

Please note that the oddness of starting from January 2nd is not
a hardware quirk and it's done only to get the same date/time
reading as an RTC which time was set before this commit.

Also remove the RTC_MIN_YEAR_OFFSET addition and subtraction in
callbacks set_time() and read_time() respectively, as now this
is already done by the API.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Macpaul Lin <macpaul.lin@mediatek.com>
Link: https://lore.kernel.org/r/20240923100010.97470-3-angelogioacchino.delregno@collabora.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-mt6397.c