freq_table.c (51c4c4ce1df49b14bbfc334c6388cc9efe32c631) | freq_table.c (6f19efc0a1ca08bc61841b971d8b85ab505d95c8) |
---|---|
1/* 2 * linux/drivers/cpufreq/freq_table.c 3 * 4 * Copyright (C) 2002 - 2003 Dominik Brodowski 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. --- 18 unchanged lines hidden (view full) --- 27 28 for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { 29 unsigned int freq = table[i].frequency; 30 if (freq == CPUFREQ_ENTRY_INVALID) { 31 pr_debug("table entry %u is invalid, skipping\n", i); 32 33 continue; 34 } | 1/* 2 * linux/drivers/cpufreq/freq_table.c 3 * 4 * Copyright (C) 2002 - 2003 Dominik Brodowski 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. --- 18 unchanged lines hidden (view full) --- 27 28 for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { 29 unsigned int freq = table[i].frequency; 30 if (freq == CPUFREQ_ENTRY_INVALID) { 31 pr_debug("table entry %u is invalid, skipping\n", i); 32 33 continue; 34 } |
35 if (!cpufreq_boost_enabled() 36 && table[i].driver_data == CPUFREQ_BOOST_FREQ) 37 continue; 38 |
|
35 pr_debug("table entry %u: %u kHz, %u driver_data\n", 36 i, freq, table[i].driver_data); 37 if (freq < min_freq) 38 min_freq = freq; 39 if (freq > max_freq) 40 max_freq = freq; 41 } 42 --- 156 unchanged lines hidden (view full) --- 199} 200EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index); 201 202static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table); 203 204/** 205 * show_available_freqs - show available frequencies for the specified CPU 206 */ | 39 pr_debug("table entry %u: %u kHz, %u driver_data\n", 40 i, freq, table[i].driver_data); 41 if (freq < min_freq) 42 min_freq = freq; 43 if (freq > max_freq) 44 max_freq = freq; 45 } 46 --- 156 unchanged lines hidden (view full) --- 203} 204EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index); 205 206static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table); 207 208/** 209 * show_available_freqs - show available frequencies for the specified CPU 210 */ |
207static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf) | 211static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf, 212 bool show_boost) |
208{ 209 unsigned int i = 0; 210 unsigned int cpu = policy->cpu; 211 ssize_t count = 0; 212 struct cpufreq_frequency_table *table; 213 214 if (!per_cpu(cpufreq_show_table, cpu)) 215 return -ENODEV; 216 217 table = per_cpu(cpufreq_show_table, cpu); 218 219 for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { 220 if (table[i].frequency == CPUFREQ_ENTRY_INVALID) 221 continue; | 213{ 214 unsigned int i = 0; 215 unsigned int cpu = policy->cpu; 216 ssize_t count = 0; 217 struct cpufreq_frequency_table *table; 218 219 if (!per_cpu(cpufreq_show_table, cpu)) 220 return -ENODEV; 221 222 table = per_cpu(cpufreq_show_table, cpu); 223 224 for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { 225 if (table[i].frequency == CPUFREQ_ENTRY_INVALID) 226 continue; |
227 /* 228 * show_boost = true and driver_data = BOOST freq 229 * display BOOST freqs 230 * 231 * show_boost = false and driver_data = BOOST freq 232 * show_boost = true and driver_data != BOOST freq 233 * continue - do not display anything 234 * 235 * show_boost = false and driver_data != BOOST freq 236 * display NON BOOST freqs 237 */ 238 if (show_boost ^ (table[i].driver_data == CPUFREQ_BOOST_FREQ)) 239 continue; 240 |
|
222 count += sprintf(&buf[count], "%d ", table[i].frequency); 223 } 224 count += sprintf(&buf[count], "\n"); 225 226 return count; 227 228} 229 | 241 count += sprintf(&buf[count], "%d ", table[i].frequency); 242 } 243 count += sprintf(&buf[count], "\n"); 244 245 return count; 246 247} 248 |
230struct freq_attr cpufreq_freq_attr_scaling_available_freqs = { 231 .attr = { .name = "scaling_available_frequencies", 232 .mode = 0444, 233 }, 234 .show = show_available_freqs, 235}; | 249#define cpufreq_attr_available_freq(_name) \ 250struct freq_attr cpufreq_freq_attr_##_name##_freqs = \ 251__ATTR_RO(_name##_frequencies) 252 253/** 254 * show_scaling_available_frequencies - show available normal frequencies for 255 * the specified CPU 256 */ 257static ssize_t scaling_available_frequencies_show(struct cpufreq_policy *policy, 258 char *buf) 259{ 260 return show_available_freqs(policy, buf, false); 261} 262cpufreq_attr_available_freq(scaling_available); |
236EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs); 237 | 263EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs); 264 |
265/** 266 * show_available_boost_freqs - show available boost frequencies for 267 * the specified CPU 268 */ 269static ssize_t scaling_boost_frequencies_show(struct cpufreq_policy *policy, 270 char *buf) 271{ 272 return show_available_freqs(policy, buf, true); 273} 274cpufreq_attr_available_freq(scaling_boost); 275EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_boost_freqs); 276 |
|
238struct freq_attr *cpufreq_generic_attr[] = { 239 &cpufreq_freq_attr_scaling_available_freqs, | 277struct freq_attr *cpufreq_generic_attr[] = { 278 &cpufreq_freq_attr_scaling_available_freqs, |
279#ifdef CONFIG_CPU_FREQ_BOOST_SW 280 &cpufreq_freq_attr_scaling_boost_freqs, 281#endif |
|
240 NULL, 241}; 242EXPORT_SYMBOL_GPL(cpufreq_generic_attr); 243 244/* 245 * if you use these, you must assure that the frequency table is valid 246 * all the time between get_attr and put_attr! 247 */ --- 45 unchanged lines hidden --- | 282 NULL, 283}; 284EXPORT_SYMBOL_GPL(cpufreq_generic_attr); 285 286/* 287 * if you use these, you must assure that the frequency table is valid 288 * all the time between get_attr and put_attr! 289 */ --- 45 unchanged lines hidden --- |