Lines Matching full:clocksource
3 * This file contains the functions which manage clocksource drivers.
11 #include <linux/clocksource.h>
76 /*[Clocksource internal variables]---------
78 * currently selected clocksource.
86 * Name of the user-specified clocksource.
88 static struct clocksource *curr_clocksource;
89 static struct clocksource *suspend_clocksource;
101 static struct clocksource *watchdog;
119 static void __clocksource_change_rating(struct clocksource *cs, int rating);
145 static void __clocksource_unstable(struct clocksource *cs) in __clocksource_unstable()
151 * If the clocksource is registered clocksource_watchdog_kthread() will in __clocksource_unstable()
168 * clocksource_mark_unstable - mark clocksource unstable via watchdog
169 * @cs: clocksource to be marked unstable
174 void clocksource_mark_unstable(struct clocksource *cs) in clocksource_mark_unstable()
189 struct clocksource *cs; in clocksource_watchdog()
202 /* Clocksource already marked unstable? */ in clocksource_watchdog()
214 /* Clocksource initialized ? */ in clocksource_watchdog()
237 /* Check the deviation from the watchdog clocksource. */ in clocksource_watchdog()
239 …pr_warn("timekeeping watchdog on CPU%d: Marking clocksource '%s' as unstable because the skew is t… in clocksource_watchdog()
266 * If this is not the current clocksource let in clocksource_watchdog()
268 * change to high res this clocksource might in clocksource_watchdog()
270 * clocksource let the tick code know about in clocksource_watchdog()
329 struct clocksource *cs; in clocksource_reset_watchdog()
340 static void clocksource_enqueue_watchdog(struct clocksource *cs) in clocksource_enqueue_watchdog()
345 /* cs is a clocksource to be watched. */ in clocksource_enqueue_watchdog()
357 struct clocksource *cs, *old_wd; in clocksource_select_watchdog()
367 /* cs is a clocksource to be watched. */ in clocksource_select_watchdog()
392 static void clocksource_dequeue_watchdog(struct clocksource *cs) in clocksource_dequeue_watchdog()
396 /* cs is a watched clocksource. */ in clocksource_dequeue_watchdog()
406 struct clocksource *cs, *tmp; in __clocksource_watchdog_kthread()
438 static bool clocksource_is_watchdog(struct clocksource *cs) in clocksource_is_watchdog()
445 static void clocksource_enqueue_watchdog(struct clocksource *cs) in clocksource_enqueue_watchdog()
452 static inline void clocksource_dequeue_watchdog(struct clocksource *cs) { } in clocksource_dequeue_watchdog()
455 static bool clocksource_is_watchdog(struct clocksource *cs) { return false; } in clocksource_is_watchdog()
456 void clocksource_mark_unstable(struct clocksource *cs) { } in clocksource_mark_unstable()
463 static bool clocksource_is_suspend(struct clocksource *cs) in clocksource_is_suspend()
468 static void __clocksource_suspend_select(struct clocksource *cs) in __clocksource_suspend_select()
471 * Skip the clocksource which will be stopped in suspend state. in __clocksource_suspend_select()
477 * The nonstop clocksource can be selected as the suspend clocksource to in __clocksource_suspend_select()
479 * interfaces to suspend the nonstop clocksource when system suspends. in __clocksource_suspend_select()
482 pr_warn("Nonstop clocksource %s should not supply suspend/resume interfaces\n", in __clocksource_suspend_select()
492 * clocksource_suspend_select - Select the best clocksource for suspend timing
493 * @fallback: if select a fallback clocksource
497 struct clocksource *cs, *old_suspend; in clocksource_suspend_select()
514 * @cs: current clocksource from timekeeping
523 * clocksource mutex.
525 void clocksource_start_suspend_timing(struct clocksource *cs, u64 start_cycles) in clocksource_start_suspend_timing()
531 * If current clocksource is the suspend timer, we should use the in clocksource_start_suspend_timing()
542 pr_warn_once("Failed to enable the non-suspend-able clocksource.\n"); in clocksource_start_suspend_timing()
551 * @cs: current clocksource from timekeeping
556 * Returns nanoseconds since suspend started, 0 if no usable suspend clocksource.
561 * taking the clocksource mutex.
563 u64 clocksource_stop_suspend_timing(struct clocksource *cs, u64 cycle_now) in clocksource_stop_suspend_timing()
571 * If current clocksource is the suspend timer, we should use the in clocksource_stop_suspend_timing()
588 * Disable the suspend timer to save power if current clocksource is in clocksource_stop_suspend_timing()
598 * clocksource_suspend - suspend the clocksource(s)
602 struct clocksource *cs; in clocksource_suspend()
610 * clocksource_resume - resume the clocksource(s)
614 struct clocksource *cs; in clocksource_resume()
637 * @cs: Pointer to clocksource
640 static u32 clocksource_max_adjustment(struct clocksource *cs) in clocksource_max_adjustment()
678 * The actual maximum number of cycles we can defer the clocksource is in clocks_calc_max_nsecs()
697 * clocksource_update_max_deferment - Updates the clocksource max_idle_ns & max_cycles
698 * @cs: Pointer to clocksource to be updated
701 static inline void clocksource_update_max_deferment(struct clocksource *cs) in clocksource_update_max_deferment()
710 static struct clocksource *clocksource_find_best(bool oneshot, bool skipcur) in clocksource_find_best()
712 struct clocksource *cs; in clocksource_find_best()
718 * We pick the clocksource with the highest rating. If oneshot in clocksource_find_best()
719 * mode is active, we pick the highres valid clocksource with in clocksource_find_best()
735 struct clocksource *best, *cs; in __clocksource_select()
737 /* Find the best suitable clocksource */ in __clocksource_select()
745 /* Check for the override clocksource. */ in __clocksource_select()
753 * capable clocksource if the tick code is in oneshot in __clocksource_select()
757 /* Override clocksource cannot be used. */ in __clocksource_select()
759 …pr_warn("Override clocksource %s is unstable and not HRT compatible - cannot switch while in HRT/N… in __clocksource_select()
767 pr_info("Override clocksource %s is not currently HRT compatible - deferring\n", in __clocksource_select()
771 /* Override clocksource can be used. */ in __clocksource_select()
778 pr_info("Switched to clocksource %s\n", best->name); in __clocksource_select()
784 * clocksource_select - Select the best clocksource available
788 * Select the clocksource with the best rating, or the clocksource,
810 * Hack to avoid lots of clocksource churn at boot time.
830 * Enqueue the clocksource sorted by rating
832 static void clocksource_enqueue(struct clocksource *cs) in clocksource_enqueue()
835 struct clocksource *tmp; in clocksource_enqueue()
847 * __clocksource_update_freq_scale - Used update clocksource with new freq
848 * @cs: clocksource to be registered
849 * @scale: Scale factor multiplied against freq to get clocksource hz
850 * @freq: clocksource frequency (cycles per second) divided by scale
852 * This should only be called from the clocksource->enable() method.
858 void __clocksource_update_freq_scale(struct clocksource *cs, u32 scale, u32 freq) in __clocksource_update_freq_scale()
873 * clocksource with mask >= 40-bit and f >= 4GHz. That maps to in __clocksource_update_freq_scale()
904 "timekeeping: Clocksource %s might overflow on 11%% adjustment\n", in __clocksource_update_freq_scale()
916 * @cs: clocksource to be registered
917 * @scale: Scale factor multiplied against freq to get clocksource hz
918 * @freq: clocksource frequency (cycles per second) divided by scale
925 int __clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq) in __clocksource_register_scale()
933 pr_warn("clocksource %s registered with invalid VDSO mode %d. Disabling VDSO support.\n", in __clocksource_register_scale()
941 /* Add clocksource to the clocksource list */ in __clocksource_register_scale()
957 static void __clocksource_change_rating(struct clocksource *cs, int rating) in __clocksource_change_rating()
965 * clocksource_change_rating - Change the rating of a registered clocksource
966 * @cs: clocksource to be changed
969 void clocksource_change_rating(struct clocksource *cs, int rating) in clocksource_change_rating()
986 * Unbind clocksource @cs. Called with clocksource_mutex held
988 static int clocksource_unbind(struct clocksource *cs) in clocksource_unbind()
1008 * Select and try to install a replacement suspend clocksource. in clocksource_unbind()
1009 * If no replacement suspend clocksource, we will just let the in clocksource_unbind()
1010 * clocksource go and have no suspend clocksource. in clocksource_unbind()
1024 * clocksource_unregister - remove a registered clocksource
1025 * @cs: clocksource to be unregistered
1027 int clocksource_unregister(struct clocksource *cs) in clocksource_unregister()
1041 * current_clocksource_show - sysfs interface for current clocksource
1044 * @buf: char buffer to be filled with clocksource list
1046 * Provides sysfs interface for listing current clocksource.
1079 * current_clocksource_store - interface for manually overriding clocksource
1082 * @buf: name of override clocksource
1086 * clocksource selection.
1107 * unbind_clocksource_store - interface for manually unbinding clocksource
1113 * Takes input from sysfs interface for manually unbinding a clocksource.
1119 struct clocksource *cs; in unbind_clocksource_store()
1142 * available_clocksource_show - sysfs interface for listing clocksource
1145 * @buf: char buffer to be filled with clocksource list
1153 struct clocksource *src; in available_clocksource_show()
1159 * Don't show non-HRES clocksource if the tick code is in available_clocksource_show()
1183 ATTRIBUTE_GROUPS(clocksource);
1186 .name = "clocksource",
1187 .dev_name = "clocksource",
1213 * Takes a clocksource= boot argument and uses it
1214 * as the clocksource override name.
1225 __setup("clocksource=", boot_override_clocksource);
1232 * as the clocksource override name
1237 pr_warn("clock=pmtmr is deprecated - use clocksource=acpi_pm\n"); in boot_override_clock()
1240 pr_warn("clock= boot option is deprecated - use clocksource=xyz\n"); in boot_override_clock()