mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>
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	[thread overview]
Message-ID: <20211015192121.817642-4-alexandre.belloni@bootlin.com> (raw)
In-Reply-To: <20211015192121.817642-1-alexandre.belloni@bootlin.com>

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 <alexandre.belloni@bootlin.com>
---
 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


  parent reply	other threads:[~2021-10-15 19:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 19:21 [PATCH 0/7] rtc: add new ioctl interface and BSM support Alexandre Belloni
2021-10-15 19:21 ` [PATCH 1/7] rtc: add alarm related features Alexandre Belloni
2021-10-15 19:21 ` [PATCH 2/7] rtc: add parameter ioctl Alexandre Belloni
2021-10-15 19:21 ` Alexandre Belloni [this message]
2021-10-15 19:21 ` [PATCH 4/7] rtc: add correction parameter Alexandre Belloni
2021-10-15 19:21 ` [PATCH 5/7] rtc: add BSM parameter Alexandre Belloni
2021-10-15 19:21 ` [PATCH 6/7] rtc: rv3028: add BSM support Alexandre Belloni
2021-10-15 19:21 ` [PATCH 7/7] rtc: rv3032: allow setting BSM Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211015192121.817642-4-alexandre.belloni@bootlin.com \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®