Lines Matching full:policy

82 static unsigned int __cpufreq_get(struct cpufreq_policy *policy);
83 static int cpufreq_init_governor(struct cpufreq_policy *policy);
84 static void cpufreq_exit_governor(struct cpufreq_policy *policy);
85 static void cpufreq_governor_limits(struct cpufreq_policy *policy);
86 static int cpufreq_set_policy(struct cpufreq_policy *policy,
92 * Two notifier lists: the "policy" list is involved in the
93 * validation process for a new CPU frequency policy; the
120 struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy) in get_governor_parent_kobj() argument
123 return &policy->kobj; in get_governor_parent_kobj()
172 * - policy->cpus with all possible CPUs
174 void cpufreq_generic_init(struct cpufreq_policy *policy, in cpufreq_generic_init() argument
178 policy->freq_table = table; in cpufreq_generic_init()
179 policy->cpuinfo.transition_latency = transition_latency; in cpufreq_generic_init()
185 cpumask_setall(policy->cpus); in cpufreq_generic_init()
191 struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); in cpufreq_cpu_get_raw() local
193 return policy && cpumask_test_cpu(cpu, policy->cpus) ? policy : NULL; in cpufreq_cpu_get_raw()
199 struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu); in cpufreq_generic_get() local
201 if (!policy || IS_ERR(policy->clk)) { in cpufreq_generic_get()
203 __func__, policy ? "clk" : "policy", cpu); in cpufreq_generic_get()
207 return clk_get_rate(policy->clk) / 1000; in cpufreq_generic_get()
212 * cpufreq_cpu_get - Return policy for a CPU and mark it as busy.
213 * @cpu: CPU to find the policy for.
215 * Call cpufreq_cpu_get_raw() to obtain a cpufreq policy for @cpu and increment
216 * the kobject reference counter of that policy. Return a valid policy on
219 * The policy returned by this function has to be released with the help of
224 struct cpufreq_policy *policy = NULL; in cpufreq_cpu_get() local
235 policy = cpufreq_cpu_get_raw(cpu); in cpufreq_cpu_get()
236 if (policy) in cpufreq_cpu_get()
237 kobject_get(&policy->kobj); in cpufreq_cpu_get()
242 return policy; in cpufreq_cpu_get()
247 * cpufreq_cpu_put - Decrement kobject usage counter for cpufreq policy.
248 * @policy: cpufreq policy returned by cpufreq_cpu_get().
250 void cpufreq_cpu_put(struct cpufreq_policy *policy) in cpufreq_cpu_put() argument
252 kobject_put(&policy->kobj); in cpufreq_cpu_put()
257 * cpufreq_cpu_release - Unlock a policy and decrement its usage counter.
258 * @policy: cpufreq policy returned by cpufreq_cpu_acquire().
260 void cpufreq_cpu_release(struct cpufreq_policy *policy) in cpufreq_cpu_release() argument
262 if (WARN_ON(!policy)) in cpufreq_cpu_release()
265 lockdep_assert_held(&policy->rwsem); in cpufreq_cpu_release()
267 up_write(&policy->rwsem); in cpufreq_cpu_release()
269 cpufreq_cpu_put(policy); in cpufreq_cpu_release()
273 * cpufreq_cpu_acquire - Find policy for a CPU, mark it as busy and lock it.
274 * @cpu: CPU to find the policy for.
276 * Call cpufreq_cpu_get() to get a reference on the cpufreq policy for @cpu and
277 * if the policy returned by it is not NULL, acquire its rwsem for writing.
278 * Return the policy if it is active or release it and return NULL otherwise.
280 * The policy returned by this function has to be released with the help of
286 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); in cpufreq_cpu_acquire() local
288 if (!policy) in cpufreq_cpu_acquire()
291 down_write(&policy->rwsem); in cpufreq_cpu_acquire()
293 if (policy_is_inactive(policy)) { in cpufreq_cpu_acquire()
294 cpufreq_cpu_release(policy); in cpufreq_cpu_acquire()
298 return policy; in cpufreq_cpu_acquire()
341 * @policy: cpufreq policy to enable fast frequency switching for.
349 static void cpufreq_notify_transition(struct cpufreq_policy *policy, in cpufreq_notify_transition() argument
360 freqs->policy = policy; in cpufreq_notify_transition()
372 if (policy->cur && policy->cur != freqs->old) { in cpufreq_notify_transition()
374 freqs->old, policy->cur); in cpufreq_notify_transition()
375 freqs->old = policy->cur; in cpufreq_notify_transition()
387 cpumask_pr_args(policy->cpus)); in cpufreq_notify_transition()
389 for_each_cpu(cpu, policy->cpus) in cpufreq_notify_transition()
395 cpufreq_stats_record_transition(policy, freqs->new); in cpufreq_notify_transition()
396 policy->cur = freqs->new; in cpufreq_notify_transition()
401 static void cpufreq_notify_post_transition(struct cpufreq_policy *policy, in cpufreq_notify_post_transition() argument
404 cpufreq_notify_transition(policy, freqs, CPUFREQ_POSTCHANGE); in cpufreq_notify_post_transition()
409 cpufreq_notify_transition(policy, freqs, CPUFREQ_PRECHANGE); in cpufreq_notify_post_transition()
410 cpufreq_notify_transition(policy, freqs, CPUFREQ_POSTCHANGE); in cpufreq_notify_post_transition()
413 void cpufreq_freq_transition_begin(struct cpufreq_policy *policy, in cpufreq_freq_transition_begin() argument
426 && current == policy->transition_task); in cpufreq_freq_transition_begin()
429 wait_event(policy->transition_wait, !policy->transition_ongoing); in cpufreq_freq_transition_begin()
431 spin_lock(&policy->transition_lock); in cpufreq_freq_transition_begin()
433 if (unlikely(policy->transition_ongoing)) { in cpufreq_freq_transition_begin()
434 spin_unlock(&policy->transition_lock); in cpufreq_freq_transition_begin()
438 policy->transition_ongoing = true; in cpufreq_freq_transition_begin()
439 policy->transition_task = current; in cpufreq_freq_transition_begin()
441 spin_unlock(&policy->transition_lock); in cpufreq_freq_transition_begin()
443 cpufreq_notify_transition(policy, freqs, CPUFREQ_PRECHANGE); in cpufreq_freq_transition_begin()
447 void cpufreq_freq_transition_end(struct cpufreq_policy *policy, in cpufreq_freq_transition_end() argument
450 if (WARN_ON(!policy->transition_ongoing)) in cpufreq_freq_transition_end()
453 cpufreq_notify_post_transition(policy, freqs, transition_failed); in cpufreq_freq_transition_end()
455 arch_set_freq_scale(policy->related_cpus, in cpufreq_freq_transition_end()
456 policy->cur, in cpufreq_freq_transition_end()
457 arch_scale_freq_ref(policy->cpu)); in cpufreq_freq_transition_end()
459 spin_lock(&policy->transition_lock); in cpufreq_freq_transition_end()
460 policy->transition_ongoing = false; in cpufreq_freq_transition_end()
461 policy->transition_task = NULL; in cpufreq_freq_transition_end()
462 spin_unlock(&policy->transition_lock); in cpufreq_freq_transition_end()
464 wake_up(&policy->transition_wait); in cpufreq_freq_transition_end()
490 * cpufreq_enable_fast_switch - Enable fast frequency switching for policy.
491 * @policy: cpufreq policy to enable fast frequency switching for.
493 * Try to enable fast frequency switching for @policy.
500 void cpufreq_enable_fast_switch(struct cpufreq_policy *policy) in cpufreq_enable_fast_switch() argument
502 lockdep_assert_held(&policy->rwsem); in cpufreq_enable_fast_switch()
504 if (!policy->fast_switch_possible) in cpufreq_enable_fast_switch()
510 policy->fast_switch_enabled = true; in cpufreq_enable_fast_switch()
513 policy->cpu); in cpufreq_enable_fast_switch()
521 * cpufreq_disable_fast_switch - Disable fast frequency switching for policy.
522 * @policy: cpufreq policy to disable fast frequency switching for.
524 void cpufreq_disable_fast_switch(struct cpufreq_policy *policy) in cpufreq_disable_fast_switch() argument
527 if (policy->fast_switch_enabled) { in cpufreq_disable_fast_switch()
528 policy->fast_switch_enabled = false; in cpufreq_disable_fast_switch()
536 static unsigned int __resolve_freq(struct cpufreq_policy *policy, in __resolve_freq() argument
541 target_freq = clamp_val(target_freq, policy->min, policy->max); in __resolve_freq()
543 if (!policy->freq_table) in __resolve_freq()
546 idx = cpufreq_frequency_table_target(policy, target_freq, relation); in __resolve_freq()
547 policy->cached_resolved_idx = idx; in __resolve_freq()
548 policy->cached_target_freq = target_freq; in __resolve_freq()
549 return policy->freq_table[idx].frequency; in __resolve_freq()
555 * @policy: associated policy to interrogate
558 * The target to driver frequency mapping is cached in the policy.
561 * given target_freq, subject to policy (min/max) and driver limitations.
563 unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy, in cpufreq_driver_resolve_freq() argument
566 return __resolve_freq(policy, target_freq, CPUFREQ_RELATION_LE); in cpufreq_driver_resolve_freq()
570 unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy) in cpufreq_policy_transition_delay_us() argument
574 if (policy->transition_delay_us) in cpufreq_policy_transition_delay_us()
575 return policy->transition_delay_us; in cpufreq_policy_transition_delay_us()
577 latency = policy->cpuinfo.transition_latency / NSEC_PER_USEC; in cpufreq_policy_transition_delay_us()
616 static ssize_t show_local_boost(struct cpufreq_policy *policy, char *buf) in show_local_boost() argument
618 return sysfs_emit(buf, "%d\n", policy->boost_enabled); in show_local_boost()
621 static ssize_t store_local_boost(struct cpufreq_policy *policy, in store_local_boost() argument
633 if (policy->boost_enabled == enable) in store_local_boost()
636 policy->boost_enabled = enable; in store_local_boost()
639 ret = cpufreq_driver->set_boost(policy, enable); in store_local_boost()
643 policy->boost_enabled = !policy->boost_enabled; in store_local_boost()
714 * Write out information from cpufreq_driver->policy[cpu]; object must be
720 (struct cpufreq_policy *policy, char *buf) \
722 return sysfs_emit(buf, "%u\n", policy->object); \
736 static ssize_t show_scaling_cur_freq(struct cpufreq_policy *policy, char *buf) in show_scaling_cur_freq() argument
741 freq = arch_freq_get_on_cpu(policy->cpu); in show_scaling_cur_freq()
745 ret = sysfs_emit(buf, "%u\n", cpufreq_driver->get(policy->cpu)); in show_scaling_cur_freq()
747 ret = sysfs_emit(buf, "%u\n", policy->cur); in show_scaling_cur_freq()
756 (struct cpufreq_policy *policy, const char *buf, size_t count) \
765 ret = freq_qos_update_request(policy->object##_freq_req, val);\
775 static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy, in show_cpuinfo_cur_freq() argument
778 unsigned int cur_freq = __cpufreq_get(policy); in show_cpuinfo_cur_freq()
787 * show_scaling_governor - show the current policy for the specified CPU
789 static ssize_t show_scaling_governor(struct cpufreq_policy *policy, char *buf) in show_scaling_governor() argument
791 if (policy->policy == CPUFREQ_POLICY_POWERSAVE) in show_scaling_governor()
793 else if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) in show_scaling_governor()
795 else if (policy->governor) in show_scaling_governor()
796 return sysfs_emit(buf, "%s\n", policy->governor->name); in show_scaling_governor()
801 * store_scaling_governor - store policy for the specified CPU
803 static ssize_t store_scaling_governor(struct cpufreq_policy *policy, in store_scaling_governor() argument
820 ret = cpufreq_set_policy(policy, NULL, new_pol); in store_scaling_governor()
828 ret = cpufreq_set_policy(policy, new_gov, in store_scaling_governor()
840 static ssize_t show_scaling_driver(struct cpufreq_policy *policy, char *buf) in show_scaling_driver() argument
848 static ssize_t show_scaling_available_governors(struct cpufreq_policy *policy, in show_scaling_available_governors() argument
895 static ssize_t show_related_cpus(struct cpufreq_policy *policy, char *buf) in show_related_cpus() argument
897 return cpufreq_show_cpus(policy->related_cpus, buf); in show_related_cpus()
903 static ssize_t show_affected_cpus(struct cpufreq_policy *policy, char *buf) in show_affected_cpus() argument
905 return cpufreq_show_cpus(policy->cpus, buf); in show_affected_cpus()
908 static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy, in store_scaling_setspeed() argument
914 if (!policy->governor || !policy->governor->store_setspeed) in store_scaling_setspeed()
921 policy->governor->store_setspeed(policy, freq); in store_scaling_setspeed()
926 static ssize_t show_scaling_setspeed(struct cpufreq_policy *policy, char *buf) in show_scaling_setspeed() argument
928 if (!policy->governor || !policy->governor->show_setspeed) in show_scaling_setspeed()
931 return policy->governor->show_setspeed(policy, buf); in show_scaling_setspeed()
937 static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf) in show_bios_limit() argument
941 ret = cpufreq_driver->bios_limit(policy->cpu, &limit); in show_bios_limit()
944 return sysfs_emit(buf, "%u\n", policy->cpuinfo.max_freq); in show_bios_limit()
983 struct cpufreq_policy *policy = to_policy(kobj); in show() local
990 down_read(&policy->rwsem); in show()
991 if (likely(!policy_is_inactive(policy))) in show()
992 ret = fattr->show(policy, buf); in show()
993 up_read(&policy->rwsem); in show()
1001 struct cpufreq_policy *policy = to_policy(kobj); in store() local
1008 down_write(&policy->rwsem); in store()
1009 if (likely(!policy_is_inactive(policy))) in store()
1010 ret = fattr->store(policy, buf, count); in store()
1011 up_write(&policy->rwsem); in store()
1018 struct cpufreq_policy *policy = to_policy(kobj); in cpufreq_sysfs_release() local
1020 complete(&policy->kobj_unregister); in cpufreq_sysfs_release()
1034 static void add_cpu_dev_symlink(struct cpufreq_policy *policy, unsigned int cpu, in add_cpu_dev_symlink() argument
1040 if (cpumask_test_and_set_cpu(cpu, policy->real_cpus)) in add_cpu_dev_symlink()
1044 if (sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq")) in add_cpu_dev_symlink()
1048 static void remove_cpu_dev_symlink(struct cpufreq_policy *policy, int cpu, in remove_cpu_dev_symlink() argument
1053 cpumask_clear_cpu(cpu, policy->real_cpus); in remove_cpu_dev_symlink()
1056 static int cpufreq_add_dev_interface(struct cpufreq_policy *policy) in cpufreq_add_dev_interface() argument
1064 ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)); in cpufreq_add_dev_interface()
1070 ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); in cpufreq_add_dev_interface()
1075 ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); in cpufreq_add_dev_interface()
1080 ret = sysfs_create_file(&policy->kobj, &bios_limit.attr); in cpufreq_add_dev_interface()
1086 ret = sysfs_create_file(&policy->kobj, &local_boost.attr); in cpufreq_add_dev_interface()
1094 static int cpufreq_init_policy(struct cpufreq_policy *policy) in cpufreq_init_policy() argument
1101 /* Update policy governor to the one used before hotplug. */ in cpufreq_init_policy()
1102 gov = get_governor(policy->last_governor); in cpufreq_init_policy()
1105 gov->name, policy->cpu); in cpufreq_init_policy()
1117 /* Use the default policy if there is no last_policy. */ in cpufreq_init_policy()
1118 if (policy->last_policy) { in cpufreq_init_policy()
1119 pol = policy->last_policy; in cpufreq_init_policy()
1124 * nor "powersave", fall back to the initial policy in cpufreq_init_policy()
1128 pol = policy->policy; in cpufreq_init_policy()
1135 ret = cpufreq_set_policy(policy, gov, pol); in cpufreq_init_policy()
1142 static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, unsigned int cpu) in cpufreq_add_policy_cpu() argument
1147 if (cpumask_test_cpu(cpu, policy->cpus)) in cpufreq_add_policy_cpu()
1150 down_write(&policy->rwsem); in cpufreq_add_policy_cpu()
1152 cpufreq_stop_governor(policy); in cpufreq_add_policy_cpu()
1154 cpumask_set_cpu(cpu, policy->cpus); in cpufreq_add_policy_cpu()
1157 ret = cpufreq_start_governor(policy); in cpufreq_add_policy_cpu()
1161 up_write(&policy->rwsem); in cpufreq_add_policy_cpu()
1165 void refresh_frequency_limits(struct cpufreq_policy *policy) in refresh_frequency_limits() argument
1167 if (!policy_is_inactive(policy)) { in refresh_frequency_limits()
1168 pr_debug("updating policy for CPU %u\n", policy->cpu); in refresh_frequency_limits()
1170 cpufreq_set_policy(policy, policy->governor, policy->policy); in refresh_frequency_limits()
1177 struct cpufreq_policy *policy = in handle_update() local
1180 pr_debug("handle_update for cpu %u called\n", policy->cpu); in handle_update()
1181 down_write(&policy->rwsem); in handle_update()
1182 refresh_frequency_limits(policy); in handle_update()
1183 up_write(&policy->rwsem); in handle_update()
1189 struct cpufreq_policy *policy = container_of(nb, struct cpufreq_policy, nb_min); in cpufreq_notifier_min() local
1191 schedule_work(&policy->update); in cpufreq_notifier_min()
1198 struct cpufreq_policy *policy = container_of(nb, struct cpufreq_policy, nb_max); in cpufreq_notifier_max() local
1200 schedule_work(&policy->update); in cpufreq_notifier_max()
1204 static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy) in cpufreq_policy_put_kobj() argument
1209 down_write(&policy->rwsem); in cpufreq_policy_put_kobj()
1210 cpufreq_stats_free_table(policy); in cpufreq_policy_put_kobj()
1211 kobj = &policy->kobj; in cpufreq_policy_put_kobj()
1212 cmp = &policy->kobj_unregister; in cpufreq_policy_put_kobj()
1213 up_write(&policy->rwsem); in cpufreq_policy_put_kobj()
1228 struct cpufreq_policy *policy; in cpufreq_policy_alloc() local
1235 policy = kzalloc(sizeof(*policy), GFP_KERNEL); in cpufreq_policy_alloc()
1236 if (!policy) in cpufreq_policy_alloc()
1239 if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL)) in cpufreq_policy_alloc()
1242 if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) in cpufreq_policy_alloc()
1245 if (!zalloc_cpumask_var(&policy->real_cpus, GFP_KERNEL)) in cpufreq_policy_alloc()
1248 init_completion(&policy->kobj_unregister); in cpufreq_policy_alloc()
1249 ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, in cpufreq_policy_alloc()
1250 cpufreq_global_kobject, "policy%u", cpu); in cpufreq_policy_alloc()
1252 dev_err(dev, "%s: failed to init policy->kobj: %d\n", __func__, ret); in cpufreq_policy_alloc()
1254 * The entire policy object will be freed below, but the extra in cpufreq_policy_alloc()
1258 kobject_put(&policy->kobj); in cpufreq_policy_alloc()
1262 freq_constraints_init(&policy->constraints); in cpufreq_policy_alloc()
1264 policy->nb_min.notifier_call = cpufreq_notifier_min; in cpufreq_policy_alloc()
1265 policy->nb_max.notifier_call = cpufreq_notifier_max; in cpufreq_policy_alloc()
1267 ret = freq_qos_add_notifier(&policy->constraints, FREQ_QOS_MIN, in cpufreq_policy_alloc()
1268 &policy->nb_min); in cpufreq_policy_alloc()
1275 ret = freq_qos_add_notifier(&policy->constraints, FREQ_QOS_MAX, in cpufreq_policy_alloc()
1276 &policy->nb_max); in cpufreq_policy_alloc()
1283 INIT_LIST_HEAD(&policy->policy_list); in cpufreq_policy_alloc()
1284 init_rwsem(&policy->rwsem); in cpufreq_policy_alloc()
1285 spin_lock_init(&policy->transition_lock); in cpufreq_policy_alloc()
1286 init_waitqueue_head(&policy->transition_wait); in cpufreq_policy_alloc()
1287 INIT_WORK(&policy->update, handle_update); in cpufreq_policy_alloc()
1289 policy->cpu = cpu; in cpufreq_policy_alloc()
1290 return policy; in cpufreq_policy_alloc()
1293 freq_qos_remove_notifier(&policy->constraints, FREQ_QOS_MIN, in cpufreq_policy_alloc()
1294 &policy->nb_min); in cpufreq_policy_alloc()
1296 cpufreq_policy_put_kobj(policy); in cpufreq_policy_alloc()
1298 free_cpumask_var(policy->real_cpus); in cpufreq_policy_alloc()
1300 free_cpumask_var(policy->related_cpus); in cpufreq_policy_alloc()
1302 free_cpumask_var(policy->cpus); in cpufreq_policy_alloc()
1304 kfree(policy); in cpufreq_policy_alloc()
1309 static void cpufreq_policy_free(struct cpufreq_policy *policy) in cpufreq_policy_free() argument
1315 * The callers must ensure the policy is inactive by now, to avoid any in cpufreq_policy_free()
1318 if (unlikely(!policy_is_inactive(policy))) in cpufreq_policy_free()
1319 pr_warn("%s: Freeing active policy\n", __func__); in cpufreq_policy_free()
1321 /* Remove policy from list */ in cpufreq_policy_free()
1323 list_del(&policy->policy_list); in cpufreq_policy_free()
1325 for_each_cpu(cpu, policy->related_cpus) in cpufreq_policy_free()
1329 freq_qos_remove_notifier(&policy->constraints, FREQ_QOS_MAX, in cpufreq_policy_free()
1330 &policy->nb_max); in cpufreq_policy_free()
1331 freq_qos_remove_notifier(&policy->constraints, FREQ_QOS_MIN, in cpufreq_policy_free()
1332 &policy->nb_min); in cpufreq_policy_free()
1334 /* Cancel any pending policy->update work before freeing the policy. */ in cpufreq_policy_free()
1335 cancel_work_sync(&policy->update); in cpufreq_policy_free()
1337 if (policy->max_freq_req) { in cpufreq_policy_free()
1344 CPUFREQ_REMOVE_POLICY, policy); in cpufreq_policy_free()
1345 freq_qos_remove_request(policy->max_freq_req); in cpufreq_policy_free()
1348 freq_qos_remove_request(policy->min_freq_req); in cpufreq_policy_free()
1349 kfree(policy->min_freq_req); in cpufreq_policy_free()
1351 cpufreq_policy_put_kobj(policy); in cpufreq_policy_free()
1352 free_cpumask_var(policy->real_cpus); in cpufreq_policy_free()
1353 free_cpumask_var(policy->related_cpus); in cpufreq_policy_free()
1354 free_cpumask_var(policy->cpus); in cpufreq_policy_free()
1355 kfree(policy); in cpufreq_policy_free()
1360 struct cpufreq_policy *policy; in cpufreq_online() local
1368 /* Check if this CPU already has a policy to manage it */ in cpufreq_online()
1369 policy = per_cpu(cpufreq_cpu_data, cpu); in cpufreq_online()
1370 if (policy) { in cpufreq_online()
1371 WARN_ON(!cpumask_test_cpu(cpu, policy->related_cpus)); in cpufreq_online()
1372 if (!policy_is_inactive(policy)) in cpufreq_online()
1373 return cpufreq_add_policy_cpu(policy, cpu); in cpufreq_online()
1375 /* This is the only online CPU for the policy. Start over. */ in cpufreq_online()
1377 down_write(&policy->rwsem); in cpufreq_online()
1378 policy->cpu = cpu; in cpufreq_online()
1379 policy->governor = NULL; in cpufreq_online()
1382 policy = cpufreq_policy_alloc(cpu); in cpufreq_online()
1383 if (!policy) in cpufreq_online()
1385 down_write(&policy->rwsem); in cpufreq_online()
1389 /* Recover policy->cpus using related_cpus */ in cpufreq_online()
1390 cpumask_copy(policy->cpus, policy->related_cpus); in cpufreq_online()
1392 ret = cpufreq_driver->online(policy); in cpufreq_online()
1399 cpumask_copy(policy->cpus, cpumask_of(cpu)); in cpufreq_online()
1405 ret = cpufreq_driver->init(policy); in cpufreq_online()
1412 /* Let the per-policy boost flag mirror the cpufreq_driver boost during init */ in cpufreq_online()
1413 if (cpufreq_boost_enabled() && policy_has_boost_freq(policy)) in cpufreq_online()
1414 policy->boost_enabled = true; in cpufreq_online()
1417 * The initialization has succeeded and the policy is online. in cpufreq_online()
1421 ret = cpufreq_table_validate_and_sort(policy); in cpufreq_online()
1425 /* related_cpus should at least include policy->cpus. */ in cpufreq_online()
1426 cpumask_copy(policy->related_cpus, policy->cpus); in cpufreq_online()
1433 cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); in cpufreq_online()
1436 for_each_cpu(j, policy->related_cpus) { in cpufreq_online()
1437 per_cpu(cpufreq_cpu_data, j) = policy; in cpufreq_online()
1438 add_cpu_dev_symlink(policy, j, get_cpu_device(j)); in cpufreq_online()
1441 policy->min_freq_req = kzalloc(2 * sizeof(*policy->min_freq_req), in cpufreq_online()
1443 if (!policy->min_freq_req) { in cpufreq_online()
1448 ret = freq_qos_add_request(&policy->constraints, in cpufreq_online()
1449 policy->min_freq_req, FREQ_QOS_MIN, in cpufreq_online()
1456 kfree(policy->min_freq_req); in cpufreq_online()
1457 policy->min_freq_req = NULL; in cpufreq_online()
1466 policy->max_freq_req = policy->min_freq_req + 1; in cpufreq_online()
1468 ret = freq_qos_add_request(&policy->constraints, in cpufreq_online()
1469 policy->max_freq_req, FREQ_QOS_MAX, in cpufreq_online()
1472 policy->max_freq_req = NULL; in cpufreq_online()
1477 CPUFREQ_CREATE_POLICY, policy); in cpufreq_online()
1481 policy->cur = cpufreq_driver->get(policy->cpu); in cpufreq_online()
1482 if (!policy->cur) { in cpufreq_online()
1499 * for the next freq which is >= policy->cur ('cur' must be set by now, in cpufreq_online()
1503 * We are passing target-freq as "policy->cur - 1" otherwise in cpufreq_online()
1504 * __cpufreq_driver_target() would simply fail, as policy->cur will be in cpufreq_online()
1509 unsigned int old_freq = policy->cur; in cpufreq_online()
1512 ret = cpufreq_frequency_table_get_index(policy, old_freq); in cpufreq_online()
1514 ret = __cpufreq_driver_target(policy, old_freq - 1, in cpufreq_online()
1524 __func__, policy->cpu, old_freq, policy->cur); in cpufreq_online()
1529 ret = cpufreq_add_dev_interface(policy); in cpufreq_online()
1533 cpufreq_stats_create_table(policy); in cpufreq_online()
1536 list_add(&policy->policy_list, &cpufreq_policy_list); in cpufreq_online()
1543 * once the energy model is properly initialized for the policy in cpufreq_online()
1546 * Also, this should be called before the policy is registered in cpufreq_online()
1550 cpufreq_driver->register_em(policy); in cpufreq_online()
1553 ret = cpufreq_init_policy(policy); in cpufreq_online()
1555 pr_err("%s: Failed to initialize policy for cpu: %d (%d)\n", in cpufreq_online()
1560 up_write(&policy->rwsem); in cpufreq_online()
1562 kobject_uevent(&policy->kobj, KOBJ_ADD); in cpufreq_online()
1564 /* Callback for handling stuff after policy is ready */ in cpufreq_online()
1566 cpufreq_driver->ready(policy); in cpufreq_online()
1568 /* Register cpufreq cooling only for a new policy */ in cpufreq_online()
1570 policy->cdev = of_cpufreq_cooling_register(policy); in cpufreq_online()
1577 for_each_cpu(j, policy->real_cpus) in cpufreq_online()
1578 remove_cpu_dev_symlink(policy, j, get_cpu_device(j)); in cpufreq_online()
1582 cpufreq_driver->offline(policy); in cpufreq_online()
1586 cpufreq_driver->exit(policy); in cpufreq_online()
1589 cpumask_clear(policy->cpus); in cpufreq_online()
1590 up_write(&policy->rwsem); in cpufreq_online()
1592 cpufreq_policy_free(policy); in cpufreq_online()
1603 struct cpufreq_policy *policy; in cpufreq_add_dev() local
1616 policy = per_cpu(cpufreq_cpu_data, cpu); in cpufreq_add_dev()
1617 if (policy) in cpufreq_add_dev()
1618 add_cpu_dev_symlink(policy, cpu, dev); in cpufreq_add_dev()
1623 static void __cpufreq_offline(unsigned int cpu, struct cpufreq_policy *policy) in __cpufreq_offline() argument
1628 cpufreq_stop_governor(policy); in __cpufreq_offline()
1630 cpumask_clear_cpu(cpu, policy->cpus); in __cpufreq_offline()
1632 if (!policy_is_inactive(policy)) { in __cpufreq_offline()
1634 if (cpu == policy->cpu) in __cpufreq_offline()
1635 policy->cpu = cpumask_any(policy->cpus); in __cpufreq_offline()
1637 /* Start the governor again for the active policy. */ in __cpufreq_offline()
1639 ret = cpufreq_start_governor(policy); in __cpufreq_offline()
1648 strscpy(policy->last_governor, policy->governor->name, in __cpufreq_offline()
1651 policy->last_policy = policy->policy; in __cpufreq_offline()
1654 cpufreq_exit_governor(policy); in __cpufreq_offline()
1661 cpufreq_driver->offline(policy); in __cpufreq_offline()
1666 cpufreq_driver->exit(policy); in __cpufreq_offline()
1668 policy->freq_table = NULL; in __cpufreq_offline()
1673 struct cpufreq_policy *policy; in cpufreq_offline() local
1677 policy = cpufreq_cpu_get_raw(cpu); in cpufreq_offline()
1678 if (!policy) { in cpufreq_offline()
1683 down_write(&policy->rwsem); in cpufreq_offline()
1685 __cpufreq_offline(cpu, policy); in cpufreq_offline()
1687 up_write(&policy->rwsem); in cpufreq_offline()
1699 struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); in cpufreq_remove_dev() local
1701 if (!policy) in cpufreq_remove_dev()
1704 down_write(&policy->rwsem); in cpufreq_remove_dev()
1707 __cpufreq_offline(cpu, policy); in cpufreq_remove_dev()
1709 remove_cpu_dev_symlink(policy, cpu, dev); in cpufreq_remove_dev()
1711 if (!cpumask_empty(policy->real_cpus)) { in cpufreq_remove_dev()
1712 up_write(&policy->rwsem); in cpufreq_remove_dev()
1717 * Unregister cpufreq cooling once all the CPUs of the policy are in cpufreq_remove_dev()
1721 cpufreq_cooling_unregister(policy->cdev); in cpufreq_remove_dev()
1722 policy->cdev = NULL; in cpufreq_remove_dev()
1727 cpufreq_driver->exit(policy); in cpufreq_remove_dev()
1729 up_write(&policy->rwsem); in cpufreq_remove_dev()
1731 cpufreq_policy_free(policy); in cpufreq_remove_dev()
1736 * @policy: Policy managing CPUs.
1742 static void cpufreq_out_of_sync(struct cpufreq_policy *policy, in cpufreq_out_of_sync() argument
1748 policy->cur, new_freq); in cpufreq_out_of_sync()
1750 freqs.old = policy->cur; in cpufreq_out_of_sync()
1753 cpufreq_freq_transition_begin(policy, &freqs); in cpufreq_out_of_sync()
1754 cpufreq_freq_transition_end(policy, &freqs, 0); in cpufreq_out_of_sync()
1757 static unsigned int cpufreq_verify_current_freq(struct cpufreq_policy *policy, bool update) in cpufreq_verify_current_freq() argument
1761 new_freq = cpufreq_driver->get(policy->cpu); in cpufreq_verify_current_freq()
1766 * If fast frequency switching is used with the given policy, the check in cpufreq_verify_current_freq()
1767 * against policy->cur is pointless, so skip it in that case. in cpufreq_verify_current_freq()
1769 if (policy->fast_switch_enabled || !has_target()) in cpufreq_verify_current_freq()
1772 if (policy->cur != new_freq) { in cpufreq_verify_current_freq()
1780 if (abs(policy->cur - new_freq) < KHZ_PER_MHZ) in cpufreq_verify_current_freq()
1781 return policy->cur; in cpufreq_verify_current_freq()
1783 cpufreq_out_of_sync(policy, new_freq); in cpufreq_verify_current_freq()
1785 schedule_work(&policy->update); in cpufreq_verify_current_freq()
1792 * cpufreq_quick_get - get the CPU frequency (in kHz) from policy->cur
1800 struct cpufreq_policy *policy; in cpufreq_quick_get() local
1814 policy = cpufreq_cpu_get(cpu); in cpufreq_quick_get()
1815 if (policy) { in cpufreq_quick_get()
1816 ret_freq = policy->cur; in cpufreq_quick_get()
1817 cpufreq_cpu_put(policy); in cpufreq_quick_get()
1832 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); in cpufreq_quick_get_max() local
1835 if (policy) { in cpufreq_quick_get_max()
1836 ret_freq = policy->max; in cpufreq_quick_get_max()
1837 cpufreq_cpu_put(policy); in cpufreq_quick_get_max()
1852 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); in cpufreq_get_hw_max_freq() local
1855 if (policy) { in cpufreq_get_hw_max_freq()
1856 ret_freq = policy->cpuinfo.max_freq; in cpufreq_get_hw_max_freq()
1857 cpufreq_cpu_put(policy); in cpufreq_get_hw_max_freq()
1864 static unsigned int __cpufreq_get(struct cpufreq_policy *policy) in __cpufreq_get() argument
1866 if (unlikely(policy_is_inactive(policy))) in __cpufreq_get()
1869 return cpufreq_verify_current_freq(policy, true); in __cpufreq_get()
1880 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); in cpufreq_get() local
1883 if (policy) { in cpufreq_get()
1884 down_read(&policy->rwsem); in cpufreq_get()
1886 ret_freq = __cpufreq_get(policy); in cpufreq_get()
1887 up_read(&policy->rwsem); in cpufreq_get()
1889 cpufreq_cpu_put(policy); in cpufreq_get()
1907 int cpufreq_generic_suspend(struct cpufreq_policy *policy) in cpufreq_generic_suspend() argument
1911 if (!policy->suspend_freq) { in cpufreq_generic_suspend()
1917 policy->suspend_freq); in cpufreq_generic_suspend()
1919 ret = __cpufreq_driver_target(policy, policy->suspend_freq, in cpufreq_generic_suspend()
1923 __func__, policy->suspend_freq, ret); in cpufreq_generic_suspend()
1939 struct cpufreq_policy *policy; in cpufreq_suspend() local
1949 for_each_active_policy(policy) { in cpufreq_suspend()
1951 down_write(&policy->rwsem); in cpufreq_suspend()
1952 cpufreq_stop_governor(policy); in cpufreq_suspend()
1953 up_write(&policy->rwsem); in cpufreq_suspend()
1956 if (cpufreq_driver->suspend && cpufreq_driver->suspend(policy)) in cpufreq_suspend()
1973 struct cpufreq_policy *policy; in cpufreq_resume() local
1989 for_each_active_policy(policy) { in cpufreq_resume()
1990 if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) { in cpufreq_resume()
1994 down_write(&policy->rwsem); in cpufreq_resume()
1995 ret = cpufreq_start_governor(policy); in cpufreq_resume()
1996 up_write(&policy->rwsem); in cpufreq_resume()
1999 pr_err("%s: Failed to start governor for CPU%u's policy\n", in cpufreq_resume()
2000 __func__, policy->cpu); in cpufreq_resume()
2058 * of notifiers that ron on cpufreq policy changes.
2144 * @policy: cpufreq policy to switch the frequency for.
2154 * This function must not be called if policy->fast_switch_enabled is unset.
2157 * twice in parallel for the same policy and that it will never be called in
2158 * parallel with either ->target() or ->target_index() for the same policy.
2165 unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, in cpufreq_driver_fast_switch() argument
2171 target_freq = clamp_val(target_freq, policy->min, policy->max); in cpufreq_driver_fast_switch()
2172 freq = cpufreq_driver->fast_switch(policy, target_freq); in cpufreq_driver_fast_switch()
2177 policy->cur = freq; in cpufreq_driver_fast_switch()
2178 arch_set_freq_scale(policy->related_cpus, freq, in cpufreq_driver_fast_switch()
2179 arch_scale_freq_ref(policy->cpu)); in cpufreq_driver_fast_switch()
2180 cpufreq_stats_record_transition(policy, freq); in cpufreq_driver_fast_switch()
2183 for_each_cpu(cpu, policy->cpus) in cpufreq_driver_fast_switch()
2205 * This function must not be called if policy->fast_switch_enabled is unset.
2232 static int __target_intermediate(struct cpufreq_policy *policy, in __target_intermediate() argument
2237 freqs->new = cpufreq_driver->get_intermediate(policy, index); in __target_intermediate()
2244 __func__, policy->cpu, freqs->old, freqs->new); in __target_intermediate()
2246 cpufreq_freq_transition_begin(policy, freqs); in __target_intermediate()
2247 ret = cpufreq_driver->target_intermediate(policy, index); in __target_intermediate()
2248 cpufreq_freq_transition_end(policy, freqs, ret); in __target_intermediate()
2257 static int __target_index(struct cpufreq_policy *policy, int index) in __target_index() argument
2259 struct cpufreq_freqs freqs = {.old = policy->cur, .flags = 0}; in __target_index()
2261 unsigned int newfreq = policy->freq_table[index].frequency; in __target_index()
2265 if (newfreq == policy->cur) in __target_index()
2269 restore_freq = policy->cur; in __target_index()
2275 retval = __target_intermediate(policy, &freqs, index); in __target_index()
2287 __func__, policy->cpu, freqs.old, freqs.new); in __target_index()
2289 cpufreq_freq_transition_begin(policy, &freqs); in __target_index()
2292 retval = cpufreq_driver->target_index(policy, index); in __target_index()
2298 cpufreq_freq_transition_end(policy, &freqs, retval); in __target_index()
2309 cpufreq_freq_transition_begin(policy, &freqs); in __target_index()
2310 cpufreq_freq_transition_end(policy, &freqs, 0); in __target_index()
2317 int __cpufreq_driver_target(struct cpufreq_policy *policy, in __cpufreq_driver_target() argument
2326 target_freq = __resolve_freq(policy, target_freq, relation); in __cpufreq_driver_target()
2329 policy->cpu, target_freq, relation, old_target_freq); in __cpufreq_driver_target()
2337 if (target_freq == policy->cur && in __cpufreq_driver_target()
2346 if (!policy->efficiencies_available) in __cpufreq_driver_target()
2349 return cpufreq_driver->target(policy, target_freq, relation); in __cpufreq_driver_target()
2355 return __target_index(policy, policy->cached_resolved_idx); in __cpufreq_driver_target()
2359 int cpufreq_driver_target(struct cpufreq_policy *policy, in cpufreq_driver_target() argument
2365 down_write(&policy->rwsem); in cpufreq_driver_target()
2367 ret = __cpufreq_driver_target(policy, target_freq, relation); in cpufreq_driver_target()
2369 up_write(&policy->rwsem); in cpufreq_driver_target()
2380 static int cpufreq_init_governor(struct cpufreq_policy *policy) in cpufreq_init_governor() argument
2391 if (!policy->governor) in cpufreq_init_governor()
2395 if (policy->governor->flags & CPUFREQ_GOV_DYNAMIC_SWITCHING && in cpufreq_init_governor()
2401 policy->governor->name, gov->name); in cpufreq_init_governor()
2402 policy->governor = gov; in cpufreq_init_governor()
2408 if (!try_module_get(policy->governor->owner)) in cpufreq_init_governor()
2411 pr_debug("%s: for CPU %u\n", __func__, policy->cpu); in cpufreq_init_governor()
2413 if (policy->governor->init) { in cpufreq_init_governor()
2414 ret = policy->governor->init(policy); in cpufreq_init_governor()
2416 module_put(policy->governor->owner); in cpufreq_init_governor()
2421 policy->strict_target = !!(policy->governor->flags & CPUFREQ_GOV_STRICT_TARGET); in cpufreq_init_governor()
2426 static void cpufreq_exit_governor(struct cpufreq_policy *policy) in cpufreq_exit_governor() argument
2428 if (cpufreq_suspended || !policy->governor) in cpufreq_exit_governor()
2431 pr_debug("%s: for CPU %u\n", __func__, policy->cpu); in cpufreq_exit_governor()
2433 if (policy->governor->exit) in cpufreq_exit_governor()
2434 policy->governor->exit(policy); in cpufreq_exit_governor()
2436 module_put(policy->governor->owner); in cpufreq_exit_governor()
2439 int cpufreq_start_governor(struct cpufreq_policy *policy) in cpufreq_start_governor() argument
2446 if (!policy->governor) in cpufreq_start_governor()
2449 pr_debug("%s: for CPU %u\n", __func__, policy->cpu); in cpufreq_start_governor()
2452 cpufreq_verify_current_freq(policy, false); in cpufreq_start_governor()
2454 if (policy->governor->start) { in cpufreq_start_governor()
2455 ret = policy->governor->start(policy); in cpufreq_start_governor()
2460 if (policy->governor->limits) in cpufreq_start_governor()
2461 policy->governor->limits(policy); in cpufreq_start_governor()
2466 void cpufreq_stop_governor(struct cpufreq_policy *policy) in cpufreq_stop_governor() argument
2468 if (cpufreq_suspended || !policy->governor) in cpufreq_stop_governor()
2471 pr_debug("%s: for CPU %u\n", __func__, policy->cpu); in cpufreq_stop_governor()
2473 if (policy->governor->stop) in cpufreq_stop_governor()
2474 policy->governor->stop(policy); in cpufreq_stop_governor()
2477 static void cpufreq_governor_limits(struct cpufreq_policy *policy) in cpufreq_governor_limits() argument
2479 if (cpufreq_suspended || !policy->governor) in cpufreq_governor_limits()
2482 pr_debug("%s: for CPU %u\n", __func__, policy->cpu); in cpufreq_governor_limits()
2484 if (policy->governor->limits) in cpufreq_governor_limits()
2485 policy->governor->limits(policy); in cpufreq_governor_limits()
2513 struct cpufreq_policy *policy; in cpufreq_unregister_governor() local
2524 for_each_inactive_policy(policy) { in cpufreq_unregister_governor()
2525 if (!strcmp(policy->last_governor, governor->name)) { in cpufreq_unregister_governor()
2526 policy->governor = NULL; in cpufreq_unregister_governor()
2527 strcpy(policy->last_governor, "\0"); in cpufreq_unregister_governor()
2540 * POLICY INTERFACE *
2545 * @policy: struct cpufreq_policy into which the current cpufreq_policy
2547 * @cpu: CPU to find the policy for
2549 * Reads the current cpufreq policy.
2551 int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu) in cpufreq_get_policy() argument
2554 if (!policy) in cpufreq_get_policy()
2561 memcpy(policy, cpu_policy, sizeof(*policy)); in cpufreq_get_policy()
2572 * @policy: cpufreq policy of the CPUs.
2574 * Update the value of cpufreq pressure for all @cpus in the policy.
2576 static void cpufreq_update_pressure(struct cpufreq_policy *policy) in cpufreq_update_pressure() argument
2582 cpu = cpumask_first(policy->related_cpus); in cpufreq_update_pressure()
2584 capped_freq = policy->max; in cpufreq_update_pressure()
2598 for_each_cpu(cpu, policy->related_cpus) in cpufreq_update_pressure()
2603 * cpufreq_set_policy - Modify cpufreq policy parameters.
2604 * @policy: Policy object to modify.
2605 * @new_gov: Policy governor pointer.
2606 * @new_pol: Policy value (for drivers with built-in governors).
2609 * limits to be set for the policy, update @policy with the verified limits
2611 * carry out a governor update for @policy. That is, run the current governor's
2613 * @policy) or replace the governor for @policy with @new_gov.
2615 * The cpuinfo part of @policy is not updated by this function.
2617 static int cpufreq_set_policy(struct cpufreq_policy *policy, in cpufreq_set_policy() argument
2625 memcpy(&new_data.cpuinfo, &policy->cpuinfo, sizeof(policy->cpuinfo)); in cpufreq_set_policy()
2626 new_data.freq_table = policy->freq_table; in cpufreq_set_policy()
2627 new_data.cpu = policy->cpu; in cpufreq_set_policy()
2632 new_data.min = freq_qos_read_value(&policy->constraints, FREQ_QOS_MIN); in cpufreq_set_policy()
2633 new_data.max = freq_qos_read_value(&policy->constraints, FREQ_QOS_MAX); in cpufreq_set_policy()
2635 pr_debug("setting new policy for CPU %u: %u - %u kHz\n", in cpufreq_set_policy()
2647 * Resolve policy min/max to available frequencies. It ensures in cpufreq_set_policy()
2651 policy->min = new_data.min; in cpufreq_set_policy()
2652 policy->max = new_data.max; in cpufreq_set_policy()
2653 policy->min = __resolve_freq(policy, policy->min, CPUFREQ_RELATION_L); in cpufreq_set_policy()
2654 policy->max = __resolve_freq(policy, policy->max, CPUFREQ_RELATION_H); in cpufreq_set_policy()
2655 trace_cpu_frequency_limits(policy); in cpufreq_set_policy()
2657 cpufreq_update_pressure(policy); in cpufreq_set_policy()
2659 policy->cached_target_freq = UINT_MAX; in cpufreq_set_policy()
2662 policy->min, policy->max); in cpufreq_set_policy()
2665 policy->policy = new_pol; in cpufreq_set_policy()
2667 return cpufreq_driver->setpolicy(policy); in cpufreq_set_policy()
2670 if (new_gov == policy->governor) { in cpufreq_set_policy()
2672 cpufreq_governor_limits(policy); in cpufreq_set_policy()
2679 old_gov = policy->governor; in cpufreq_set_policy()
2682 cpufreq_stop_governor(policy); in cpufreq_set_policy()
2683 cpufreq_exit_governor(policy); in cpufreq_set_policy()
2687 policy->governor = new_gov; in cpufreq_set_policy()
2688 ret = cpufreq_init_governor(policy); in cpufreq_set_policy()
2690 ret = cpufreq_start_governor(policy); in cpufreq_set_policy()
2695 cpufreq_exit_governor(policy); in cpufreq_set_policy()
2699 pr_debug("starting governor %s failed\n", policy->governor->name); in cpufreq_set_policy()
2701 policy->governor = old_gov; in cpufreq_set_policy()
2702 if (cpufreq_init_governor(policy)) in cpufreq_set_policy()
2703 policy->governor = NULL; in cpufreq_set_policy()
2705 cpufreq_start_governor(policy); in cpufreq_set_policy()
2712 * cpufreq_update_policy - Re-evaluate an existing cpufreq policy.
2713 * @cpu: CPU to re-evaluate the policy for.
2715 * Update the current frequency for the cpufreq policy of @cpu and use
2717 * evaluation of policy notifiers and the cpufreq driver's ->verify() callback
2718 * for the policy in question, among other things.
2722 struct cpufreq_policy *policy = cpufreq_cpu_acquire(cpu); in cpufreq_update_policy() local
2724 if (!policy) in cpufreq_update_policy()
2732 (cpufreq_suspended || WARN_ON(!cpufreq_verify_current_freq(policy, false)))) in cpufreq_update_policy()
2735 refresh_frequency_limits(policy); in cpufreq_update_policy()
2738 cpufreq_cpu_release(policy); in cpufreq_update_policy()
2743 * cpufreq_update_limits - Update policy limits for a given CPU.
2744 * @cpu: CPU to update the policy limits for.
2761 static int cpufreq_boost_set_sw(struct cpufreq_policy *policy, int state) in cpufreq_boost_set_sw() argument
2765 if (!policy->freq_table) in cpufreq_boost_set_sw()
2768 ret = cpufreq_frequency_table_cpuinfo(policy, policy->freq_table); in cpufreq_boost_set_sw()
2770 pr_err("%s: Policy frequency update failed\n", __func__); in cpufreq_boost_set_sw()
2774 ret = freq_qos_update_request(policy->max_freq_req, policy->max); in cpufreq_boost_set_sw()
2783 struct cpufreq_policy *policy; in cpufreq_boost_trigger_state() local
2795 for_each_active_policy(policy) { in cpufreq_boost_trigger_state()
2796 policy->boost_enabled = state; in cpufreq_boost_trigger_state()
2797 ret = cpufreq_driver->set_boost(policy, state); in cpufreq_boost_trigger_state()
2799 policy->boost_enabled = !policy->boost_enabled; in cpufreq_boost_trigger_state()