diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/plat-omap/common.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c index bf1eaf3a27d4..dddc0273bc8b 100644 --- a/arch/arm/plat-omap/common.c +++ b/arch/arm/plat-omap/common.c | |||
@@ -172,6 +172,32 @@ unsigned long long sched_clock(void) | |||
172 | clocksource_32k.mult, clocksource_32k.shift); | 172 | clocksource_32k.mult, clocksource_32k.shift); |
173 | } | 173 | } |
174 | 174 | ||
175 | /** | ||
176 | * read_persistent_clock - Return time from a persistent clock. | ||
177 | * | ||
178 | * Reads the time from a source which isn't disabled during PM, the | ||
179 | * 32k sync timer. Convert the cycles elapsed since last read into | ||
180 | * nsecs and adds to a monotonically increasing timespec. | ||
181 | */ | ||
182 | static struct timespec persistent_ts; | ||
183 | static cycles_t cycles, last_cycles; | ||
184 | void read_persistent_clock(struct timespec *ts) | ||
185 | { | ||
186 | unsigned long long nsecs; | ||
187 | cycles_t delta; | ||
188 | struct timespec *tsp = &persistent_ts; | ||
189 | |||
190 | last_cycles = cycles; | ||
191 | cycles = clocksource_32k.read(&clocksource_32k); | ||
192 | delta = cycles - last_cycles; | ||
193 | |||
194 | nsecs = clocksource_cyc2ns(delta, | ||
195 | clocksource_32k.mult, clocksource_32k.shift); | ||
196 | |||
197 | timespec_add_ns(tsp, nsecs); | ||
198 | *ts = *tsp; | ||
199 | } | ||
200 | |||
175 | static int __init omap_init_clocksource_32k(void) | 201 | static int __init omap_init_clocksource_32k(void) |
176 | { | 202 | { |
177 | static char err[] __initdata = KERN_ERR | 203 | static char err[] __initdata = KERN_ERR |