/* * ladder.c - the residency ladder algorithm * * Copyright (C) 2001, 2002 Andy Grover <[email protected]> * Copyright (C) 2001, 2002 Paul Diefenbaugh <[email protected]> * Copyright (C) 2004, 2005 Dominik Brodowski <[email protected]> * * (C) 2006-2007 Venkatesh Pallipadi <[email protected]> * Shaohua Li <[email protected]> * Adam Belay <[email protected]> * * This code is licenced under the GPL. */ #include <linux/kernel.h> #include <linux/cpuidle.h> #include <linux/jiffies.h> #include <linux/tick.h> #include <asm/io.h> #include <linux/uaccess.h> #define PROMOTION_COUNT … #define DEMOTION_COUNT … struct ladder_device_state { … }; struct ladder_device { … }; static DEFINE_PER_CPU(struct ladder_device, ladder_devices); /** * ladder_do_selection - prepares private data for a state change * @dev: the CPU * @ldev: the ladder device * @old_idx: the current state index * @new_idx: the new target state index */ static inline void ladder_do_selection(struct cpuidle_device *dev, struct ladder_device *ldev, int old_idx, int new_idx) { … } /** * ladder_select_state - selects the next state to enter * @drv: cpuidle driver * @dev: the CPU * @dummy: not used */ static int ladder_select_state(struct cpuidle_driver *drv, struct cpuidle_device *dev, bool *dummy) { … } /** * ladder_enable_device - setup for the governor * @drv: cpuidle driver * @dev: the CPU */ static int ladder_enable_device(struct cpuidle_driver *drv, struct cpuidle_device *dev) { … } /** * ladder_reflect - update the correct last_state_idx * @dev: the CPU * @index: the index of actual state entered */ static void ladder_reflect(struct cpuidle_device *dev, int index) { … } static struct cpuidle_governor ladder_governor = …; /** * init_ladder - initializes the governor */ static int __init init_ladder(void) { … } postcore_initcall(init_ladder);