Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/drivers/cpufreq/freq_table.c |
| 3 | * |
| 4 | * Copyright (C) 2002 - 2003 Dominik Brodowski |
Dominik Brodowski | 4f74369 | 2008-05-22 08:52:05 +0200 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Viresh Kumar | db70115 | 2012-10-23 01:29:03 +0200 | [diff] [blame] | 12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/cpufreq.h> |
Viresh Kumar | 5ff0a26 | 2013-08-06 22:53:03 +0530 | [diff] [blame] | 15 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | /********************************************************************* |
| 18 | * FREQUENCY TABLE HELPERS * |
| 19 | *********************************************************************/ |
| 20 | |
| 21 | int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, |
| 22 | struct cpufreq_frequency_table *table) |
| 23 | { |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 24 | struct cpufreq_frequency_table *pos; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | unsigned int min_freq = ~0; |
| 26 | unsigned int max_freq = 0; |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 27 | unsigned int freq; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 29 | cpufreq_for_each_valid_entry(pos, table) { |
| 30 | freq = pos->frequency; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
Lukasz Majewski | 6f19efc | 2013-12-20 15:24:49 +0100 | [diff] [blame] | 32 | if (!cpufreq_boost_enabled() |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 33 | && (pos->flags & CPUFREQ_BOOST_FREQ)) |
Lukasz Majewski | 6f19efc | 2013-12-20 15:24:49 +0100 | [diff] [blame] | 34 | continue; |
| 35 | |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 36 | pr_debug("table entry %u: %u kHz\n", (int)(pos - table), freq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | if (freq < min_freq) |
| 38 | min_freq = freq; |
| 39 | if (freq > max_freq) |
| 40 | max_freq = freq; |
| 41 | } |
| 42 | |
| 43 | policy->min = policy->cpuinfo.min_freq = min_freq; |
| 44 | policy->max = policy->cpuinfo.max_freq = max_freq; |
| 45 | |
| 46 | if (policy->min == ~0) |
| 47 | return -EINVAL; |
| 48 | else |
| 49 | return 0; |
| 50 | } |
| 51 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_cpuinfo); |
| 52 | |
| 53 | |
| 54 | int cpufreq_frequency_table_verify(struct cpufreq_policy *policy, |
| 55 | struct cpufreq_frequency_table *table) |
| 56 | { |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 57 | struct cpufreq_frequency_table *pos; |
| 58 | unsigned int freq, next_larger = ~0; |
Viresh Kumar | 77db50c | 2013-10-02 14:13:15 +0530 | [diff] [blame] | 59 | bool found = false; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 61 | pr_debug("request for verification of policy (%u - %u kHz) for cpu %u\n", |
Gautham R Shenoy | e08f5f5 | 2006-10-26 16:20:58 +0530 | [diff] [blame] | 62 | policy->min, policy->max, policy->cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | |
Viresh Kumar | be49e34 | 2013-10-02 14:13:19 +0530 | [diff] [blame] | 64 | cpufreq_verify_within_cpu_limits(policy); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 66 | cpufreq_for_each_valid_entry(pos, table) { |
| 67 | freq = pos->frequency; |
| 68 | |
Viresh Kumar | 77db50c | 2013-10-02 14:13:15 +0530 | [diff] [blame] | 69 | if ((freq >= policy->min) && (freq <= policy->max)) { |
| 70 | found = true; |
| 71 | break; |
| 72 | } |
| 73 | |
| 74 | if ((next_larger > freq) && (freq > policy->max)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | next_larger = freq; |
| 76 | } |
| 77 | |
Viresh Kumar | 77db50c | 2013-10-02 14:13:15 +0530 | [diff] [blame] | 78 | if (!found) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | policy->max = next_larger; |
Viresh Kumar | be49e34 | 2013-10-02 14:13:19 +0530 | [diff] [blame] | 80 | cpufreq_verify_within_cpu_limits(policy); |
Viresh Kumar | 77db50c | 2013-10-02 14:13:15 +0530 | [diff] [blame] | 81 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 83 | pr_debug("verification lead to (%u - %u kHz) for cpu %u\n", |
Gautham R Shenoy | e08f5f5 | 2006-10-26 16:20:58 +0530 | [diff] [blame] | 84 | policy->min, policy->max, policy->cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | |
| 86 | return 0; |
| 87 | } |
| 88 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_verify); |
| 89 | |
Viresh Kumar | 1843451 | 2013-10-03 20:27:55 +0530 | [diff] [blame] | 90 | /* |
Viresh Kumar | e0b3165 | 2014-03-10 14:53:33 +0530 | [diff] [blame] | 91 | * Generic routine to verify policy & frequency table, requires driver to set |
| 92 | * policy->freq_table prior to it. |
Viresh Kumar | 1843451 | 2013-10-03 20:27:55 +0530 | [diff] [blame] | 93 | */ |
| 94 | int cpufreq_generic_frequency_table_verify(struct cpufreq_policy *policy) |
| 95 | { |
| 96 | struct cpufreq_frequency_table *table = |
| 97 | cpufreq_frequency_get_table(policy->cpu); |
| 98 | if (!table) |
| 99 | return -ENODEV; |
| 100 | |
| 101 | return cpufreq_frequency_table_verify(policy, table); |
| 102 | } |
| 103 | EXPORT_SYMBOL_GPL(cpufreq_generic_frequency_table_verify); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | |
| 105 | int cpufreq_frequency_table_target(struct cpufreq_policy *policy, |
| 106 | struct cpufreq_frequency_table *table, |
| 107 | unsigned int target_freq, |
| 108 | unsigned int relation, |
| 109 | unsigned int *index) |
| 110 | { |
Dave Jones | 484944a | 2006-05-30 18:09:31 -0400 | [diff] [blame] | 111 | struct cpufreq_frequency_table optimal = { |
Viresh Kumar | 5070158 | 2013-03-30 16:25:15 +0530 | [diff] [blame] | 112 | .driver_data = ~0, |
Dave Jones | 484944a | 2006-05-30 18:09:31 -0400 | [diff] [blame] | 113 | .frequency = 0, |
| 114 | }; |
| 115 | struct cpufreq_frequency_table suboptimal = { |
Viresh Kumar | 5070158 | 2013-03-30 16:25:15 +0530 | [diff] [blame] | 116 | .driver_data = ~0, |
Dave Jones | 484944a | 2006-05-30 18:09:31 -0400 | [diff] [blame] | 117 | .frequency = 0, |
| 118 | }; |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 119 | struct cpufreq_frequency_table *pos; |
Stratos Karafotis | 5b0c0b1 | 2014-06-30 19:59:33 +0300 | [diff] [blame] | 120 | unsigned int freq, diff, i = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | |
Dominik Brodowski | 2d06d8c | 2011-03-27 15:04:46 +0200 | [diff] [blame] | 122 | pr_debug("request for target %u kHz (relation: %u) for cpu %u\n", |
Gautham R Shenoy | e08f5f5 | 2006-10-26 16:20:58 +0530 | [diff] [blame] | 123 | target_freq, relation, policy->cpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | |
| 125 | switch (relation) { |
| 126 | case CPUFREQ_RELATION_H: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | suboptimal.frequency = ~0; |
| 128 | break; |
| 129 | case CPUFREQ_RELATION_L: |
Stratos Karafotis | 5b0c0b1 | 2014-06-30 19:59:33 +0300 | [diff] [blame] | 130 | case CPUFREQ_RELATION_C: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | optimal.frequency = ~0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | break; |
| 133 | } |
| 134 | |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 135 | cpufreq_for_each_valid_entry(pos, table) { |
| 136 | freq = pos->frequency; |
| 137 | |
| 138 | i = pos - table; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | if ((freq < policy->min) || (freq > policy->max)) |
| 140 | continue; |
Stratos Karafotis | 1e49885 | 2014-05-14 21:05:52 +0300 | [diff] [blame] | 141 | if (freq == target_freq) { |
| 142 | optimal.driver_data = i; |
| 143 | break; |
| 144 | } |
Dave Jones | 97acec5 | 2009-01-18 01:56:41 -0500 | [diff] [blame] | 145 | switch (relation) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | case CPUFREQ_RELATION_H: |
Stratos Karafotis | 1e49885 | 2014-05-14 21:05:52 +0300 | [diff] [blame] | 147 | if (freq < target_freq) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | if (freq >= optimal.frequency) { |
| 149 | optimal.frequency = freq; |
Viresh Kumar | 5070158 | 2013-03-30 16:25:15 +0530 | [diff] [blame] | 150 | optimal.driver_data = i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | } |
| 152 | } else { |
| 153 | if (freq <= suboptimal.frequency) { |
| 154 | suboptimal.frequency = freq; |
Viresh Kumar | 5070158 | 2013-03-30 16:25:15 +0530 | [diff] [blame] | 155 | suboptimal.driver_data = i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | } |
| 157 | } |
| 158 | break; |
| 159 | case CPUFREQ_RELATION_L: |
Stratos Karafotis | 1e49885 | 2014-05-14 21:05:52 +0300 | [diff] [blame] | 160 | if (freq > target_freq) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | if (freq <= optimal.frequency) { |
| 162 | optimal.frequency = freq; |
Viresh Kumar | 5070158 | 2013-03-30 16:25:15 +0530 | [diff] [blame] | 163 | optimal.driver_data = i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | } |
| 165 | } else { |
| 166 | if (freq >= suboptimal.frequency) { |
| 167 | suboptimal.frequency = freq; |
Viresh Kumar | 5070158 | 2013-03-30 16:25:15 +0530 | [diff] [blame] | 168 | suboptimal.driver_data = i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | } |
| 170 | } |
| 171 | break; |
Stratos Karafotis | 5b0c0b1 | 2014-06-30 19:59:33 +0300 | [diff] [blame] | 172 | case CPUFREQ_RELATION_C: |
| 173 | diff = abs(freq - target_freq); |
| 174 | if (diff < optimal.frequency || |
| 175 | (diff == optimal.frequency && |
| 176 | freq > table[optimal.driver_data].frequency)) { |
| 177 | optimal.frequency = diff; |
| 178 | optimal.driver_data = i; |
| 179 | } |
| 180 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | } |
| 182 | } |
Viresh Kumar | 5070158 | 2013-03-30 16:25:15 +0530 | [diff] [blame] | 183 | if (optimal.driver_data > i) { |
| 184 | if (suboptimal.driver_data > i) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | return -EINVAL; |
Viresh Kumar | 5070158 | 2013-03-30 16:25:15 +0530 | [diff] [blame] | 186 | *index = suboptimal.driver_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | } else |
Viresh Kumar | 5070158 | 2013-03-30 16:25:15 +0530 | [diff] [blame] | 188 | *index = optimal.driver_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | |
Viresh Kumar | ae87f10 | 2014-03-28 19:11:45 +0530 | [diff] [blame] | 190 | pr_debug("target index is %u, freq is:%u kHz\n", *index, |
| 191 | table[*index].frequency); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | |
| 193 | return 0; |
| 194 | } |
| 195 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_target); |
| 196 | |
Viresh Kumar | d391669 | 2013-12-03 11:20:46 +0530 | [diff] [blame] | 197 | int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy, |
| 198 | unsigned int freq) |
| 199 | { |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 200 | struct cpufreq_frequency_table *pos, *table; |
Viresh Kumar | d391669 | 2013-12-03 11:20:46 +0530 | [diff] [blame] | 201 | |
| 202 | table = cpufreq_frequency_get_table(policy->cpu); |
| 203 | if (unlikely(!table)) { |
| 204 | pr_debug("%s: Unable to find frequency table\n", __func__); |
| 205 | return -ENOENT; |
| 206 | } |
| 207 | |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 208 | cpufreq_for_each_valid_entry(pos, table) |
| 209 | if (pos->frequency == freq) |
| 210 | return pos - table; |
Viresh Kumar | d391669 | 2013-12-03 11:20:46 +0530 | [diff] [blame] | 211 | |
| 212 | return -EINVAL; |
| 213 | } |
| 214 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index); |
| 215 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | /** |
Fenghua Yu | e32d22f | 2007-11-21 14:52:15 -0800 | [diff] [blame] | 217 | * show_available_freqs - show available frequencies for the specified CPU |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | */ |
Lukasz Majewski | 6f19efc | 2013-12-20 15:24:49 +0100 | [diff] [blame] | 219 | static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf, |
| 220 | bool show_boost) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | ssize_t count = 0; |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 223 | struct cpufreq_frequency_table *pos, *table = policy->freq_table; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | |
Viresh Kumar | e0b3165 | 2014-03-10 14:53:33 +0530 | [diff] [blame] | 225 | if (!table) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | return -ENODEV; |
| 227 | |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 228 | cpufreq_for_each_valid_entry(pos, table) { |
Lukasz Majewski | 6f19efc | 2013-12-20 15:24:49 +0100 | [diff] [blame] | 229 | /* |
| 230 | * show_boost = true and driver_data = BOOST freq |
| 231 | * display BOOST freqs |
| 232 | * |
| 233 | * show_boost = false and driver_data = BOOST freq |
| 234 | * show_boost = true and driver_data != BOOST freq |
| 235 | * continue - do not display anything |
| 236 | * |
| 237 | * show_boost = false and driver_data != BOOST freq |
| 238 | * display NON BOOST freqs |
| 239 | */ |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 240 | if (show_boost ^ (pos->flags & CPUFREQ_BOOST_FREQ)) |
Lukasz Majewski | 6f19efc | 2013-12-20 15:24:49 +0100 | [diff] [blame] | 241 | continue; |
| 242 | |
Stratos Karafotis | 041526f | 2014-04-25 23:15:38 +0300 | [diff] [blame] | 243 | count += sprintf(&buf[count], "%d ", pos->frequency); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | } |
| 245 | count += sprintf(&buf[count], "\n"); |
| 246 | |
| 247 | return count; |
| 248 | |
| 249 | } |
| 250 | |
Lukasz Majewski | 6f19efc | 2013-12-20 15:24:49 +0100 | [diff] [blame] | 251 | #define cpufreq_attr_available_freq(_name) \ |
| 252 | struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ |
| 253 | __ATTR_RO(_name##_frequencies) |
| 254 | |
| 255 | /** |
| 256 | * show_scaling_available_frequencies - show available normal frequencies for |
| 257 | * the specified CPU |
| 258 | */ |
| 259 | static ssize_t scaling_available_frequencies_show(struct cpufreq_policy *policy, |
| 260 | char *buf) |
| 261 | { |
| 262 | return show_available_freqs(policy, buf, false); |
| 263 | } |
| 264 | cpufreq_attr_available_freq(scaling_available); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs); |
| 266 | |
Lukasz Majewski | 6f19efc | 2013-12-20 15:24:49 +0100 | [diff] [blame] | 267 | /** |
| 268 | * show_available_boost_freqs - show available boost frequencies for |
| 269 | * the specified CPU |
| 270 | */ |
| 271 | static ssize_t scaling_boost_frequencies_show(struct cpufreq_policy *policy, |
| 272 | char *buf) |
| 273 | { |
| 274 | return show_available_freqs(policy, buf, true); |
| 275 | } |
| 276 | cpufreq_attr_available_freq(scaling_boost); |
| 277 | EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_boost_freqs); |
| 278 | |
Viresh Kumar | 1843451 | 2013-10-03 20:27:55 +0530 | [diff] [blame] | 279 | struct freq_attr *cpufreq_generic_attr[] = { |
| 280 | &cpufreq_freq_attr_scaling_available_freqs, |
Lukasz Majewski | 6f19efc | 2013-12-20 15:24:49 +0100 | [diff] [blame] | 281 | #ifdef CONFIG_CPU_FREQ_BOOST_SW |
| 282 | &cpufreq_freq_attr_scaling_boost_freqs, |
| 283 | #endif |
Viresh Kumar | 1843451 | 2013-10-03 20:27:55 +0530 | [diff] [blame] | 284 | NULL, |
| 285 | }; |
| 286 | EXPORT_SYMBOL_GPL(cpufreq_generic_attr); |
| 287 | |
Viresh Kumar | 27047a6 | 2013-09-16 18:56:03 +0530 | [diff] [blame] | 288 | int cpufreq_table_validate_and_show(struct cpufreq_policy *policy, |
| 289 | struct cpufreq_frequency_table *table) |
| 290 | { |
| 291 | int ret = cpufreq_frequency_table_cpuinfo(policy, table); |
| 292 | |
| 293 | if (!ret) |
Viresh Kumar | e0b3165 | 2014-03-10 14:53:33 +0530 | [diff] [blame] | 294 | policy->freq_table = table; |
Viresh Kumar | 27047a6 | 2013-09-16 18:56:03 +0530 | [diff] [blame] | 295 | |
| 296 | return ret; |
| 297 | } |
| 298 | EXPORT_SYMBOL_GPL(cpufreq_table_validate_and_show); |
| 299 | |
Viresh Kumar | e0b3165 | 2014-03-10 14:53:33 +0530 | [diff] [blame] | 300 | struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu); |
Viresh Kumar | b8eed8a | 2013-01-14 13:23:03 +0000 | [diff] [blame] | 301 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu) |
| 303 | { |
Viresh Kumar | e0b3165 | 2014-03-10 14:53:33 +0530 | [diff] [blame] | 304 | struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu); |
| 305 | return policy ? policy->freq_table : NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | } |
| 307 | EXPORT_SYMBOL_GPL(cpufreq_frequency_get_table); |
| 308 | |
Dave Jones | 97acec5 | 2009-01-18 01:56:41 -0500 | [diff] [blame] | 309 | MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>"); |
| 310 | MODULE_DESCRIPTION("CPUfreq frequency table helpers"); |
| 311 | MODULE_LICENSE("GPL"); |