@@ -172,6 +172,25 @@ unsigned long long sched_clock(void)
clocksource_32k.mult, clocksource_32k.shift);
}
+/**
+ * read_persistent_clock - Return time from the persistent clock.
+ *
+ * Reads the time from a source which isn't disabled during PM: 32k sync
+ * Returns a timespec with tv_sec=0 and tv_nsec=0 if unsupported.
+ *
+ */
+void read_persistent_clock(struct timespec *ts)
+{
+ unsigned long long nsecs;
+ cycle_t cycles;
+
+ ts->tv_sec = ts->tv_nsec = 0;
+ cycles = clocksource_32k.read(&clocksource_32k);
+ nsecs = clocksource_cyc2ns(cycles,
+ clocksource_32k.mult, clocksource_32k.shift);
+ timespec_add_ns(ts, nsecs);
+}
+
static int __init omap_init_clocksource_32k(void)
{
static char err[] __initdata = KERN_ERR