|
@@ -74,6 +74,17 @@ static void cpuidle_idle_call(void)
|
|
*/
|
|
*/
|
|
hrtimer_peek_ahead_timers();
|
|
hrtimer_peek_ahead_timers();
|
|
#endif
|
|
#endif
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Call the device's prepare function before calling the
|
|
|
|
+ * governor's select function. ->prepare gives the device's
|
|
|
|
+ * cpuidle driver a chance to update any dynamic information
|
|
|
|
+ * of its cpuidle states for the current idle period, e.g.
|
|
|
|
+ * state availability, latencies, residencies, etc.
|
|
|
|
+ */
|
|
|
|
+ if (dev->prepare)
|
|
|
|
+ dev->prepare(dev);
|
|
|
|
+
|
|
/* ask the governor for the next state */
|
|
/* ask the governor for the next state */
|
|
next_state = cpuidle_curr_governor->select(dev);
|
|
next_state = cpuidle_curr_governor->select(dev);
|
|
if (need_resched()) {
|
|
if (need_resched()) {
|
|
@@ -282,6 +293,26 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
|
|
|
|
|
|
poll_idle_init(dev);
|
|
poll_idle_init(dev);
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * cpuidle driver should set the dev->power_specified bit
|
|
|
|
+ * before registering the device if the driver provides
|
|
|
|
+ * power_usage numbers.
|
|
|
|
+ *
|
|
|
|
+ * For those devices whose ->power_specified is not set,
|
|
|
|
+ * we fill in power_usage with decreasing values as the
|
|
|
|
+ * cpuidle code has an implicit assumption that state Cn
|
|
|
|
+ * uses less power than C(n-1).
|
|
|
|
+ *
|
|
|
|
+ * With CONFIG_ARCH_HAS_CPU_RELAX, C0 is already assigned
|
|
|
|
+ * an power value of -1. So we use -2, -3, etc, for other
|
|
|
|
+ * c-states.
|
|
|
|
+ */
|
|
|
|
+ if (!dev->power_specified) {
|
|
|
|
+ int i;
|
|
|
|
+ for (i = CPUIDLE_DRIVER_STATE_START; i < dev->state_count; i++)
|
|
|
|
+ dev->states[i].power_usage = -1 - i;
|
|
|
|
+ }
|
|
|
|
+
|
|
per_cpu(cpuidle_devices, dev->cpu) = dev;
|
|
per_cpu(cpuidle_devices, dev->cpu) = dev;
|
|
list_add(&dev->device_list, &cpuidle_detected_devices);
|
|
list_add(&dev->device_list, &cpuidle_detected_devices);
|
|
if ((ret = cpuidle_add_sysfs(sys_dev))) {
|
|
if ((ret = cpuidle_add_sysfs(sys_dev))) {
|