Lines Matching full:policy

220 	if (epp > 0 && cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) {  in amd_pstate_set_energy_pref_index()
221 pr_debug("EPP cannot be set under performance policy\n"); in amd_pstate_set_energy_pref_index()
471 static int amd_pstate_verify(struct cpufreq_policy_data *policy) in amd_pstate_verify() argument
473 cpufreq_verify_within_cpu_limits(policy); in amd_pstate_verify()
478 static int amd_pstate_update_min_max_limit(struct cpufreq_policy *policy) in amd_pstate_update_min_max_limit() argument
481 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_update_min_max_limit()
483 max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq); in amd_pstate_update_min_max_limit()
484 min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq); in amd_pstate_update_min_max_limit()
488 WRITE_ONCE(cpudata->max_limit_freq, policy->max); in amd_pstate_update_min_max_limit()
489 WRITE_ONCE(cpudata->min_limit_freq, policy->min); in amd_pstate_update_min_max_limit()
494 static int amd_pstate_update_freq(struct cpufreq_policy *policy, in amd_pstate_update_freq() argument
498 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_update_freq()
504 if (policy->min != cpudata->min_limit_freq || policy->max != cpudata->max_limit_freq) in amd_pstate_update_freq()
505 amd_pstate_update_min_max_limit(policy); in amd_pstate_update_freq()
511 freqs.old = policy->cur; in amd_pstate_update_freq()
517 WARN_ON(fast_switch && !policy->fast_switch_enabled); in amd_pstate_update_freq()
524 cpufreq_freq_transition_begin(policy, &freqs); in amd_pstate_update_freq()
527 max_perf, fast_switch, policy->governor->flags); in amd_pstate_update_freq()
530 cpufreq_freq_transition_end(policy, &freqs, false); in amd_pstate_update_freq()
535 static int amd_pstate_target(struct cpufreq_policy *policy, in amd_pstate_target() argument
539 return amd_pstate_update_freq(policy, target_freq, false); in amd_pstate_target()
542 static unsigned int amd_pstate_fast_switch(struct cpufreq_policy *policy, in amd_pstate_fast_switch() argument
545 if (!amd_pstate_update_freq(policy, target_freq, true)) in amd_pstate_fast_switch()
547 return policy->cur; in amd_pstate_fast_switch()
557 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); in amd_pstate_adjust_perf() local
558 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_adjust_perf()
561 if (policy->min != cpudata->min_limit_freq || policy->max != cpudata->max_limit_freq) in amd_pstate_adjust_perf()
562 amd_pstate_update_min_max_limit(policy); in amd_pstate_adjust_perf()
586 policy->cur = target_freq; in amd_pstate_adjust_perf()
589 policy->governor->flags); in amd_pstate_adjust_perf()
590 cpufreq_cpu_put(policy); in amd_pstate_adjust_perf()
665 static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state) in amd_pstate_set_boost() argument
667 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_set_boost()
676 policy->cpuinfo.max_freq = cpudata->max_freq; in amd_pstate_set_boost()
678 policy->cpuinfo.max_freq = cpudata->nominal_freq; in amd_pstate_set_boost()
680 policy->max = policy->cpuinfo.max_freq; in amd_pstate_set_boost()
683 policy->cpuinfo.max_freq); in amd_pstate_set_boost()
709 static int amd_pstate_cpu_init(struct cpufreq_policy *policy) in amd_pstate_cpu_init() argument
719 amd_perf_ctl_reset(policy->cpu); in amd_pstate_cpu_init()
720 dev = get_cpu_device(policy->cpu); in amd_pstate_cpu_init()
728 cpudata->cpu = policy->cpu; in amd_pstate_cpu_init()
746 policy->cpuinfo.transition_latency = AMD_PSTATE_TRANSITION_LATENCY; in amd_pstate_cpu_init()
747 policy->transition_delay_us = AMD_PSTATE_TRANSITION_DELAY; in amd_pstate_cpu_init()
749 policy->min = min_freq; in amd_pstate_cpu_init()
750 policy->max = max_freq; in amd_pstate_cpu_init()
752 policy->cpuinfo.min_freq = min_freq; in amd_pstate_cpu_init()
753 policy->cpuinfo.max_freq = max_freq; in amd_pstate_cpu_init()
756 policy->cur = policy->cpuinfo.min_freq; in amd_pstate_cpu_init()
759 policy->fast_switch_possible = true; in amd_pstate_cpu_init()
761 ret = freq_qos_add_request(&policy->constraints, &cpudata->req[0], in amd_pstate_cpu_init()
762 FREQ_QOS_MIN, policy->cpuinfo.min_freq); in amd_pstate_cpu_init()
768 ret = freq_qos_add_request(&policy->constraints, &cpudata->req[1], in amd_pstate_cpu_init()
769 FREQ_QOS_MAX, policy->cpuinfo.max_freq); in amd_pstate_cpu_init()
783 policy->driver_data = cpudata; in amd_pstate_cpu_init()
798 static int amd_pstate_cpu_exit(struct cpufreq_policy *policy) in amd_pstate_cpu_exit() argument
800 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_cpu_exit()
804 policy->fast_switch_possible = false; in amd_pstate_cpu_exit()
810 static int amd_pstate_cpu_resume(struct cpufreq_policy *policy) in amd_pstate_cpu_resume() argument
821 static int amd_pstate_cpu_suspend(struct cpufreq_policy *policy) in amd_pstate_cpu_suspend() argument
839 static ssize_t show_amd_pstate_max_freq(struct cpufreq_policy *policy, in show_amd_pstate_max_freq() argument
843 struct amd_cpudata *cpudata = policy->driver_data; in show_amd_pstate_max_freq()
852 static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *policy, in show_amd_pstate_lowest_nonlinear_freq() argument
856 struct amd_cpudata *cpudata = policy->driver_data; in show_amd_pstate_lowest_nonlinear_freq()
869 static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy, in show_amd_pstate_highest_perf() argument
873 struct amd_cpudata *cpudata = policy->driver_data; in show_amd_pstate_highest_perf()
881 struct cpufreq_policy *policy, char *buf) in show_energy_performance_available_preferences() argument
885 struct amd_cpudata *cpudata = policy->driver_data; in show_energy_performance_available_preferences()
887 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) in show_energy_performance_available_preferences()
900 struct cpufreq_policy *policy, const char *buf, size_t count) in store_energy_performance_preference() argument
902 struct amd_cpudata *cpudata = policy->driver_data; in store_energy_performance_preference()
922 struct cpufreq_policy *policy, char *buf) in show_energy_performance_preference() argument
924 struct amd_cpudata *cpudata = policy->driver_data; in show_energy_performance_preference()
1131 static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) in amd_pstate_epp_cpu_init() argument
1142 amd_perf_ctl_reset(policy->cpu); in amd_pstate_epp_cpu_init()
1143 dev = get_cpu_device(policy->cpu); in amd_pstate_epp_cpu_init()
1151 cpudata->cpu = policy->cpu; in amd_pstate_epp_cpu_init()
1169 policy->cpuinfo.min_freq = min_freq; in amd_pstate_epp_cpu_init()
1170 policy->cpuinfo.max_freq = max_freq; in amd_pstate_epp_cpu_init()
1172 policy->cur = policy->cpuinfo.min_freq; in amd_pstate_epp_cpu_init()
1180 policy->driver_data = cpudata; in amd_pstate_epp_cpu_init()
1184 policy->min = policy->cpuinfo.min_freq; in amd_pstate_epp_cpu_init()
1185 policy->max = policy->cpuinfo.max_freq; in amd_pstate_epp_cpu_init()
1188 * Set the policy to provide a valid fallback value in case in amd_pstate_epp_cpu_init()
1193 policy->policy = CPUFREQ_POLICY_PERFORMANCE; in amd_pstate_epp_cpu_init()
1195 policy->policy = CPUFREQ_POLICY_POWERSAVE; in amd_pstate_epp_cpu_init()
1217 static int amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy) in amd_pstate_epp_cpu_exit() argument
1219 pr_debug("CPU %d exiting\n", policy->cpu); in amd_pstate_epp_cpu_exit()
1223 static void amd_pstate_epp_update_limit(struct cpufreq_policy *policy) in amd_pstate_epp_update_limit() argument
1225 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_update_limit()
1232 max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq); in amd_pstate_epp_update_limit()
1233 min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq); in amd_pstate_epp_update_limit()
1244 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) in amd_pstate_epp_update_limit()
1258 cpudata->epp_policy = cpudata->policy; in amd_pstate_epp_update_limit()
1270 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) in amd_pstate_epp_update_limit()
1283 static int amd_pstate_epp_set_policy(struct cpufreq_policy *policy) in amd_pstate_epp_set_policy() argument
1285 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_set_policy()
1287 if (!policy->cpuinfo.max_freq) in amd_pstate_epp_set_policy()
1290 pr_debug("set_policy: cpuinfo.max %u policy->max %u\n", in amd_pstate_epp_set_policy()
1291 policy->cpuinfo.max_freq, policy->max); in amd_pstate_epp_set_policy()
1293 cpudata->policy = policy->policy; in amd_pstate_epp_set_policy()
1295 amd_pstate_epp_update_limit(policy); in amd_pstate_epp_set_policy()
1322 static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy) in amd_pstate_epp_cpu_online() argument
1324 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_cpu_online()
1336 static void amd_pstate_epp_offline(struct cpufreq_policy *policy) in amd_pstate_epp_offline() argument
1338 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_offline()
1365 static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy) in amd_pstate_epp_cpu_offline() argument
1367 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_cpu_offline()
1375 amd_pstate_epp_offline(policy); in amd_pstate_epp_cpu_offline()
1380 static int amd_pstate_epp_verify_policy(struct cpufreq_policy_data *policy) in amd_pstate_epp_verify_policy() argument
1382 cpufreq_verify_within_cpu_limits(policy); in amd_pstate_epp_verify_policy()
1383 pr_debug("policy_max =%d, policy_min=%d\n", policy->max, policy->min); in amd_pstate_epp_verify_policy()
1387 static int amd_pstate_epp_suspend(struct cpufreq_policy *policy) in amd_pstate_epp_suspend() argument
1389 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_suspend()
1407 static int amd_pstate_epp_resume(struct cpufreq_policy *policy) in amd_pstate_epp_resume() argument
1409 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_resume()