Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3107597pxb; Mon, 18 Oct 2021 08:21:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0pmLvqX8eI5JsGWzRcUdRY51sh4rXjtRMjAS9CCXPPn6MxKfoAEy6ow7FEbkLuOTr006/ X-Received: by 2002:a17:90b:104d:: with SMTP id gq13mr49116310pjb.32.1634570505334; Mon, 18 Oct 2021 08:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634570505; cv=none; d=google.com; s=arc-20160816; b=wcu/IiZyzSsWzq2ZTqnhG7bFlp6/kEIUNjNQBkUqlpMcflBSIbsgpkaI25FC0/TpJj ApT0bLKIgcjNOVtol68tq8jiZ6jwFe9k1sZJbYhHCC+4fdGo2JJoCQqvw49jj48ulWI7 oNCqwztXxDoC1YaO4HVhcaMD+Lv5GXp9EuXBt28PDd3hRkLxRH/oADZnAZ5LXDE3OFOt GyrG1caViHRuC44bzZmVX/FSCYWsawoAdkTNPyiWC2zAj1Bhy8j+aV4QIbaTTOXHKIbq Zm4YpnrUFu0ji+eDyGJxAoYNpHB/EL5VjXT7LPcw5pnD6246Qsnhal+sEesFqYQiq/i0 6z0Q== 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=tptun10UIiCmwj6WN1HST/BfSD4mueGdV2mx2xrEUA8=; b=GFgW4BhgMjQI4b/979NlF2hXmFwPdGvodCOHpSRH+e2jCQxcKbJaO2s3CwFNbkJiKC dfw38cmb3Mh9jsuJ/6oLF26dLoK4wyf0Fh0LIXV4ca7K/pe5GNRry6JHJnkeBkRfm93I iIn/fxCCAibM+hNvtwkuA8+gW9mI62xozhBHMmxFhWiL0DbmwNiuYfWOR9khAt/oQmqd J06pInA2huP3DE7f9x+FtsFxRXtTeGIfNX152RphHMAcJsfD/ihaibMOPBJy7DMgYc+8 8zx6ui0NesLE0Sp7CejaFcNSdLjBlZfvQhPgO2Yc3ZKzcxEwPlFO8DmLIFc2+/sgH1oA vZDg== 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 mh13si22409185pjb.27.2021.10.18.08.21.32; Mon, 18 Oct 2021 08:21:45 -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 S233355AbhJRPVz (ORCPT + 99 others); Mon, 18 Oct 2021 11:21:55 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:56287 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233244AbhJRPVw (ORCPT ); Mon, 18 Oct 2021 11:21:52 -0400 Received: (Authenticated sender: alexandre.belloni@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 63B0F240013; Mon, 18 Oct 2021 15:19:40 +0000 (UTC) From: Alexandre Belloni To: Alessandro Zummo , Alexandre Belloni Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/7] rtc: expose correction feature Date: Mon, 18 Oct 2021 17:19:29 +0200 Message-Id: <20211018151933.76865-4-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018151933.76865-1-alexandre.belloni@bootlin.com> References: <20211018151933.76865-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 3241f9ecc639..c83bb9a4fa4f 100644 --- a/include/uapi/linux/rtc.h +++ b/include/uapi/linux/rtc.h @@ -131,7 +131,8 @@ struct rtc_param { #define RTC_FEATURE_NEED_WEEK_DAY 2 #define RTC_FEATURE_ALARM_RES_2S 3 #define RTC_FEATURE_UPDATE_INTERRUPT 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