summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rtc/rtc-pcf8523.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c
index c93acade7205..83e92e8206e4 100644
--- a/drivers/rtc/rtc-pcf8523.c
+++ b/drivers/rtc/rtc-pcf8523.c
@@ -379,6 +379,16 @@ static int pcf8523_rtc_set_offset(struct device *dev, long offset)
return regmap_write(pcf8523->regmap, PCF8523_REG_OFFSET, value);
}
+static void pcf8523_rtc_pre_register(struct rtc_device *rtc)
+{
+ /*
+ * "The first increment of the time circuits is between 0.499878s
+ * and 0.5s after STOP is released. Measurement on iMX6 show that
+ * -485ms gives a time set within +/- 5ms.
+ */
+ rtc->set_offset_nsec = -495 * NSEC_PER_MSEC;
+}
+
static const struct rtc_class_ops pcf8523_rtc_ops = {
.read_time = pcf8523_rtc_read_time,
.set_time = pcf8523_rtc_set_time,
@@ -390,6 +400,7 @@ static const struct rtc_class_ops pcf8523_rtc_ops = {
.set_offset = pcf8523_rtc_set_offset,
.param_get = pcf8523_param_get,
.param_set = pcf8523_param_set,
+ .pre_register = pcf8523_rtc_pre_register,
};
static const struct regmap_config regmap_config = {