Skip to content

Commit

Permalink
rtc: expose correction feature
Browse files Browse the repository at this point in the history
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>
Link: https://lore.kernel.org/r/20211018151933.76865-4-alexandre.belloni@bootlin.com
(cherry picked from commit 2268551)
[ta: handle conflicts]
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: Isaac True <isaac.true@canonical.com>
  • Loading branch information
alexandrebelloni authored and IsaacJT committed Feb 8, 2023
1 parent 4caa63b commit aca8ece
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions drivers/rtc/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,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);

Expand Down
3 changes: 2 additions & 1 deletion include/uapi/linux/rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ struct rtc_pll_info {
#define RTC_FEATURE_ALARM 0
#define RTC_FEATURE_ALARM_RES_MINUTE 1
#define RTC_FEATURE_NEED_WEEK_DAY 2
#define RTC_FEATURE_CNT 3
#define RTC_FEATURE_CORRECTION 3
#define RTC_FEATURE_CNT 4

#define RTC_MAX_FREQ 8192

Expand Down

0 comments on commit aca8ece

Please sign in to comment.