diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2019-03-20 12:30:10 +0100 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2019-04-04 10:07:09 +0200 |
commit | beee05dfbead2331a3183dee8ddcf10066278355 (patch) | |
tree | c5518e07249ecf6bdc0658e1bf32ce60fca98e5f /drivers/rtc/rtc-sh.c | |
parent | 1097998d27da39578542e79ff865b4d74e755cd0 (diff) | |
download | linux-beee05dfbead2331a3183dee8ddcf10066278355.tar.gz linux-beee05dfbead2331a3183dee8ddcf10066278355.tar.bz2 linux-beee05dfbead2331a3183dee8ddcf10066278355.zip |
rtc: sh: set range
The SH RTC is a BCD RTC with some version having 4 digits for the year.
The range for the RTCs with only 2 digits for the year was unfortunately
shifted to handle 1999 to 2098.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-sh.c')
-rw-r--r-- | drivers/rtc/rtc-sh.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index d9e67ca4b7b9..4cca54aa6e24 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c @@ -600,6 +600,14 @@ static int __init sh_rtc_probe(struct platform_device *pdev) rtc->rtc_dev->ops = &sh_rtc_ops; rtc->rtc_dev->max_user_freq = 256; + if (rtc->capabilities & RTC_CAP_4_DIGIT_YEAR) { + rtc->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_1900; + rtc->rtc_dev->range_max = RTC_TIMESTAMP_END_9999; + } else { + rtc->rtc_dev->range_min = mktime64(1999, 1, 1, 0, 0, 0); + rtc->rtc_dev->range_max = mktime64(2098, 12, 31, 23, 59, 59); + } + ret = rtc_register_device(rtc->rtc_dev); if (ret) goto err_unmap; |