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.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 8a4a130cc196..5ea3c60c160c 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,24 @@ 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);
295
296static inline int clocksource_register_hz(struct clocksource *cs, u32 hz)
297{
298 return __clocksource_register_scale(cs, 1, hz);
299}
300
301static inline int clocksource_register_khz(struct clocksource *cs, u32 khz)
302{
303 return __clocksource_register_scale(cs, 1000, khz);
304}
305
306
287static inline void 307static inline void
288clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) 308clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
289{ 309{