• Home
  • Raw
  • Download

Lines Matching +full:no +full:- +full:tick +full:- +full:in +full:- +full:suspend

2  * cpuidle.c - core cpuidle infrastructure
4 * (C) 2006-2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
23 #include <linux/suspend.h>
24 #include <linux/tick.h>
51 return off || !initialized || !drv || !dev || !dev->enabled; in cpuidle_not_available()
55 * cpuidle_play_dead - cpu off-lining
57 * Returns in case of an error or no driver
66 return -ENODEV; in cpuidle_play_dead()
68 /* Find lowest-power state that supports long-term idle */ in cpuidle_play_dead()
69 for (i = drv->state_count - 1; i >= 0; i--) in cpuidle_play_dead()
70 if (drv->states[i].enter_dead) in cpuidle_play_dead()
71 return drv->states[i].enter_dead(dev, i); in cpuidle_play_dead()
73 return -ENODEV; in cpuidle_play_dead()
85 for (i = 1; i < drv->state_count; i++) { in find_deepest_state()
86 struct cpuidle_state *s = &drv->states[i]; in find_deepest_state()
87 struct cpuidle_state_usage *su = &dev->states_usage[i]; in find_deepest_state()
89 if (s->disabled || su->disable || s->exit_latency <= latency_req in find_deepest_state()
90 || s->exit_latency > max_latency in find_deepest_state()
91 || (s->flags & forbidden_flags) in find_deepest_state()
92 || (s2idle && !s->enter_s2idle)) in find_deepest_state()
95 latency_req = s->exit_latency; in find_deepest_state()
102 * cpuidle_use_deepest_state - Set/clear governor override flag.
115 dev->use_deepest_state = enable; in cpuidle_use_deepest_state()
120 * cpuidle_find_deepest_state - Find the deepest available idle state.
140 * executing it contains RCU usage regarded as invalid in the idle in enter_s2idle_proper()
150 drv->states[index].enter_s2idle(dev, drv, index); in enter_s2idle_proper()
155 * first CPU executing it calls functions containing RCU read-side in enter_s2idle_proper()
163 dev->states_usage[index].s2idle_time += ktime_us_delta(time_end, time_start); in enter_s2idle_proper()
164 dev->states_usage[index].s2idle_usage++; in enter_s2idle_proper()
168 * cpuidle_enter_s2idle - Enter an idle state suitable for suspend-to-idle.
172 * If there are states with the ->enter_s2idle callback, find the deepest of
173 * them and enter it with frozen tick.
180 * Find the deepest state with ->enter_s2idle present, which guarantees in cpuidle_enter_s2idle()
181 * that interrupts won't be enabled when it exits and allows the tick to in cpuidle_enter_s2idle()
193 * cpuidle_enter_state - enter the state and update stats
196 * @index: index into the states table in @drv of the state to enter
203 struct cpuidle_state *target_state = &drv->states[index]; in cpuidle_enter_state()
204 bool broadcast = !!(target_state->flags & CPUIDLE_FLAG_TIMER_STOP); in cpuidle_enter_state()
214 index = find_deepest_state(drv, dev, target_state->exit_latency, in cpuidle_enter_state()
218 return -EBUSY; in cpuidle_enter_state()
220 target_state = &drv->states[index]; in cpuidle_enter_state()
227 trace_cpu_idle_rcuidle(index, dev->cpu); in cpuidle_enter_state()
231 entered_state = target_state->enter(dev, drv, index); in cpuidle_enter_state()
236 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); in cpuidle_enter_state()
238 /* The cpu is no longer idle or about to enter idle. */ in cpuidle_enter_state()
255 dev->last_residency = (int) diff; in cpuidle_enter_state()
260 * but that results in multiple copies of same code. in cpuidle_enter_state()
262 dev->states_usage[entered_state].time += dev->last_residency; in cpuidle_enter_state()
263 dev->states_usage[entered_state].usage++; in cpuidle_enter_state()
265 dev->last_residency = 0; in cpuidle_enter_state()
272 * cpuidle_select - ask the cpuidle framework to choose an idle state
276 * @stop_tick: indication on whether or not to stop the tick
281 * 'false' boolean value if the scheduler tick should not be stopped before
287 return cpuidle_curr_governor->select(drv, dev, stop_tick); in cpuidle_select()
291 * cpuidle_enter - enter into the specified idle state
295 * @index: the index in the idle state table
297 * Returns the index in the idle state, < 0 in case of error.
309 * cpuidle_reflect - tell the underlying governor what was the state
310 * we were in
313 * @index: the index in the idle state table
318 if (cpuidle_curr_governor->reflect && index >= 0) in cpuidle_reflect()
319 cpuidle_curr_governor->reflect(dev, index); in cpuidle_reflect()
323 * cpuidle_install_idle_handler - installs the cpuidle idle loop handler
335 * cpuidle_uninstall_idle_handler - uninstalls the cpuidle idle loop handler
352 * cpuidle_pause_and_lock - temporarily disables CPUIDLE
363 * cpuidle_resume_and_unlock - resumes CPUIDLE operation
373 /* Currently used in suspend/resume path to suspend cpuidle */
381 /* Currently used in suspend/resume path to resume cpuidle */
390 * cpuidle_enable_device - enables idle PM for a CPU
402 return -EINVAL; in cpuidle_enable_device()
404 if (dev->enabled) in cpuidle_enable_device()
408 return -EIO; in cpuidle_enable_device()
413 return -EIO; in cpuidle_enable_device()
415 if (!dev->registered) in cpuidle_enable_device()
416 return -EINVAL; in cpuidle_enable_device()
422 if (cpuidle_curr_governor->enable) { in cpuidle_enable_device()
423 ret = cpuidle_curr_governor->enable(drv, dev); in cpuidle_enable_device()
430 dev->enabled = 1; in cpuidle_enable_device()
444 * cpuidle_disable_device - disables idle PM for a CPU
454 if (!dev || !dev->enabled) in cpuidle_disable_device()
460 dev->enabled = 0; in cpuidle_disable_device()
462 if (cpuidle_curr_governor->disable) in cpuidle_disable_device()
463 cpuidle_curr_governor->disable(drv, dev); in cpuidle_disable_device()
466 enabled_devices--; in cpuidle_disable_device()
475 list_del(&dev->device_list); in __cpuidle_unregister_device()
476 per_cpu(cpuidle_devices, dev->cpu) = NULL; in __cpuidle_unregister_device()
477 module_put(drv->owner); in __cpuidle_unregister_device()
479 dev->registered = 0; in __cpuidle_unregister_device()
484 memset(dev->states_usage, 0, sizeof(dev->states_usage)); in __cpuidle_device_init()
485 dev->last_residency = 0; in __cpuidle_device_init()
489 * __cpuidle_register_device - internal register function called before register
500 if (!try_module_get(drv->owner)) in __cpuidle_register_device()
501 return -EINVAL; in __cpuidle_register_device()
503 per_cpu(cpuidle_devices, dev->cpu) = dev; in __cpuidle_register_device()
504 list_add(&dev->device_list, &cpuidle_detected_devices); in __cpuidle_register_device()
510 dev->registered = 1; in __cpuidle_register_device()
516 * cpuidle_register_device - registers a CPU's idle PM feature
521 int ret = -EBUSY; in cpuidle_register_device()
524 return -EINVAL; in cpuidle_register_device()
528 if (dev->registered) in cpuidle_register_device()
562 * cpuidle_unregister_device - unregisters a CPU's idle PM feature
567 if (!dev || dev->registered == 0) in cpuidle_unregister_device()
597 for_each_cpu(cpu, drv->cpumask) { in cpuidle_unregister()
609 * initialization pattern there are in the arch specific drivers. The
610 * devices is globally defined in this file.
629 for_each_cpu(cpu, drv->cpumask) { in cpuidle_register()
631 device->cpu = cpu; in cpuidle_register()
636 * enabled in the kernel even if the cpuidle driver does not in cpuidle_register()
640 device->coupled_cpus = *coupled_cpus; in cpuidle_register()
660 * requirement. This means we need to get all processors out of their C-state,
661 * and then recalculate a new suitable C-state. Just do a cross-cpu IPI; that
687 * cpuidle_init - core initializer
694 return -ENODEV; in cpuidle_init()