Lines Matching refs:policy

247 	if (epp > 0 && cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) {  in amd_pstate_set_energy_pref_index()
495 static int amd_pstate_verify(struct cpufreq_policy_data *policy) in amd_pstate_verify() argument
497 cpufreq_verify_within_cpu_limits(policy); in amd_pstate_verify()
502 static int amd_pstate_update_min_max_limit(struct cpufreq_policy *policy) in amd_pstate_update_min_max_limit() argument
505 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_update_min_max_limit()
507 max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq); in amd_pstate_update_min_max_limit()
508 min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq); in amd_pstate_update_min_max_limit()
512 WRITE_ONCE(cpudata->max_limit_freq, policy->max); in amd_pstate_update_min_max_limit()
513 WRITE_ONCE(cpudata->min_limit_freq, policy->min); in amd_pstate_update_min_max_limit()
518 static int amd_pstate_update_freq(struct cpufreq_policy *policy, in amd_pstate_update_freq() argument
522 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_update_freq()
528 if (policy->min != cpudata->min_limit_freq || policy->max != cpudata->max_limit_freq) in amd_pstate_update_freq()
529 amd_pstate_update_min_max_limit(policy); in amd_pstate_update_freq()
535 freqs.old = policy->cur; in amd_pstate_update_freq()
541 WARN_ON(fast_switch && !policy->fast_switch_enabled); in amd_pstate_update_freq()
548 cpufreq_freq_transition_begin(policy, &freqs); in amd_pstate_update_freq()
551 max_perf, fast_switch, policy->governor->flags); in amd_pstate_update_freq()
554 cpufreq_freq_transition_end(policy, &freqs, false); in amd_pstate_update_freq()
559 static int amd_pstate_target(struct cpufreq_policy *policy, in amd_pstate_target() argument
563 return amd_pstate_update_freq(policy, target_freq, false); in amd_pstate_target()
566 static unsigned int amd_pstate_fast_switch(struct cpufreq_policy *policy, in amd_pstate_fast_switch() argument
569 if (!amd_pstate_update_freq(policy, target_freq, true)) in amd_pstate_fast_switch()
571 return policy->cur; in amd_pstate_fast_switch()
581 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); in amd_pstate_adjust_perf() local
582 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_adjust_perf()
585 if (policy->min != cpudata->min_limit_freq || policy->max != cpudata->max_limit_freq) in amd_pstate_adjust_perf()
586 amd_pstate_update_min_max_limit(policy); in amd_pstate_adjust_perf()
610 policy->cur = target_freq; in amd_pstate_adjust_perf()
613 policy->governor->flags); in amd_pstate_adjust_perf()
614 cpufreq_cpu_put(policy); in amd_pstate_adjust_perf()
689 static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state) in amd_pstate_set_boost() argument
691 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_set_boost()
700 policy->cpuinfo.max_freq = cpudata->max_freq; in amd_pstate_set_boost()
702 policy->cpuinfo.max_freq = cpudata->nominal_freq; in amd_pstate_set_boost()
704 policy->max = policy->cpuinfo.max_freq; in amd_pstate_set_boost()
707 policy->cpuinfo.max_freq); in amd_pstate_set_boost()
807 static int amd_pstate_cpu_init(struct cpufreq_policy *policy) in amd_pstate_cpu_init() argument
817 amd_perf_ctl_reset(policy->cpu); in amd_pstate_cpu_init()
818 dev = get_cpu_device(policy->cpu); in amd_pstate_cpu_init()
826 cpudata->cpu = policy->cpu; in amd_pstate_cpu_init()
846 policy->cpuinfo.transition_latency = AMD_PSTATE_TRANSITION_LATENCY; in amd_pstate_cpu_init()
847 policy->transition_delay_us = AMD_PSTATE_TRANSITION_DELAY; in amd_pstate_cpu_init()
849 policy->min = min_freq; in amd_pstate_cpu_init()
850 policy->max = max_freq; in amd_pstate_cpu_init()
852 policy->cpuinfo.min_freq = min_freq; in amd_pstate_cpu_init()
853 policy->cpuinfo.max_freq = max_freq; in amd_pstate_cpu_init()
856 policy->cur = policy->cpuinfo.min_freq; in amd_pstate_cpu_init()
859 policy->fast_switch_possible = true; in amd_pstate_cpu_init()
861 ret = freq_qos_add_request(&policy->constraints, &cpudata->req[0], in amd_pstate_cpu_init()
862 FREQ_QOS_MIN, policy->cpuinfo.min_freq); in amd_pstate_cpu_init()
868 ret = freq_qos_add_request(&policy->constraints, &cpudata->req[1], in amd_pstate_cpu_init()
869 FREQ_QOS_MAX, policy->cpuinfo.max_freq); in amd_pstate_cpu_init()
883 policy->driver_data = cpudata; in amd_pstate_cpu_init()
898 static int amd_pstate_cpu_exit(struct cpufreq_policy *policy) in amd_pstate_cpu_exit() argument
900 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_cpu_exit()
904 policy->fast_switch_possible = false; in amd_pstate_cpu_exit()
910 static int amd_pstate_cpu_resume(struct cpufreq_policy *policy) in amd_pstate_cpu_resume() argument
921 static int amd_pstate_cpu_suspend(struct cpufreq_policy *policy) in amd_pstate_cpu_suspend() argument
939 static ssize_t show_amd_pstate_max_freq(struct cpufreq_policy *policy, in show_amd_pstate_max_freq() argument
943 struct amd_cpudata *cpudata = policy->driver_data; in show_amd_pstate_max_freq()
952 static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *policy, in show_amd_pstate_lowest_nonlinear_freq() argument
956 struct amd_cpudata *cpudata = policy->driver_data; in show_amd_pstate_lowest_nonlinear_freq()
969 static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy, in show_amd_pstate_highest_perf() argument
973 struct amd_cpudata *cpudata = policy->driver_data; in show_amd_pstate_highest_perf()
980 static ssize_t show_amd_pstate_hw_prefcore(struct cpufreq_policy *policy, in show_amd_pstate_hw_prefcore() argument
984 struct amd_cpudata *cpudata = policy->driver_data; in show_amd_pstate_hw_prefcore()
992 struct cpufreq_policy *policy, char *buf) in show_energy_performance_available_preferences() argument
996 struct amd_cpudata *cpudata = policy->driver_data; in show_energy_performance_available_preferences()
998 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) in show_energy_performance_available_preferences()
1011 struct cpufreq_policy *policy, const char *buf, size_t count) in store_energy_performance_preference() argument
1013 struct amd_cpudata *cpudata = policy->driver_data; in store_energy_performance_preference()
1033 struct cpufreq_policy *policy, char *buf) in show_energy_performance_preference() argument
1035 struct amd_cpudata *cpudata = policy->driver_data; in show_energy_performance_preference()
1263 static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) in amd_pstate_epp_cpu_init() argument
1274 amd_perf_ctl_reset(policy->cpu); in amd_pstate_epp_cpu_init()
1275 dev = get_cpu_device(policy->cpu); in amd_pstate_epp_cpu_init()
1283 cpudata->cpu = policy->cpu; in amd_pstate_epp_cpu_init()
1303 policy->cpuinfo.min_freq = min_freq; in amd_pstate_epp_cpu_init()
1304 policy->cpuinfo.max_freq = max_freq; in amd_pstate_epp_cpu_init()
1306 policy->cur = policy->cpuinfo.min_freq; in amd_pstate_epp_cpu_init()
1314 policy->driver_data = cpudata; in amd_pstate_epp_cpu_init()
1318 policy->min = policy->cpuinfo.min_freq; in amd_pstate_epp_cpu_init()
1319 policy->max = policy->cpuinfo.max_freq; in amd_pstate_epp_cpu_init()
1327 policy->policy = CPUFREQ_POLICY_PERFORMANCE; in amd_pstate_epp_cpu_init()
1329 policy->policy = CPUFREQ_POLICY_POWERSAVE; in amd_pstate_epp_cpu_init()
1351 static int amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy) in amd_pstate_epp_cpu_exit() argument
1353 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_cpu_exit()
1357 policy->driver_data = NULL; in amd_pstate_epp_cpu_exit()
1360 pr_debug("CPU %d exiting\n", policy->cpu); in amd_pstate_epp_cpu_exit()
1364 static void amd_pstate_epp_update_limit(struct cpufreq_policy *policy) in amd_pstate_epp_update_limit() argument
1366 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_update_limit()
1373 max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq); in amd_pstate_epp_update_limit()
1374 min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq); in amd_pstate_epp_update_limit()
1385 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) in amd_pstate_epp_update_limit()
1399 cpudata->epp_policy = cpudata->policy; in amd_pstate_epp_update_limit()
1411 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) in amd_pstate_epp_update_limit()
1424 static int amd_pstate_epp_set_policy(struct cpufreq_policy *policy) in amd_pstate_epp_set_policy() argument
1426 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_set_policy()
1428 if (!policy->cpuinfo.max_freq) in amd_pstate_epp_set_policy()
1432 policy->cpuinfo.max_freq, policy->max); in amd_pstate_epp_set_policy()
1434 cpudata->policy = policy->policy; in amd_pstate_epp_set_policy()
1436 amd_pstate_epp_update_limit(policy); in amd_pstate_epp_set_policy()
1463 static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy) in amd_pstate_epp_cpu_online() argument
1465 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_cpu_online()
1477 static void amd_pstate_epp_offline(struct cpufreq_policy *policy) in amd_pstate_epp_offline() argument
1479 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_offline()
1506 static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy) in amd_pstate_epp_cpu_offline() argument
1508 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_cpu_offline()
1516 amd_pstate_epp_offline(policy); in amd_pstate_epp_cpu_offline()
1521 static int amd_pstate_epp_verify_policy(struct cpufreq_policy_data *policy) in amd_pstate_epp_verify_policy() argument
1523 cpufreq_verify_within_cpu_limits(policy); in amd_pstate_epp_verify_policy()
1524 pr_debug("policy_max =%d, policy_min=%d\n", policy->max, policy->min); in amd_pstate_epp_verify_policy()
1528 static int amd_pstate_epp_suspend(struct cpufreq_policy *policy) in amd_pstate_epp_suspend() argument
1530 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_suspend()
1548 static int amd_pstate_epp_resume(struct cpufreq_policy *policy) in amd_pstate_epp_resume() argument
1550 struct amd_cpudata *cpudata = policy->driver_data; in amd_pstate_epp_resume()