This is a discussion on [PATCH 1/6] RTC: Class device support for persistent clock (#2) - Kernel ; This is a generic implementation of rtc_read_persistent_clock() and
rtc_update_persistent_clock() suitable for platforms to be used for
read_persistent_clock() and update_persistent_clock() calls. An RTC
device selected by the user with the RTC_HCTOSYS_DEVICE option is used.
As rtc_read_persistent_clock() is not available at the ...

[PATCH 1/6] RTC: Class device support for persistent clock (#2)

This is a generic implementation of rtc_read_persistent_clock() and
rtc_update_persistent_clock() suitable for platforms to be used for
read_persistent_clock() and update_persistent_clock() calls. An RTC
device selected by the user with the RTC_HCTOSYS_DEVICE option is used.

As rtc_read_persistent_clock() is not available at the time
timekeeping_init() is called, it will now be disabled if the class device
is to be used as a reference. In this case rtc_hctosys(), already
present, will be used to set up the system time at the late initcall time.
This call has now been rewritten to make use of
rtc_read_persistent_clock().

As rtc_set_mmss() used by rtc_update_persistent_clock() may sleep for
some hardware, the call is now made from a work queue scheduled by the
timer originally used for the entire function. However, following
DavidW's suggestion, the mutex in rtc_set_mmss() is now obtained with
mutex_trylock() a failure of which makes the function terminate, so that
latency from the caller to the point where hardware is accessed is
minimised.

config RTC_HCTOSYS
- bool "Set system time from RTC on startup and resume"
+ bool "Use time from RTC as a reference for the system time"
depends on RTC_CLASS = y
default y
help
- If you say yes here, the system time (wall clock) will be set using
- the value read from a specified RTC device. This is useful to avoid
- unnecessary fsck runs at boot time, and to network better.
+ If you say yes here, the specified RTC device will be used
+ as a reference to the system time (wall clock). The device
+ will be used to set the system time as required during
+ startup, suspend and, for platforms that support such usage,
+ for NTP timekeeping.
+
+ This is useful to avoid unnecessary fsck runs at boot time,
+ and to network better.

config RTC_HCTOSYS_DEVICE
- string "RTC used to set the system time"
+ string "RTC used as a reference for the system time"
depends on RTC_HCTOSYS = y
default "rtc0"
help
- The RTC device that will be used to (re)initialize the system
+ The RTC device that will be used as a reference for the system
clock, usually rtc0. Initialization is done when the system
- starts up, and when it resumes from a low power state. This
- device should record time in UTC, since the kernel won't do
- timezone correction.
+ starts up, and when it resumes from a low power state. Also,
+ if supported by the platform, NTP timekeeping uses this device
+ to record the system time periodically. This device should
+ record time in UTC, since the kernel won't do timezone correction.