• Home
  • Raw
  • Download

Lines Matching +full:sense +full:- +full:freq

1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <linux/percpu-defs.h>
20 /* On-demand governor macros */
57 * Find right freq to be set now with powersave_bias on.
68 struct policy_dbs_info *policy_dbs = policy->governor_data; in generic_powersave_bias_target()
70 struct dbs_data *dbs_data = policy_dbs->dbs_data; in generic_powersave_bias_target()
71 struct od_dbs_tuners *od_tuners = dbs_data->tuners; in generic_powersave_bias_target()
72 struct cpufreq_frequency_table *freq_table = policy->freq_table; in generic_powersave_bias_target()
75 dbs_info->freq_lo = 0; in generic_powersave_bias_target()
76 dbs_info->freq_lo_delay_us = 0; in generic_powersave_bias_target()
80 index = cpufreq_frequency_table_target(policy, freq_next, policy->min, in generic_powersave_bias_target()
81 policy->max, relation); in generic_powersave_bias_target()
83 freq_reduc = freq_req * od_tuners->powersave_bias / 1000; in generic_powersave_bias_target()
84 freq_avg = freq_req - freq_reduc; in generic_powersave_bias_target()
86 /* Find freq bounds for freq_avg in freq_table */ in generic_powersave_bias_target()
96 dbs_info->freq_lo = 0; in generic_powersave_bias_target()
97 dbs_info->freq_lo_delay_us = 0; in generic_powersave_bias_target()
100 delay_hi_us = (freq_avg - freq_lo) * dbs_data->sampling_rate; in generic_powersave_bias_target()
101 delay_hi_us += (freq_hi - freq_lo) / 2; in generic_powersave_bias_target()
102 delay_hi_us /= freq_hi - freq_lo; in generic_powersave_bias_target()
103 dbs_info->freq_hi_delay_us = delay_hi_us; in generic_powersave_bias_target()
104 dbs_info->freq_lo = freq_lo; in generic_powersave_bias_target()
105 dbs_info->freq_lo_delay_us = dbs_data->sampling_rate - delay_hi_us; in generic_powersave_bias_target()
111 struct od_policy_dbs_info *dbs_info = to_dbs_info(policy->governor_data); in ondemand_powersave_bias_init()
113 dbs_info->freq_lo = 0; in ondemand_powersave_bias_init()
116 static void dbs_freq_increase(struct cpufreq_policy *policy, unsigned int freq) in dbs_freq_increase() argument
118 struct policy_dbs_info *policy_dbs = policy->governor_data; in dbs_freq_increase()
119 struct dbs_data *dbs_data = policy_dbs->dbs_data; in dbs_freq_increase()
120 struct od_dbs_tuners *od_tuners = dbs_data->tuners; in dbs_freq_increase()
122 if (od_tuners->powersave_bias) in dbs_freq_increase()
123 freq = od_ops.powersave_bias_target(policy, freq, in dbs_freq_increase()
125 else if (policy->cur == policy->max) in dbs_freq_increase()
128 __cpufreq_driver_target(policy, freq, od_tuners->powersave_bias ? in dbs_freq_increase()
139 struct policy_dbs_info *policy_dbs = policy->governor_data; in od_update()
141 struct dbs_data *dbs_data = policy_dbs->dbs_data; in od_update()
142 struct od_dbs_tuners *od_tuners = dbs_data->tuners; in od_update()
145 dbs_info->freq_lo = 0; in od_update()
148 if (load > dbs_data->up_threshold) { in od_update()
150 if (policy->cur < policy->max) in od_update()
151 policy_dbs->rate_mult = dbs_data->sampling_down_factor; in od_update()
152 dbs_freq_increase(policy, policy->max); in od_update()
157 min_f = policy->cpuinfo.min_freq; in od_update()
158 max_f = policy->cpuinfo.max_freq; in od_update()
159 freq_next = min_f + load * (max_f - min_f) / 100; in od_update()
162 policy_dbs->rate_mult = 1; in od_update()
164 if (od_tuners->powersave_bias) in od_update()
175 struct policy_dbs_info *policy_dbs = policy->governor_data; in od_dbs_update()
176 struct dbs_data *dbs_data = policy_dbs->dbs_data; in od_dbs_update()
178 int sample_type = dbs_info->sample_type; in od_dbs_update()
181 dbs_info->sample_type = OD_NORMAL_SAMPLE; in od_dbs_update()
183 * OD_SUB_SAMPLE doesn't make sense if sample_delay_ns is 0, so ignore in od_dbs_update()
186 if (sample_type == OD_SUB_SAMPLE && policy_dbs->sample_delay_ns > 0) { in od_dbs_update()
187 __cpufreq_driver_target(policy, dbs_info->freq_lo, in od_dbs_update()
189 return dbs_info->freq_lo_delay_us; in od_dbs_update()
194 if (dbs_info->freq_lo) { in od_dbs_update()
196 dbs_info->sample_type = OD_SUB_SAMPLE; in od_dbs_update()
197 return dbs_info->freq_hi_delay_us; in od_dbs_update()
200 return dbs_data->sampling_rate * policy_dbs->rate_mult; in od_dbs_update()
215 return -EINVAL; in io_is_busy_store()
216 dbs_data->io_is_busy = !!input; in io_is_busy_store()
218 /* we need to re-evaluate prev_cpu_idle */ in io_is_busy_store()
234 return -EINVAL; in up_threshold_store()
237 dbs_data->up_threshold = input; in up_threshold_store()
251 return -EINVAL; in sampling_down_factor_store()
253 dbs_data->sampling_down_factor = input; in sampling_down_factor_store()
256 list_for_each_entry(policy_dbs, &attr_set->policy_list, list) { in sampling_down_factor_store()
261 mutex_lock(&policy_dbs->update_mutex); in sampling_down_factor_store()
262 policy_dbs->rate_mult = 1; in sampling_down_factor_store()
263 mutex_unlock(&policy_dbs->update_mutex); in sampling_down_factor_store()
278 return -EINVAL; in ignore_nice_load_store()
283 if (input == dbs_data->ignore_nice_load) { /* nothing to do */ in ignore_nice_load_store()
286 dbs_data->ignore_nice_load = input; in ignore_nice_load_store()
288 /* we need to re-evaluate prev_cpu_idle */ in ignore_nice_load_store()
298 struct od_dbs_tuners *od_tuners = dbs_data->tuners; in powersave_bias_store()
305 return -EINVAL; in powersave_bias_store()
310 od_tuners->powersave_bias = input; in powersave_bias_store()
312 list_for_each_entry(policy_dbs, &attr_set->policy_list, list) in powersave_bias_store()
313 ondemand_powersave_bias_init(policy_dbs->policy); in powersave_bias_store()
350 return dbs_info ? &dbs_info->policy_dbs : NULL; in od_alloc()
366 return -ENOMEM; in od_init()
371 if (idle_time != -1ULL) { in od_init()
373 dbs_data->up_threshold = MICRO_FREQUENCY_UP_THRESHOLD; in od_init()
375 dbs_data->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; in od_init()
378 dbs_data->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; in od_init()
379 dbs_data->ignore_nice_load = 0; in od_init()
380 tuners->powersave_bias = default_powersave_bias; in od_init()
381 dbs_data->io_is_busy = should_io_be_busy(); in od_init()
383 dbs_data->tuners = tuners; in od_init()
389 kfree(dbs_data->tuners); in od_exit()
394 struct od_policy_dbs_info *dbs_info = to_dbs_info(policy->governor_data); in od_start()
396 dbs_info->sample_type = OD_NORMAL_SAMPLE; in od_start()
439 if (!policy || policy->governor != &CPU_FREQ_GOV_ONDEMAND) in od_set_powersave_bias()
442 policy_dbs = policy->governor_data; in od_set_powersave_bias()
446 cpumask_or(done, done, policy->cpus); in od_set_powersave_bias()
448 dbs_data = policy_dbs->dbs_data; in od_set_powersave_bias()
449 od_tuners = dbs_data->tuners; in od_set_powersave_bias()
450 od_tuners->powersave_bias = default_powersave_bias; in od_set_powersave_bias()
475 MODULE_DESCRIPTION("'cpufreq_ondemand' - A dynamic cpufreq governor for "