ARM: 6149/1: nomadik-gpio: add function to configure sleep mode behaviour
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / kernel / time / tick-internal.h
blob290eefbc1f608ec4d9c957fb5798eb53490f9e7c
1 /*
2 * tick internal variable and functions used by low/high res code
3 */
5 #define TICK_DO_TIMER_NONE -1
6 #define TICK_DO_TIMER_BOOT -2
8 DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
9 extern ktime_t tick_next_period;
10 extern ktime_t tick_period;
11 extern int tick_do_timer_cpu __read_mostly;
13 extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
14 extern void tick_handle_periodic(struct clock_event_device *dev);
16 extern void clockevents_shutdown(struct clock_event_device *dev);
19 * NO_HZ / high resolution timer shared code
21 #ifdef CONFIG_TICK_ONESHOT
22 extern void tick_setup_oneshot(struct clock_event_device *newdev,
23 void (*handler)(struct clock_event_device *),
24 ktime_t nextevt);
25 extern int tick_dev_program_event(struct clock_event_device *dev,
26 ktime_t expires, int force);
27 extern int tick_program_event(ktime_t expires, int force);
28 extern void tick_oneshot_notify(void);
29 extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
30 extern void tick_resume_oneshot(void);
31 # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
32 extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
33 extern void tick_broadcast_oneshot_control(unsigned long reason);
34 extern void tick_broadcast_switch_to_oneshot(void);
35 extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
36 extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
37 extern int tick_broadcast_oneshot_active(void);
38 extern void tick_check_oneshot_broadcast(int cpu);
39 # else /* BROADCAST */
40 static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
42 BUG();
44 static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
45 static inline void tick_broadcast_switch_to_oneshot(void) { }
46 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
47 static inline int tick_broadcast_oneshot_active(void) { return 0; }
48 static inline void tick_check_oneshot_broadcast(int cpu) { }
49 # endif /* !BROADCAST */
51 #else /* !ONESHOT */
52 static inline
53 void tick_setup_oneshot(struct clock_event_device *newdev,
54 void (*handler)(struct clock_event_device *),
55 ktime_t nextevt)
57 BUG();
59 static inline void tick_resume_oneshot(void)
61 BUG();
63 static inline int tick_program_event(ktime_t expires, int force)
65 return 0;
67 static inline void tick_oneshot_notify(void) { }
68 static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
70 BUG();
72 static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
73 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
74 static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
76 return 0;
78 static inline int tick_broadcast_oneshot_active(void) { return 0; }
79 #endif /* !TICK_ONESHOT */
82 * Broadcasting support
84 #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
85 extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu);
86 extern int tick_check_broadcast_device(struct clock_event_device *dev);
87 extern int tick_is_broadcast_device(struct clock_event_device *dev);
88 extern void tick_broadcast_on_off(unsigned long reason, int *oncpu);
89 extern void tick_shutdown_broadcast(unsigned int *cpup);
90 extern void tick_suspend_broadcast(void);
91 extern int tick_resume_broadcast(void);
93 extern void
94 tick_set_periodic_handler(struct clock_event_device *dev, int broadcast);
96 #else /* !BROADCAST */
98 static inline int tick_check_broadcast_device(struct clock_event_device *dev)
100 return 0;
103 static inline int tick_is_broadcast_device(struct clock_event_device *dev)
105 return 0;
107 static inline int tick_device_uses_broadcast(struct clock_event_device *dev,
108 int cpu)
110 return 0;
112 static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { }
113 static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { }
114 static inline void tick_shutdown_broadcast(unsigned int *cpup) { }
115 static inline void tick_suspend_broadcast(void) { }
116 static inline int tick_resume_broadcast(void) { return 0; }
119 * Set the periodic handler in non broadcast mode
121 static inline void tick_set_periodic_handler(struct clock_event_device *dev,
122 int broadcast)
124 dev->event_handler = tick_handle_periodic;
126 #endif /* !BROADCAST */
129 * Check, if the device is functional or a dummy for broadcast
131 static inline int tick_device_is_functional(struct clock_event_device *dev)
133 return !(dev->features & CLOCK_EVT_FEAT_DUMMY);