Commit Message

On our Spreadtrum SC9860 platform, we registered the high resolution
ARM generic timer as one clocksource to update the OS time, but the
ARM generic timer will be stopped in suspend state. So we use one 64bit
always-on timer (but low resolution) of Spreadtrum to calculate the
suspend time to compensate the OS time. Though we can register the
always-on timer as one clocksource, we need re-calculate the
mult/shift with one larger conversion range to calculate the suspend
time.
But now we have too many different ways of dealing with persistent
timekeeping across architectures, and there will be many duplicate
code if we register one timer to be one persistent clock. Thus it
will be more helpful if we add one common framework for timer drivers
to be registered as one persistent clock and implement the common
read_persistent_clock64() to compensate the OS time.
Moreover we can register the clocksource with CLOCK_SOURCE_SUSPEND_NONSTOP
to be one persistent clock, then we can simplify the suspend/resume
accounting by removing CLOCK_SOURCE_SUSPEND_NONSTOP timing. After that
we can only compensate the OS time by persistent clock or RTC.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
include/linux/persistent_clock.h | 21 +++++
kernel/time/Kconfig | 4 +
kernel/time/Makefile | 1 +
kernel/time/persistent_clock.c | 180 ++++++++++++++++++++++++++++++++++++++
4 files changed, 206 insertions(+)
create mode 100644 include/linux/persistent_clock.h
create mode 100644 kernel/time/persistent_clock.c