hdmi:fix edid parse 4096x2160@24Hz error.
[firefly-linux-kernel-4.4.55.git] / kernel / time / tick-internal.h
1 /*
2  * tick internal variable and functions used by low/high res code
3  */
4 #include <linux/hrtimer.h>
5 #include <linux/tick.h>
6
7 extern seqlock_t jiffies_lock;
8
9 #ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD
10
11 #define TICK_DO_TIMER_NONE      -1
12 #define TICK_DO_TIMER_BOOT      -2
13
14 DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
15 extern ktime_t tick_next_period;
16 extern ktime_t tick_period;
17 extern int tick_do_timer_cpu __read_mostly;
18
19 extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
20 extern void tick_handle_periodic(struct clock_event_device *dev);
21 extern void tick_check_new_device(struct clock_event_device *dev);
22 extern void tick_handover_do_timer(int *cpup);
23 extern void tick_shutdown(unsigned int *cpup);
24 extern void tick_suspend(void);
25 extern void tick_resume(void);
26
27 extern void clockevents_shutdown(struct clock_event_device *dev);
28
29 /*
30  * NO_HZ / high resolution timer shared code
31  */
32 #ifdef CONFIG_TICK_ONESHOT
33 extern void tick_setup_oneshot(struct clock_event_device *newdev,
34                                void (*handler)(struct clock_event_device *),
35                                ktime_t nextevt);
36 extern int tick_program_event(ktime_t expires, int force);
37 extern void tick_oneshot_notify(void);
38 extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
39 extern void tick_resume_oneshot(void);
40 # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
41 extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
42 extern int tick_broadcast_oneshot_control(unsigned long reason);
43 extern void tick_broadcast_switch_to_oneshot(void);
44 extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
45 extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
46 extern int tick_broadcast_oneshot_active(void);
47 extern void tick_check_oneshot_broadcast(int cpu);
48 bool tick_broadcast_oneshot_available(void);
49 # else /* BROADCAST */
50 static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
51 {
52         BUG();
53 }
54 static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
55 static inline void tick_broadcast_switch_to_oneshot(void) { }
56 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
57 static inline int tick_broadcast_oneshot_active(void) { return 0; }
58 static inline void tick_check_oneshot_broadcast(int cpu) { }
59 static inline bool tick_broadcast_oneshot_available(void) { return true; }
60 # endif /* !BROADCAST */
61
62 #else /* !ONESHOT */
63 static inline
64 void tick_setup_oneshot(struct clock_event_device *newdev,
65                         void (*handler)(struct clock_event_device *),
66                         ktime_t nextevt)
67 {
68         BUG();
69 }
70 static inline void tick_resume_oneshot(void)
71 {
72         BUG();
73 }
74 static inline int tick_program_event(ktime_t expires, int force)
75 {
76         return 0;
77 }
78 static inline void tick_oneshot_notify(void) { }
79 static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
80 {
81         BUG();
82 }
83 static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
84 static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
85 static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
86 {
87         return 0;
88 }
89 static inline int tick_broadcast_oneshot_active(void) { return 0; }
90 static inline bool tick_broadcast_oneshot_available(void) { return false; }
91 #endif /* !TICK_ONESHOT */
92
93 /*
94  * Broadcasting support
95  */
96 #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
97 extern int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu);
98 extern void tick_install_broadcast_device(struct clock_event_device *dev);
99 extern int tick_is_broadcast_device(struct clock_event_device *dev);
100 extern void tick_broadcast_on_off(unsigned long reason, int *oncpu);
101 extern void tick_shutdown_broadcast(unsigned int *cpup);
102 extern void tick_suspend_broadcast(void);
103 extern int tick_resume_broadcast(void);
104 extern void tick_broadcast_init(void);
105 extern void
106 tick_set_periodic_handler(struct clock_event_device *dev, int broadcast);
107
108 #else /* !BROADCAST */
109
110 static inline void tick_install_broadcast_device(struct clock_event_device *dev)
111 {
112 }
113
114 static inline int tick_is_broadcast_device(struct clock_event_device *dev)
115 {
116         return 0;
117 }
118 static inline int tick_device_uses_broadcast(struct clock_event_device *dev,
119                                              int cpu)
120 {
121         return 0;
122 }
123 static inline void tick_do_periodic_broadcast(struct clock_event_device *d) { }
124 static inline void tick_broadcast_on_off(unsigned long reason, int *oncpu) { }
125 static inline void tick_shutdown_broadcast(unsigned int *cpup) { }
126 static inline void tick_suspend_broadcast(void) { }
127 static inline int tick_resume_broadcast(void) { return 0; }
128 static inline void tick_broadcast_init(void) { }
129
130 /*
131  * Set the periodic handler in non broadcast mode
132  */
133 static inline void tick_set_periodic_handler(struct clock_event_device *dev,
134                                              int broadcast)
135 {
136         dev->event_handler = tick_handle_periodic;
137 }
138 #endif /* !BROADCAST */
139
140 /*
141  * Check, if the device is functional or a dummy for broadcast
142  */
143 static inline int tick_device_is_functional(struct clock_event_device *dev)
144 {
145         return !(dev->features & CLOCK_EVT_FEAT_DUMMY);
146 }
147
148 int __clockevents_update_freq(struct clock_event_device *dev, u32 freq);
149
150 #endif
151
152 extern void do_timer(unsigned long ticks);