summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2017-09-29 12:23:25 +0200
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2017-10-25 23:05:52 +0200
commit8a25c8f66c46077bd5ae8ea5f6fd6fa08ea8231a (patch)
treed91e95f91a5e933778317c5880b5a87c31c2747e /drivers
parentrtc: ds1511: use generic nvmem (diff)
downloadlinux-8a25c8f66c46077bd5ae8ea5f6fd6fa08ea8231a.tar.xz
linux-8a25c8f66c46077bd5ae8ea5f6fd6fa08ea8231a.zip
rtc: clarify the RTC offset correction
The RTC offset correction documentation is not very clear about the exact relationship between "offset" and the effect it has on the RTC. Supplement the documentation with an equation giving the relationship. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/interface.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 9eb32ead63db..672b192f8153 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -1004,6 +1004,10 @@ int rtc_read_offset(struct rtc_device *rtc, long *offset)
* to compensate for differences in the actual clock rate due to temperature,
* the crystal, capacitor, etc.
*
+ * The adjustment applied is as follows:
+ * t = t0 * (1 + offset * 1e-9)
+ * where t0 is the measured length of 1 RTC second with offset = 0
+ *
* Kernel interface to adjust an rtc clock offset.
* Return 0 on success, or a negative number on error.
* If the rtc offset is not setable (or not implemented), return -EINVAL