aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/clocksource.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/clocksource.h')
-rw-r--r--include/linux/clocksource.h41
1 files changed, 37 insertions, 4 deletions
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 8a4a130cc196..c37b21ad5a3b 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -154,6 +154,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
154 * @max_idle_ns: max idle time permitted by the clocksource (nsecs) 154 * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
155 * @flags: flags describing special properties 155 * @flags: flags describing special properties
156 * @vread: vsyscall based read 156 * @vread: vsyscall based read
157 * @suspend: suspend function for the clocksource, if necessary
157 * @resume: resume function for the clocksource, if necessary 158 * @resume: resume function for the clocksource, if necessary
158 */ 159 */
159struct clocksource { 160struct clocksource {
@@ -172,7 +173,8 @@ struct clocksource {
172 u64 max_idle_ns; 173 u64 max_idle_ns;
173 unsigned long flags; 174 unsigned long flags;
174 cycle_t (*vread)(void); 175 cycle_t (*vread)(void);
175 void (*resume)(void); 176 void (*suspend)(struct clocksource *cs);
177 void (*resume)(struct clocksource *cs);
176#ifdef CONFIG_IA64 178#ifdef CONFIG_IA64
177 void *fsys_mmio; /* used by fsyscall asm code */ 179 void *fsys_mmio; /* used by fsyscall asm code */
178#define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr)) 180#define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr))
@@ -271,12 +273,12 @@ static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
271} 273}
272 274
273 275
274/* used to install a new clocksource */
275extern int clocksource_register(struct clocksource*); 276extern int clocksource_register(struct clocksource*);
276extern void clocksource_unregister(struct clocksource*); 277extern void clocksource_unregister(struct clocksource*);
277extern void clocksource_touch_watchdog(void); 278extern void clocksource_touch_watchdog(void);
278extern struct clocksource* clocksource_get_next(void); 279extern struct clocksource* clocksource_get_next(void);
279extern void clocksource_change_rating(struct clocksource *cs, int rating); 280extern void clocksource_change_rating(struct clocksource *cs, int rating);
281extern void clocksource_suspend(void);
280extern void clocksource_resume(void); 282extern void clocksource_resume(void);
281extern struct clocksource * __init __weak clocksource_default_clock(void); 283extern struct clocksource * __init __weak clocksource_default_clock(void);
282extern void clocksource_mark_unstable(struct clocksource *cs); 284extern void clocksource_mark_unstable(struct clocksource *cs);
@@ -284,6 +286,35 @@ extern void clocksource_mark_unstable(struct clocksource *cs);
284extern void 286extern void
285clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); 287clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
286 288
289/*
290 * Don't call __clocksource_register_scale directly, use
291 * clocksource_register_hz/khz
292 */
293extern int
294__clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq);
295extern void
296__clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq);
297
298static inline int clocksource_register_hz(struct clocksource *cs, u32 hz)
299{
300 return __clocksource_register_scale(cs, 1, hz);
301}
302
303static inline int clocksource_register_khz(struct clocksource *cs, u32 khz)
304{
305 return __clocksource_register_scale(cs, 1000, khz);
306}
307
308static inline void __clocksource_updatefreq_hz(struct clocksource *cs, u32 hz)
309{
310 __clocksource_updatefreq_scale(cs, 1, hz);
311}
312
313static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz)
314{
315 __clocksource_updatefreq_scale(cs, 1000, khz);
316}
317
287static inline void 318static inline void
288clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) 319clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
289{ 320{
@@ -293,11 +324,13 @@ clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
293 324
294#ifdef CONFIG_GENERIC_TIME_VSYSCALL 325#ifdef CONFIG_GENERIC_TIME_VSYSCALL
295extern void 326extern void
296update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult); 327update_vsyscall(struct timespec *ts, struct timespec *wtm,
328 struct clocksource *c, u32 mult);
297extern void update_vsyscall_tz(void); 329extern void update_vsyscall_tz(void);
298#else 330#else
299static inline void 331static inline void
300update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult) 332update_vsyscall(struct timespec *ts, struct timespec *wtm,
333 struct clocksource *c, u32 mult)
301{ 334{
302} 335}
303 336