From patchwork Fri Sep 29 10:23:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 819859 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-rtc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="Q3bmIBH6"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3y3SMC4vb7z9t2V for ; Fri, 29 Sep 2017 20:23:35 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751224AbdI2KXe (ORCPT ); Fri, 29 Sep 2017 06:23:34 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:43498 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750936AbdI2KXe (ORCPT ); Fri, 29 Sep 2017 06:23:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From; bh=ePhXPbrRIWBzefoHZS/4sqabu/6MD/d6GvLI3ZFjMn0=; b=Q3bmIBH6JDcLp0tvJXJidraLKGd0C32/QIFu4DYnXNsCVOqYgjRMgE+FspvLCdFfiJFXVeZF6Alr0FlTo4lm91Ib/9QCLOuTTiwR/vy7Op40TWEvspVpNxt9OWFLkLcWCKObNxK2OFWaylwndjlZiUfjNq+mV3tA3bwiCk+3Fpo=; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:36176 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1dxsSC-0000Pt-GR; Fri, 29 Sep 2017 11:23:32 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1dxsS5-0006RD-Sy; Fri, 29 Sep 2017 11:23:25 +0100 From: Russell King To: Alessandro Zummo Cc: Alexandre Belloni , linux-rtc@vger.kernel.org Subject: [PATCH] rtc: clarify the RTC offset correction MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 29 Sep 2017 11:23:25 +0100 Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org 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 --- drivers/rtc/interface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 8cec9a02c0b8..045e0a72d14b 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