diff options
-rw-r--r-- | drivers/acpi/processor_idle.c | 2 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq-dt.c | 11 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 6 | ||||
-rw-r--r-- | drivers/cpuidle/governors/ladder.c | 7 | ||||
-rw-r--r-- | drivers/cpuidle/governors/menu.c | 25 | ||||
-rw-r--r-- | include/linux/cpuidle.h | 3 |
6 files changed, 28 insertions, 26 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 499536504698..87b704e41877 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -985,8 +985,6 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) | |||
985 | state->flags = 0; | 985 | state->flags = 0; |
986 | switch (cx->type) { | 986 | switch (cx->type) { |
987 | case ACPI_STATE_C1: | 987 | case ACPI_STATE_C1: |
988 | if (cx->entry_method != ACPI_CSTATE_FFH) | ||
989 | state->flags |= CPUIDLE_FLAG_TIME_INVALID; | ||
990 | 988 | ||
991 | state->enter = acpi_idle_enter_c1; | 989 | state->enter = acpi_idle_enter_c1; |
992 | state->enter_dead = acpi_idle_play_dead; | 990 | state->enter_dead = acpi_idle_play_dead; |
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index f56147a1daed..fde97d6e31d6 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c | |||
@@ -211,6 +211,17 @@ static int cpufreq_init(struct cpufreq_policy *policy) | |||
211 | /* OPPs might be populated at runtime, don't check for error here */ | 211 | /* OPPs might be populated at runtime, don't check for error here */ |
212 | of_init_opp_table(cpu_dev); | 212 | of_init_opp_table(cpu_dev); |
213 | 213 | ||
214 | /* | ||
215 | * But we need OPP table to function so if it is not there let's | ||
216 | * give platform code chance to provide it for us. | ||
217 | */ | ||
218 | ret = dev_pm_opp_get_opp_count(cpu_dev); | ||
219 | if (ret <= 0) { | ||
220 | pr_debug("OPP table is not ready, deferring probe\n"); | ||
221 | ret = -EPROBE_DEFER; | ||
222 | goto out_free_opp; | ||
223 | } | ||
224 | |||
214 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 225 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
215 | if (!priv) { | 226 | if (!priv) { |
216 | ret = -ENOMEM; | 227 | ret = -ENOMEM; |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index a09a29c312a9..46bed4f81cde 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -2028,6 +2028,12 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, | |||
2028 | /* Don't start any governor operations if we are entering suspend */ | 2028 | /* Don't start any governor operations if we are entering suspend */ |
2029 | if (cpufreq_suspended) | 2029 | if (cpufreq_suspended) |
2030 | return 0; | 2030 | return 0; |
2031 | /* | ||
2032 | * Governor might not be initiated here if ACPI _PPC changed | ||
2033 | * notification happened, so check it. | ||
2034 | */ | ||
2035 | if (!policy->governor) | ||
2036 | return -EINVAL; | ||
2031 | 2037 | ||
2032 | if (policy->governor->max_transition_latency && | 2038 | if (policy->governor->max_transition_latency && |
2033 | policy->cpuinfo.transition_latency > | 2039 | policy->cpuinfo.transition_latency > |
diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index 37263d9a1051..401c0106ed34 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c | |||
@@ -79,12 +79,7 @@ static int ladder_select_state(struct cpuidle_driver *drv, | |||
79 | 79 | ||
80 | last_state = &ldev->states[last_idx]; | 80 | last_state = &ldev->states[last_idx]; |
81 | 81 | ||
82 | if (!(drv->states[last_idx].flags & CPUIDLE_FLAG_TIME_INVALID)) { | 82 | last_residency = cpuidle_get_last_residency(dev) - drv->states[last_idx].exit_latency; |
83 | last_residency = cpuidle_get_last_residency(dev) - \ | ||
84 | drv->states[last_idx].exit_latency; | ||
85 | } | ||
86 | else | ||
87 | last_residency = last_state->threshold.promotion_time + 1; | ||
88 | 83 | ||
89 | /* consider promotion */ | 84 | /* consider promotion */ |
90 | if (last_idx < drv->state_count - 1 && | 85 | if (last_idx < drv->state_count - 1 && |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 659d7b0c9ebf..40580794e23d 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -396,8 +396,8 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
396 | * power state and occurrence of the wakeup event. | 396 | * power state and occurrence of the wakeup event. |
397 | * | 397 | * |
398 | * If the entered idle state didn't support residency measurements, | 398 | * If the entered idle state didn't support residency measurements, |
399 | * we are basically lost in the dark how much time passed. | 399 | * we use them anyway if they are short, and if long, |
400 | * As a compromise, assume we slept for the whole expected time. | 400 | * truncate to the whole expected time. |
401 | * | 401 | * |
402 | * Any measured amount of time will include the exit latency. | 402 | * Any measured amount of time will include the exit latency. |
403 | * Since we are interested in when the wakeup begun, not when it | 403 | * Since we are interested in when the wakeup begun, not when it |
@@ -405,22 +405,17 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
405 | * the measured amount of time is less than the exit latency, | 405 | * the measured amount of time is less than the exit latency, |
406 | * assume the state was never reached and the exit latency is 0. | 406 | * assume the state was never reached and the exit latency is 0. |
407 | */ | 407 | */ |
408 | if (unlikely(target->flags & CPUIDLE_FLAG_TIME_INVALID)) { | ||
409 | /* Use timer value as is */ | ||
410 | measured_us = data->next_timer_us; | ||
411 | 408 | ||
412 | } else { | 409 | /* measured value */ |
413 | /* Use measured value */ | 410 | measured_us = cpuidle_get_last_residency(dev); |
414 | measured_us = cpuidle_get_last_residency(dev); | ||
415 | 411 | ||
416 | /* Deduct exit latency */ | 412 | /* Deduct exit latency */ |
417 | if (measured_us > target->exit_latency) | 413 | if (measured_us > target->exit_latency) |
418 | measured_us -= target->exit_latency; | 414 | measured_us -= target->exit_latency; |
419 | 415 | ||
420 | /* Make sure our coefficients do not exceed unity */ | 416 | /* Make sure our coefficients do not exceed unity */ |
421 | if (measured_us > data->next_timer_us) | 417 | if (measured_us > data->next_timer_us) |
422 | measured_us = data->next_timer_us; | 418 | measured_us = data->next_timer_us; |
423 | } | ||
424 | 419 | ||
425 | /* Update our correction ratio */ | 420 | /* Update our correction ratio */ |
426 | new_factor = data->correction_factor[data->bucket]; | 421 | new_factor = data->correction_factor[data->bucket]; |
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index a07e087f54b2..ab70f3bc44ad 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h | |||
@@ -53,7 +53,6 @@ struct cpuidle_state { | |||
53 | }; | 53 | }; |
54 | 54 | ||
55 | /* Idle State Flags */ | 55 | /* Idle State Flags */ |
56 | #define CPUIDLE_FLAG_TIME_INVALID (0x01) /* is residency time measurable? */ | ||
57 | #define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */ | 56 | #define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */ |
58 | #define CPUIDLE_FLAG_TIMER_STOP (0x04) /* timer is stopped on this state */ | 57 | #define CPUIDLE_FLAG_TIMER_STOP (0x04) /* timer is stopped on this state */ |
59 | 58 | ||
@@ -89,8 +88,6 @@ DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev); | |||
89 | /** | 88 | /** |
90 | * cpuidle_get_last_residency - retrieves the last state's residency time | 89 | * cpuidle_get_last_residency - retrieves the last state's residency time |
91 | * @dev: the target CPU | 90 | * @dev: the target CPU |
92 | * | ||
93 | * NOTE: this value is invalid if CPUIDLE_FLAG_TIME_INVALID is set | ||
94 | */ | 91 | */ |
95 | static inline int cpuidle_get_last_residency(struct cpuidle_device *dev) | 92 | static inline int cpuidle_get_last_residency(struct cpuidle_device *dev) |
96 | { | 93 | { |