summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ab-b5ze-s3.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2018-05-17 22:20:40 +0200
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2018-05-17 22:23:25 +0200
commitc402f8ead68ccd05d63f79ab729184498c3467b3 (patch)
tree0c2fe6f5422b1b03c200f1bad6d376af2cbff0e6 /drivers/rtc/rtc-ab-b5ze-s3.c
parent8bde032b280605c21a247557de9ee71e5835cab8 (diff)
downloadtalos-obmc-linux-c402f8ead68ccd05d63f79ab729184498c3467b3.tar.gz
talos-obmc-linux-c402f8ead68ccd05d63f79ab729184498c3467b3.zip
rtc: ab-b5ze-s3: let the core handle the RTC range
The ab-b5ze-s3 RTC is storing the year in an 8bit bcd coded register so it can handle dates from year 2000 to year 2099. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-ab-b5ze-s3.c')
-rw-r--r--drivers/rtc/rtc-ab-b5ze-s3.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/rtc/rtc-ab-b5ze-s3.c b/drivers/rtc/rtc-ab-b5ze-s3.c
index f486912577e7..2233601761ac 100644
--- a/drivers/rtc/rtc-ab-b5ze-s3.c
+++ b/drivers/rtc/rtc-ab-b5ze-s3.c
@@ -265,15 +265,6 @@ static int abb5zes3_rtc_set_time(struct device *dev, struct rtc_time *tm)
u8 regs[ABB5ZES3_REG_RTC_SC + ABB5ZES3_RTC_SEC_LEN];
int ret;
- /*
- * Year register is 8-bit wide and bcd-coded, i.e records values
- * between 0 and 99. tm_year is an offset from 1900 and we are
- * interested in the 2000-2099 range, so any value less than 100
- * is invalid.
- */
- if (tm->tm_year < 100)
- return -EINVAL;
-
regs[ABB5ZES3_REG_RTC_SC] = bin2bcd(tm->tm_sec); /* MSB=0 clears OSC */
regs[ABB5ZES3_REG_RTC_MN] = bin2bcd(tm->tm_min);
regs[ABB5ZES3_REG_RTC_HR] = bin2bcd(tm->tm_hour); /* 24-hour format */
@@ -951,6 +942,8 @@ static int abb5zes3_probe(struct i2c_client *client,
}
data->rtc->ops = &rtc_ops;
+ data->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
+ data->rtc->range_max = RTC_TIMESTAMP_END_2099;
/* Enable battery low detection interrupt if battery not already low */
if (!data->battery_low && data->irq) {
OpenPOWER on IntegriCloud