/* get platform freq by searching bus-frequency property */
soc = of_find_node_by_type(NULL, "soc"); if (soc) {
ret = of_property_read_u32(soc, "bus-frequency", &sysfreq);
of_node_put(soc); if (!ret) return sysfreq;
}
/* get platform freq by its clock name */
pltclk = clk_get(NULL, "cg-pll0-div1"); if (IS_ERR(pltclk)) {
pr_err("%s: can't get bus frequency %ld\n",
__func__, PTR_ERR(pltclk)); return PTR_ERR(pltclk);
}
/* traverse cpu nodes to get cpu mask of sharing clock wire */ staticvoid set_affected_cpus(struct cpufreq_policy *policy)
{ struct cpumask *dstp = policy->cpus; struct clk *clk; int i;
for_each_present_cpu(i) {
clk = cpu_to_clk(i); if (IS_ERR(clk)) {
pr_err("%s: no clock for cpu %d\n", __func__, i); continue;
}
if (clk_is_match(policy->clk, clk))
cpumask_set_cpu(i, dstp);
}
}
/* reduce the duplicated frequencies in frequency table */ staticvoid freq_table_redup(struct cpufreq_frequency_table *freq_table, int count)
{ int i, j;
for (i = 1; i < count; i++) { for (j = 0; j < i; j++) { if (freq_table[j].frequency == CPUFREQ_ENTRY_INVALID ||
freq_table[j].frequency !=
freq_table[i].frequency) continue;
/* sort the frequencies in frequency table in descenting order */ staticvoid freq_table_sort(struct cpufreq_frequency_table *freq_table, int count)
{ int i, j, ind; unsignedint freq, max_freq; struct cpufreq_frequency_table table;
for (i = 0; i < count - 1; i++) {
max_freq = freq_table[i].frequency;
ind = i; for (j = i + 1; j < count; j++) {
freq = freq_table[j].frequency; if (freq == CPUFREQ_ENTRY_INVALID ||
freq <= max_freq) continue;
ind = j;
max_freq = freq;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.