Lines Matching +full:max +full:- +full:freq

1 // SPDX-License-Identifier: GPL-2.0-only
15 /* Default constants for DevFreq-Simple-Ondemand (DFSO) */
19 unsigned long *freq) in devfreq_simple_ondemand_func() argument
26 struct devfreq_simple_ondemand_data *data = df->data; in devfreq_simple_ondemand_func()
32 stat = &df->last_status; in devfreq_simple_ondemand_func()
35 if (data->upthreshold) in devfreq_simple_ondemand_func()
36 dfso_upthreshold = data->upthreshold; in devfreq_simple_ondemand_func()
37 if (data->downdifferential) in devfreq_simple_ondemand_func()
38 dfso_downdifferential = data->downdifferential; in devfreq_simple_ondemand_func()
42 return -EINVAL; in devfreq_simple_ondemand_func()
44 /* Assume MAX if it is going to be divided by zero */ in devfreq_simple_ondemand_func()
45 if (stat->total_time == 0) { in devfreq_simple_ondemand_func()
46 *freq = DEVFREQ_MAX_FREQ; in devfreq_simple_ondemand_func()
51 if (stat->busy_time >= (1 << 24) || stat->total_time >= (1 << 24)) { in devfreq_simple_ondemand_func()
52 stat->busy_time >>= 7; in devfreq_simple_ondemand_func()
53 stat->total_time >>= 7; in devfreq_simple_ondemand_func()
56 /* Set MAX if it's busy enough */ in devfreq_simple_ondemand_func()
57 if (stat->busy_time * 100 > in devfreq_simple_ondemand_func()
58 stat->total_time * dfso_upthreshold) { in devfreq_simple_ondemand_func()
59 *freq = DEVFREQ_MAX_FREQ; in devfreq_simple_ondemand_func()
63 /* Set MAX if we do not know the initial frequency */ in devfreq_simple_ondemand_func()
64 if (stat->current_frequency == 0) { in devfreq_simple_ondemand_func()
65 *freq = DEVFREQ_MAX_FREQ; in devfreq_simple_ondemand_func()
70 if (stat->busy_time * 100 > in devfreq_simple_ondemand_func()
71 stat->total_time * (dfso_upthreshold - dfso_downdifferential)) { in devfreq_simple_ondemand_func()
72 *freq = stat->current_frequency; in devfreq_simple_ondemand_func()
77 a = stat->busy_time; in devfreq_simple_ondemand_func()
78 a *= stat->current_frequency; in devfreq_simple_ondemand_func()
79 b = div_u64(a, stat->total_time); in devfreq_simple_ondemand_func()
81 b = div_u64(b, (dfso_upthreshold - dfso_downdifferential / 2)); in devfreq_simple_ondemand_func()
82 *freq = (unsigned long) b; in devfreq_simple_ondemand_func()
143 MODULE_DESCRIPTION("DEVFREQ Simple On-demand governor");