~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/power/cpupower/lib/cpufreq.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/power/cpupower/lib/cpufreq.h (Architecture m68k) and /tools/power/cpupower/lib/cpufreq.h (Architecture mips)


  1 /* SPDX-License-Identifier: GPL-2.0-only */         1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*                                                  2 /*
  3  *  cpufreq.h - definitions for libcpufreq          3  *  cpufreq.h - definitions for libcpufreq
  4  *                                                  4  *
  5  *  Copyright (C) 2004-2009  Dominik Brodowski      5  *  Copyright (C) 2004-2009  Dominik Brodowski <linux@dominikbrodowski.de>
  6  */                                                 6  */
  7                                                     7 
  8 #ifndef __CPUPOWER_CPUFREQ_H__                      8 #ifndef __CPUPOWER_CPUFREQ_H__
  9 #define __CPUPOWER_CPUFREQ_H__                      9 #define __CPUPOWER_CPUFREQ_H__
 10                                                    10 
 11 struct cpufreq_policy {                            11 struct cpufreq_policy {
 12         unsigned long min;                         12         unsigned long min;
 13         unsigned long max;                         13         unsigned long max;
 14         char *governor;                            14         char *governor;
 15 };                                                 15 };
 16                                                    16 
 17 struct cpufreq_available_governors {               17 struct cpufreq_available_governors {
 18         char *governor;                            18         char *governor;
 19         struct cpufreq_available_governors *ne     19         struct cpufreq_available_governors *next;
 20         struct cpufreq_available_governors *fi     20         struct cpufreq_available_governors *first;
 21 };                                                 21 };
 22                                                    22 
 23 struct cpufreq_available_frequencies {             23 struct cpufreq_available_frequencies {
 24         unsigned long frequency;                   24         unsigned long frequency;
 25         struct cpufreq_available_frequencies *     25         struct cpufreq_available_frequencies *next;
 26         struct cpufreq_available_frequencies *     26         struct cpufreq_available_frequencies *first;
 27 };                                                 27 };
 28                                                    28 
 29                                                    29 
 30 struct cpufreq_affected_cpus {                     30 struct cpufreq_affected_cpus {
 31         unsigned int cpu;                          31         unsigned int cpu;
 32         struct cpufreq_affected_cpus *next;        32         struct cpufreq_affected_cpus *next;
 33         struct cpufreq_affected_cpus *first;       33         struct cpufreq_affected_cpus *first;
 34 };                                                 34 };
 35                                                    35 
 36 struct cpufreq_stats {                             36 struct cpufreq_stats {
 37         unsigned long frequency;                   37         unsigned long frequency;
 38         unsigned long long time_in_state;          38         unsigned long long time_in_state;
 39         struct cpufreq_stats *next;                39         struct cpufreq_stats *next;
 40         struct cpufreq_stats *first;               40         struct cpufreq_stats *first;
 41 };                                                 41 };
 42                                                    42 
 43                                                    43 
 44                                                    44 
 45 #ifdef __cplusplus                                 45 #ifdef __cplusplus
 46 extern "C" {                                       46 extern "C" {
 47 #endif                                             47 #endif
 48                                                    48 
 49 /* determine current CPU frequency                 49 /* determine current CPU frequency
 50  * - _kernel variant means kernel's opinion of     50  * - _kernel variant means kernel's opinion of CPU frequency
 51  * - _hardware variant means actual hardware C     51  * - _hardware variant means actual hardware CPU frequency,
 52  *    which is only available to root.             52  *    which is only available to root.
 53  *                                                 53  *
 54  * returns 0 on failure, else frequency in kHz     54  * returns 0 on failure, else frequency in kHz.
 55  */                                                55  */
 56                                                    56 
 57 unsigned long cpufreq_get_freq_kernel(unsigned     57 unsigned long cpufreq_get_freq_kernel(unsigned int cpu);
 58                                                    58 
 59 unsigned long cpufreq_get_freq_hardware(unsign     59 unsigned long cpufreq_get_freq_hardware(unsigned int cpu);
 60                                                    60 
 61 #define cpufreq_get(cpu) cpufreq_get_freq_kern     61 #define cpufreq_get(cpu) cpufreq_get_freq_kernel(cpu);
 62                                                    62 
 63                                                    63 
 64 /* determine CPU transition latency                64 /* determine CPU transition latency
 65  *                                                 65  *
 66  * returns 0 on failure, else transition laten     66  * returns 0 on failure, else transition latency in 10^(-9) s = nanoseconds
 67  */                                                67  */
 68 unsigned long cpufreq_get_transition_latency(u     68 unsigned long cpufreq_get_transition_latency(unsigned int cpu);
 69                                                    69 
 70                                                    70 
 71 /* determine hardware CPU frequency limits         71 /* determine hardware CPU frequency limits
 72  *                                                 72  *
 73  * These may be limited further by thermal, en     73  * These may be limited further by thermal, energy or other
 74  * considerations by cpufreq policy notifiers      74  * considerations by cpufreq policy notifiers in the kernel.
 75  */                                                75  */
 76                                                    76 
 77 int cpufreq_get_hardware_limits(unsigned int c     77 int cpufreq_get_hardware_limits(unsigned int cpu,
 78                                 unsigned long      78                                 unsigned long *min,
 79                                 unsigned long      79                                 unsigned long *max);
 80                                                    80 
 81                                                    81 
 82 /* determine CPUfreq driver used                   82 /* determine CPUfreq driver used
 83  *                                                 83  *
 84  * Remember to call cpufreq_put_driver when no     84  * Remember to call cpufreq_put_driver when no longer needed
 85  * to avoid memory leakage, please.                85  * to avoid memory leakage, please.
 86  */                                                86  */
 87                                                    87 
 88 char *cpufreq_get_driver(unsigned int cpu);        88 char *cpufreq_get_driver(unsigned int cpu);
 89                                                    89 
 90 void cpufreq_put_driver(char *ptr);                90 void cpufreq_put_driver(char *ptr);
 91                                                    91 
 92                                                    92 
 93 /* determine CPUfreq policy currently used         93 /* determine CPUfreq policy currently used
 94  *                                                 94  *
 95  * Remember to call cpufreq_put_policy when no     95  * Remember to call cpufreq_put_policy when no longer needed
 96  * to avoid memory leakage, please.                96  * to avoid memory leakage, please.
 97  */                                                97  */
 98                                                    98 
 99                                                    99 
100 struct cpufreq_policy *cpufreq_get_policy(unsi    100 struct cpufreq_policy *cpufreq_get_policy(unsigned int cpu);
101                                                   101 
102 void cpufreq_put_policy(struct cpufreq_policy     102 void cpufreq_put_policy(struct cpufreq_policy *policy);
103                                                   103 
104                                                   104 
105 /* determine CPUfreq governors currently avail    105 /* determine CPUfreq governors currently available
106  *                                                106  *
107  * may be modified by modprobe'ing or rmmod'in    107  * may be modified by modprobe'ing or rmmod'ing other governors. Please
108  * free allocated memory by calling cpufreq_pu    108  * free allocated memory by calling cpufreq_put_available_governors
109  * after use.                                     109  * after use.
110  */                                               110  */
111                                                   111 
112                                                   112 
113 struct cpufreq_available_governors                113 struct cpufreq_available_governors
114 *cpufreq_get_available_governors(unsigned int     114 *cpufreq_get_available_governors(unsigned int cpu);
115                                                   115 
116 void cpufreq_put_available_governors(             116 void cpufreq_put_available_governors(
117         struct cpufreq_available_governors *fi    117         struct cpufreq_available_governors *first);
118                                                   118 
119                                                   119 
120 /* determine CPU frequency states available       120 /* determine CPU frequency states available
121  *                                                121  *
122  * Only present on _some_ ->target() cpufreq d    122  * Only present on _some_ ->target() cpufreq drivers. For information purposes
123  * only. Please free allocated memory by calli    123  * only. Please free allocated memory by calling
124  * cpufreq_put_frequencies after use.             124  * cpufreq_put_frequencies after use.
125  */                                               125  */
126                                                   126 
127 struct cpufreq_available_frequencies              127 struct cpufreq_available_frequencies
128 *cpufreq_get_available_frequencies(unsigned in    128 *cpufreq_get_available_frequencies(unsigned int cpu);
129                                                   129 
130 void cpufreq_put_available_frequencies(           130 void cpufreq_put_available_frequencies(
131                 struct cpufreq_available_frequ    131                 struct cpufreq_available_frequencies *first);
132                                                   132 
133 struct cpufreq_available_frequencies              133 struct cpufreq_available_frequencies
134 *cpufreq_get_boost_frequencies(unsigned int cp    134 *cpufreq_get_boost_frequencies(unsigned int cpu);
135                                                   135 
136 void cpufreq_put_boost_frequencies(               136 void cpufreq_put_boost_frequencies(
137                 struct cpufreq_available_frequ    137                 struct cpufreq_available_frequencies *first);
138                                                   138 
139                                                   139 
140 /* determine affected CPUs                        140 /* determine affected CPUs
141  *                                                141  *
142  * Remember to call cpufreq_put_affected_cpus     142  * Remember to call cpufreq_put_affected_cpus when no longer needed
143  * to avoid memory leakage, please.               143  * to avoid memory leakage, please.
144  */                                               144  */
145                                                   145 
146 struct cpufreq_affected_cpus *cpufreq_get_affe    146 struct cpufreq_affected_cpus *cpufreq_get_affected_cpus(unsigned
147                                                   147                                                         int cpu);
148                                                   148 
149 void cpufreq_put_affected_cpus(struct cpufreq_    149 void cpufreq_put_affected_cpus(struct cpufreq_affected_cpus *first);
150                                                   150 
151                                                   151 
152 /* determine related CPUs                         152 /* determine related CPUs
153  *                                                153  *
154  * Remember to call cpufreq_put_related_cpus w    154  * Remember to call cpufreq_put_related_cpus when no longer needed
155  * to avoid memory leakage, please.               155  * to avoid memory leakage, please.
156  */                                               156  */
157                                                   157 
158 struct cpufreq_affected_cpus *cpufreq_get_rela    158 struct cpufreq_affected_cpus *cpufreq_get_related_cpus(unsigned
159                                                   159                                                         int cpu);
160                                                   160 
161 void cpufreq_put_related_cpus(struct cpufreq_a    161 void cpufreq_put_related_cpus(struct cpufreq_affected_cpus *first);
162                                                   162 
163                                                   163 
164 /* determine stats for cpufreq subsystem          164 /* determine stats for cpufreq subsystem
165  *                                                165  *
166  * This is not available in all kernel version    166  * This is not available in all kernel versions or configurations.
167  */                                               167  */
168                                                   168 
169 struct cpufreq_stats *cpufreq_get_stats(unsign    169 struct cpufreq_stats *cpufreq_get_stats(unsigned int cpu,
170                                         unsign    170                                         unsigned long long *total_time);
171                                                   171 
172 void cpufreq_put_stats(struct cpufreq_stats *s    172 void cpufreq_put_stats(struct cpufreq_stats *stats);
173                                                   173 
174 unsigned long cpufreq_get_transitions(unsigned    174 unsigned long cpufreq_get_transitions(unsigned int cpu);
175                                                   175 
176                                                   176 
177 /* set new cpufreq policy                         177 /* set new cpufreq policy
178  *                                                178  *
179  * Tries to set the passed policy as new polic    179  * Tries to set the passed policy as new policy as close as possible,
180  * but results may differ depending e.g. on go    180  * but results may differ depending e.g. on governors being available.
181  */                                               181  */
182                                                   182 
183 int cpufreq_set_policy(unsigned int cpu, struc    183 int cpufreq_set_policy(unsigned int cpu, struct cpufreq_policy *policy);
184                                                   184 
185                                                   185 
186 /* modify a policy by only changing min/max fr    186 /* modify a policy by only changing min/max freq or governor
187  *                                                187  *
188  * Does not check whether result is what was i    188  * Does not check whether result is what was intended.
189  */                                               189  */
190                                                   190 
191 int cpufreq_modify_policy_min(unsigned int cpu    191 int cpufreq_modify_policy_min(unsigned int cpu, unsigned long min_freq);
192 int cpufreq_modify_policy_max(unsigned int cpu    192 int cpufreq_modify_policy_max(unsigned int cpu, unsigned long max_freq);
193 int cpufreq_modify_policy_governor(unsigned in    193 int cpufreq_modify_policy_governor(unsigned int cpu, char *governor);
194                                                   194 
195                                                   195 
196 /* set a specific frequency                       196 /* set a specific frequency
197  *                                                197  *
198  * Does only work if userspace governor can be    198  * Does only work if userspace governor can be used and no external
199  * interference (other calls to this function     199  * interference (other calls to this function or to set/modify_policy)
200  * occurs. Also does not work on ->range() cpu    200  * occurs. Also does not work on ->range() cpufreq drivers.
201  */                                               201  */
202                                                   202 
203 int cpufreq_set_frequency(unsigned int cpu,       203 int cpufreq_set_frequency(unsigned int cpu,
204                                 unsigned long     204                                 unsigned long target_frequency);
205                                                   205 
206 /*                                                206 /*
207  * get the sysfs value from specific table        207  * get the sysfs value from specific table
208  *                                                208  *
209  * Read the value with the sysfs file name fro    209  * Read the value with the sysfs file name from specific table. Does
210  * only work if the cpufreq driver has the spe    210  * only work if the cpufreq driver has the specific sysfs interfaces.
211  */                                               211  */
212                                                   212 
213 unsigned long cpufreq_get_sysfs_value_from_tab    213 unsigned long cpufreq_get_sysfs_value_from_table(unsigned int cpu,
214                                                   214                                                  const char **table,
215                                                   215                                                  unsigned int index,
216                                                   216                                                  unsigned int size);
217                                                   217 
218 #ifdef __cplusplus                                218 #ifdef __cplusplus
219 }                                                 219 }
220 #endif                                            220 #endif
221                                                   221 
222 #endif /* _CPUFREQ_H */                           222 #endif /* _CPUFREQ_H */
223                                                   223 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php