Lines Matching +full:cpufreq +full:- +full:hw

1 .. SPDX-License-Identifier: GPL-2.0
4 How to Implement a new CPUFreq Processor Driver
10 - Dominik Brodowski <linux@brodo.de>
11 - Rafael J. Wysocki <rafael.j.wysocki@intel.com>
12 - Viresh Kumar <viresh.kumar@linaro.org>
18 1.2 Per-CPU Initialization
31 So, you just got a brand-new CPU / chipset with datasheets and want to
32 add cpufreq support for this CPU / chipset? Great. Here are some hints
37 ------------------
41 chipset. If so, register a struct cpufreq_driver with the CPUfreq core
46 .name - The name of this driver.
48 .init - A pointer to the per-policy initialization function.
50 .verify - A pointer to a "verification" function.
52 .setpolicy _or_ .fast_switch _or_ .target _or_ .target_index - See
57 .flags - Hints for the cpufreq core.
59 .driver_data - cpufreq driver specific data.
61 .get_intermediate and target_intermediate - Used to switch to stable
64 .get - Returns current frequency of the CPU.
66 .bios_limit - Returns HW/BIOS max frequency limitations for the CPU.
68 .exit - A pointer to a per-policy cleanup function called during
71 .suspend - A pointer to a per-policy suspend function which is called
75 .resume - A pointer to a per-policy resume function which is called
78 .attr - A pointer to a NULL-terminated list of "struct freq_attr" which
81 .boost_enabled - If set, boost frequencies are enabled.
83 .set_boost - A pointer to a per-policy function to enable/disable boost
87 1.2 Per-CPU Initialization
88 --------------------------
91 cpufreq driver registers itself, the per-policy initialization function
92 cpufreq_driver.init is called if no cpufreq policy existed for the CPU.
97 If necessary, activate the CPUfreq support on your CPU.
101 +-----------------------------------+--------------------------------------+
102 |policy->cpuinfo.min_freq _and_ | |
103 |policy->cpuinfo.max_freq | the minimum and maximum frequency |
106 +-----------------------------------+--------------------------------------+
107 |policy->cpuinfo.transition_latency | the time it takes on this CPU to |
111 +-----------------------------------+--------------------------------------+
112 |policy->cur | The current operating frequency of |
114 +-----------------------------------+--------------------------------------+
115 |policy->min, | |
116 |policy->max, | |
117 |policy->policy and, if necessary, | |
118 |policy->governor | must contain the "default policy" for|
124 +-----------------------------------+--------------------------------------+
125 |policy->cpus | Update this with the masks of the |
129 +-----------------------------------+--------------------------------------+
131 For setting some of these values (cpuinfo.min[max]_freq, policy->min[max]), the
137 ----------
147 range) is within policy->min and policy->max. If necessary, increase
148 policy->max first, and only if this is no solution, decrease policy->min.
152 -------------------------------------------------------
154 Most cpufreq drivers or even most cpu frequency scaling algorithms
156 these, you use the ->target(), ->target_index() or ->fast_switch()
159 Some cpufreq capable processors switch the frequency between certain
160 limits on their own. These shall use the ->setpolicy() callback.
164 ------------------------
169 The CPUfreq driver must set the new frequency when called here. The
172 It should always restore to earlier frequency (i.e. policy->restore_freq) in
176 ----------
180 The CPUfreq driver must set the new frequency when called here. The
183 - keep close to "target_freq"
184 - policy->min <= new_freq <= policy->max (THIS MUST BE VALID!!!)
185 - if relation==CPUFREQ_REL_L, try to select a new_freq higher than or equal
187 - if relation==CPUFREQ_REL_H, try to select a new_freq lower than or equal
190 Here again the frequency table helper might assist you - see section 2
194 ----------------
206 -------------
209 argument. You need to set the lower limit of the in-processor or
210 in-chipset dynamic frequency switching to policy->min, the upper limit
211 to policy->max, and -if supported- select a performance-oriented
212 setting when policy->policy is CPUFREQ_POLICY_PERFORMANCE, and a
213 powersaving-oriented setting when CPUFREQ_POLICY_POWERSAVE. Also check
214 the reference implementation in drivers/cpufreq/longrun.c
217 --------------------------------------------
229 directly call ->target_index().
231 NOTE: ->target_index() should restore to policy->restore_freq in case of
238 As most cpufreq processors only allow for being set to a few specific
247 particular order, but if they are cpufreq core will do DVFS a bit
250 The cpufreq table is verified automatically by the core if the policy contains a
251 valid pointer in its policy->freq_table field.
254 frequency is within policy->min and policy->max, and all other criteria
255 are met. This is helpful for the ->verify call.
258 helper for the ->target stage. Just pass the values to this function,
264 cpufreq_for_each_entry(pos, table) - iterates over all entries of frequency
267 cpufreq_for_each_valid_entry(pos, table) - iterates over all entries,
269 Use arguments "pos" - a ``cpufreq_frequency_table *`` as a loop cursor and
270 "table" - the ``cpufreq_frequency_table *`` you want to iterate over.
278 pos->frequency = ...