Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2435732pxb; Sun, 17 Oct 2021 15:04:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEiZZ0BNdqQH4M26crFbLBBetdm6EIWuVoDoOYKCjxL3MjMjGQjr5S/bIrMRYipO+Sac8L X-Received: by 2002:a17:903:18c:b0:13f:255:9dca with SMTP id z12-20020a170903018c00b0013f02559dcamr23998224plg.37.1634508258301; Sun, 17 Oct 2021 15:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634508258; cv=none; d=google.com; s=arc-20160816; b=LcTGO8ZvTIi80zMW4GeOFltKABuojRnmrT/vkbubIzO4qhA6mWZWQ/Ey0b1c5ZJLrU EVK4WX/vLfMSoYFw236tqhd38w2nKATkhbZO/AvD01iX/tWCUZ99glZrgvTd1YeCeCp7 z1MeiRJxlRgYPU2wanhOeh+M8RpAx4JUEtqlN+YBID7f/bPRrOVSGAErP8Hte9GBi5tH ML2aKSL9MBzGeXH8iCfv+EdAh/0n8J0CUqbQ2+oqoNKlch2biSfSBRqvcZAgXyn/P1wU caMf85wDBCxTSGPF0O4L/vrxuORES2FXrTB1Pxt0KDQVEwjulmde9kQjNPxhRbvqW3zw YRcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=UVVC6pAsKEetk78Lt9yQfZdxMmZqgjWW4Xu0cEv13i0=; b=J0tBDa4sJNoOOZ1eqMNAvVAfooA58LrNJtLFQtzymTAYGwwytxsszStPR1f3xxI3Xz lkwUFSUMqFKlSWz2mpXuORgLs7LYbJminiVYedQA1/3V0HY57Wea9cIKOJucTrQx+oo8 qEyJ17wIhEEBHPlRfAinIOSoVb1jHJitXFXPhwWVazEhencyLISpIIomLkTYflJ8kDA3 UTvheiVInaaLRJoBdrjS3RLiWjrmjwj9C/kVDqcH/bUosBvwZ99uYYnF9wAFmHH1qfdp kwM13fJYDLGFaHhvlD1XxoJqdT/MGyY/g8jA099wf0BfSv9ihZEPKWeYC1xqI44ua3ea a57A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j6si6280452pgq.187.2021.10.17.15.03.52; Sun, 17 Oct 2021 15:04:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242748AbhJOT27 (ORCPT + 99 others); Fri, 15 Oct 2021 15:28:59 -0400 Received: from mslow1.mail.gandi.net ([217.70.178.240]:59915 "EHLO mslow1.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238327AbhJOT2y (ORCPT ); Fri, 15 Oct 2021 15:28:54 -0400 Received: from relay6-d.mail.gandi.net (unknown [217.70.183.198]) by mslow1.mail.gandi.net (Postfix) with ESMTP id B66CED67A7 for ; Fri, 15 Oct 2021 19:21:49 +0000 (UTC) Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id C8EC9C0007; Fri, 15 Oct 2021 19:21:27 +0000 (UTC) From: Alexandre Belloni To: Alessandro Zummo , Alexandre Belloni Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] rtc: expose correction feature Date: Fri, 15 Oct 2021 21:21:16 +0200 Message-Id: <20211015192121.817642-4-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211015192121.817642-1-alexandre.belloni@bootlin.com> References: <20211015192121.817642-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new feature for RTCs able to correct the oscillator imprecision. This is also called offset or trimming. Such drivers have a .set_offset callback, use that to set the feature bit from the core. Signed-off-by: Alexandre Belloni --- drivers/rtc/class.c | 3 +++ include/uapi/linux/rtc.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index dbccd71589b9..2e0cbc190a8a 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -389,6 +389,9 @@ int __devm_rtc_register_device(struct module *owner, struct rtc_device *rtc) if (!rtc->ops->set_alarm) clear_bit(RTC_FEATURE_ALARM, rtc->features); + if (rtc->ops->set_offset) + set_bit(RTC_FEATURE_CORRECTION, rtc->features); + rtc->owner = owner; rtc_device_get_offset(rtc); diff --git a/include/uapi/linux/rtc.h b/include/uapi/linux/rtc.h index e4128be7963b..ded2aaab7ec7 100644 --- a/include/uapi/linux/rtc.h +++ b/include/uapi/linux/rtc.h @@ -131,7 +131,8 @@ struct rtc_param { #define RTC_FEATURE_ALARM_RES_2S 2 #define RTC_FEATURE_UPDATE_INTERRUPT 3 #define RTC_FEATURE_NEED_WEEK_DAY 4 -#define RTC_FEATURE_CNT 5 +#define RTC_FEATURE_CORRECTION 5 +#define RTC_FEATURE_CNT 6 /* parameter list */ #define RTC_PARAM_FEATURES 0 -- 2.31.1