From 49c5b7be67d2bb76d88e6d2306b2b1447ffaf986 Mon Sep 17 00:00:00 2001 From: Kevin Hilman Date: Thu, 24 Sep 2009 16:35:48 -0700 Subject: [PATCH] --- yaml --- r: 179769 b: refs/heads/master c: d92cfcbe39fdb2328a28b5505f31cb8be40fc339 h: refs/heads/master i: 179767: f22d70e3edeee80aa2330266c613e153efd08a8e v: v3 --- [refs] | 2 +- trunk/arch/arm/plat-omap/common.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index a268d7d8421b..94ffa3845820 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: dccaad895094a699c37c065bff3fa9bb997daeb9 +refs/heads/master: d92cfcbe39fdb2328a28b5505f31cb8be40fc339 diff --git a/trunk/arch/arm/plat-omap/common.c b/trunk/arch/arm/plat-omap/common.c index bf1eaf3a27d4..dddc0273bc8b 100644 --- a/trunk/arch/arm/plat-omap/common.c +++ b/trunk/arch/arm/plat-omap/common.c @@ -172,6 +172,32 @@ unsigned long long sched_clock(void) clocksource_32k.mult, clocksource_32k.shift); } +/** + * read_persistent_clock - Return time from a persistent clock. + * + * Reads the time from a source which isn't disabled during PM, the + * 32k sync timer. Convert the cycles elapsed since last read into + * nsecs and adds to a monotonically increasing timespec. + */ +static struct timespec persistent_ts; +static cycles_t cycles, last_cycles; +void read_persistent_clock(struct timespec *ts) +{ + unsigned long long nsecs; + cycles_t delta; + struct timespec *tsp = &persistent_ts; + + last_cycles = cycles; + cycles = clocksource_32k.read(&clocksource_32k); + delta = cycles - last_cycles; + + nsecs = clocksource_cyc2ns(delta, + clocksource_32k.mult, clocksource_32k.shift); + + timespec_add_ns(tsp, nsecs); + *ts = *tsp; +} + static int __init omap_init_clocksource_32k(void) { static char err[] __initdata = KERN_ERR