aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/clockchips.h19
-rw-r--r--include/linux/clocksource.h12
-rw-r--r--include/linux/tick.h5
-rw-r--r--include/linux/time.h1
-rw-r--r--include/linux/timex.h4
5 files changed, 31 insertions, 10 deletions
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 3a1dbba4d3a..0cf725bdd2a 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -77,10 +77,10 @@ enum clock_event_nofitiers {
77struct clock_event_device { 77struct clock_event_device {
78 const char *name; 78 const char *name;
79 unsigned int features; 79 unsigned int features;
80 unsigned long max_delta_ns; 80 u64 max_delta_ns;
81 unsigned long min_delta_ns; 81 u64 min_delta_ns;
82 unsigned long mult; 82 u32 mult;
83 int shift; 83 u32 shift;
84 int rating; 84 int rating;
85 int irq; 85 int irq;
86 const struct cpumask *cpumask; 86 const struct cpumask *cpumask;
@@ -116,8 +116,8 @@ static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec,
116} 116}
117 117
118/* Clock event layer functions */ 118/* Clock event layer functions */
119extern unsigned long clockevent_delta2ns(unsigned long latch, 119extern u64 clockevent_delta2ns(unsigned long latch,
120 struct clock_event_device *evt); 120 struct clock_event_device *evt);
121extern void clockevents_register_device(struct clock_event_device *dev); 121extern void clockevents_register_device(struct clock_event_device *dev);
122 122
123extern void clockevents_exchange_device(struct clock_event_device *old, 123extern void clockevents_exchange_device(struct clock_event_device *old,
@@ -130,6 +130,13 @@ extern int clockevents_program_event(struct clock_event_device *dev,
130 130
131extern void clockevents_handle_noop(struct clock_event_device *dev); 131extern void clockevents_handle_noop(struct clock_event_device *dev);
132 132
133static inline void
134clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec)
135{
136 return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC,
137 freq, minsec);
138}
139
133#ifdef CONFIG_GENERIC_CLOCKEVENTS 140#ifdef CONFIG_GENERIC_CLOCKEVENTS
134extern void clockevents_notify(unsigned long reason, void *arg); 141extern void clockevents_notify(unsigned long reason, void *arg);
135#else 142#else
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 83d2fbd81b9..279c5478e8a 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -151,6 +151,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
151 * subtraction of non 64 bit counters 151 * subtraction of non 64 bit counters
152 * @mult: cycle to nanosecond multiplier 152 * @mult: cycle to nanosecond multiplier
153 * @shift: cycle to nanosecond divisor (power of two) 153 * @shift: cycle to nanosecond divisor (power of two)
154 * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
154 * @flags: flags describing special properties 155 * @flags: flags describing special properties
155 * @vread: vsyscall based read 156 * @vread: vsyscall based read
156 * @resume: resume function for the clocksource, if necessary 157 * @resume: resume function for the clocksource, if necessary
@@ -168,6 +169,7 @@ struct clocksource {
168 cycle_t mask; 169 cycle_t mask;
169 u32 mult; 170 u32 mult;
170 u32 shift; 171 u32 shift;
172 u64 max_idle_ns;
171 unsigned long flags; 173 unsigned long flags;
172 cycle_t (*vread)(void); 174 cycle_t (*vread)(void);
173 void (*resume)(void); 175 void (*resume)(void);
@@ -279,6 +281,16 @@ extern void clocksource_resume(void);
279extern struct clocksource * __init __weak clocksource_default_clock(void); 281extern struct clocksource * __init __weak clocksource_default_clock(void);
280extern void clocksource_mark_unstable(struct clocksource *cs); 282extern void clocksource_mark_unstable(struct clocksource *cs);
281 283
284extern void
285clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
286
287static inline void
288clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
289{
290 return clocks_calc_mult_shift(&cs->mult, &cs->shift, freq,
291 NSEC_PER_SEC, minsec);
292}
293
282#ifdef CONFIG_GENERIC_TIME_VSYSCALL 294#ifdef CONFIG_GENERIC_TIME_VSYSCALL
283extern void update_vsyscall(struct timespec *ts, struct clocksource *c); 295extern void update_vsyscall(struct timespec *ts, struct clocksource *c);
284extern void update_vsyscall_tz(void); 296extern void update_vsyscall_tz(void);
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 0482229c07d..d2ae79e21be 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -43,6 +43,7 @@ enum tick_nohz_mode {
43 * @idle_exittime: Time when the idle state was left 43 * @idle_exittime: Time when the idle state was left
44 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped 44 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
45 * @sleep_length: Duration of the current idle sleep 45 * @sleep_length: Duration of the current idle sleep
46 * @do_timer_lst: CPU was the last one doing do_timer before going idle
46 */ 47 */
47struct tick_sched { 48struct tick_sched {
48 struct hrtimer sched_timer; 49 struct hrtimer sched_timer;
@@ -64,6 +65,7 @@ struct tick_sched {
64 unsigned long last_jiffies; 65 unsigned long last_jiffies;
65 unsigned long next_jiffies; 66 unsigned long next_jiffies;
66 ktime_t idle_expires; 67 ktime_t idle_expires;
68 int do_timer_last;
67}; 69};
68 70
69extern void __init tick_init(void); 71extern void __init tick_init(void);
@@ -98,6 +100,9 @@ extern int tick_check_oneshot_change(int allow_nohz);
98extern struct tick_sched *tick_get_tick_sched(int cpu); 100extern struct tick_sched *tick_get_tick_sched(int cpu);
99extern void tick_check_idle(int cpu); 101extern void tick_check_idle(int cpu);
100extern int tick_oneshot_mode_active(void); 102extern int tick_oneshot_mode_active(void);
103# ifndef arch_needs_cpu
104# define arch_needs_cpu(cpu) (0)
105# endif
101# else 106# else
102static inline void tick_clock_notify(void) { } 107static inline void tick_clock_notify(void) { }
103static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 108static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
diff --git a/include/linux/time.h b/include/linux/time.h
index fe04e5ef6a5..6e026e45a17 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -148,6 +148,7 @@ extern void monotonic_to_bootbased(struct timespec *ts);
148 148
149extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 149extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
150extern int timekeeping_valid_for_hres(void); 150extern int timekeeping_valid_for_hres(void);
151extern u64 timekeeping_max_deferment(void);
151extern void update_wall_time(void); 152extern void update_wall_time(void);
152extern void update_xtime_cache(u64 nsec); 153extern void update_xtime_cache(u64 nsec);
153extern void timekeeping_leap_insert(int leapsecond); 154extern void timekeeping_leap_insert(int leapsecond);
diff --git a/include/linux/timex.h b/include/linux/timex.h
index e6967d10d9e..0c0ef7d4db7 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -261,11 +261,7 @@ static inline int ntp_synced(void)
261 261
262#define NTP_SCALE_SHIFT 32 262#define NTP_SCALE_SHIFT 32
263 263
264#ifdef CONFIG_NO_HZ
265#define NTP_INTERVAL_FREQ (2)
266#else
267#define NTP_INTERVAL_FREQ (HZ) 264#define NTP_INTERVAL_FREQ (HZ)
268#endif
269#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) 265#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)
270 266
271/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ 267/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */