|
@@ -1557,21 +1557,25 @@ void cpufreq_suspend(void)
|
|
if (!cpufreq_driver)
|
|
if (!cpufreq_driver)
|
|
return;
|
|
return;
|
|
|
|
|
|
- if (!has_target())
|
|
|
|
|
|
+ if (!has_target() && !cpufreq_driver->suspend)
|
|
goto suspend;
|
|
goto suspend;
|
|
|
|
|
|
pr_debug("%s: Suspending Governors\n", __func__);
|
|
pr_debug("%s: Suspending Governors\n", __func__);
|
|
|
|
|
|
for_each_active_policy(policy) {
|
|
for_each_active_policy(policy) {
|
|
- down_write(&policy->rwsem);
|
|
|
|
- ret = cpufreq_governor(policy, CPUFREQ_GOV_STOP);
|
|
|
|
- up_write(&policy->rwsem);
|
|
|
|
|
|
+ if (has_target()) {
|
|
|
|
+ down_write(&policy->rwsem);
|
|
|
|
+ ret = cpufreq_governor(policy, CPUFREQ_GOV_STOP);
|
|
|
|
+ up_write(&policy->rwsem);
|
|
|
|
|
|
- if (ret)
|
|
|
|
- pr_err("%s: Failed to stop governor for policy: %p\n",
|
|
|
|
- __func__, policy);
|
|
|
|
- else if (cpufreq_driver->suspend
|
|
|
|
- && cpufreq_driver->suspend(policy))
|
|
|
|
|
|
+ if (ret) {
|
|
|
|
+ pr_err("%s: Failed to stop governor for policy: %p\n",
|
|
|
|
+ __func__, policy);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (cpufreq_driver->suspend && cpufreq_driver->suspend(policy))
|
|
pr_err("%s: Failed to suspend driver: %p\n", __func__,
|
|
pr_err("%s: Failed to suspend driver: %p\n", __func__,
|
|
policy);
|
|
policy);
|
|
}
|
|
}
|
|
@@ -1596,7 +1600,7 @@ void cpufreq_resume(void)
|
|
|
|
|
|
cpufreq_suspended = false;
|
|
cpufreq_suspended = false;
|
|
|
|
|
|
- if (!has_target())
|
|
|
|
|
|
+ if (!has_target() && !cpufreq_driver->resume)
|
|
return;
|
|
return;
|
|
|
|
|
|
pr_debug("%s: Resuming Governors\n", __func__);
|
|
pr_debug("%s: Resuming Governors\n", __func__);
|
|
@@ -1605,7 +1609,7 @@ void cpufreq_resume(void)
|
|
if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) {
|
|
if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) {
|
|
pr_err("%s: Failed to resume driver: %p\n", __func__,
|
|
pr_err("%s: Failed to resume driver: %p\n", __func__,
|
|
policy);
|
|
policy);
|
|
- } else {
|
|
|
|
|
|
+ } else if (has_target()) {
|
|
down_write(&policy->rwsem);
|
|
down_write(&policy->rwsem);
|
|
ret = cpufreq_start_governor(policy);
|
|
ret = cpufreq_start_governor(policy);
|
|
up_write(&policy->rwsem);
|
|
up_write(&policy->rwsem);
|