Merge "arm: topology: Allow specifying the CPU efficiency from device tree"
This commit is contained in:
commit
f88da36dc8
1 changed files with 28 additions and 6 deletions
|
@ -190,6 +190,13 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DEFINE_PER_CPU(unsigned long, cpu_efficiency) = SCHED_CAPACITY_SCALE;
|
||||||
|
|
||||||
|
unsigned long arch_get_cpu_efficiency(int cpu)
|
||||||
|
{
|
||||||
|
return per_cpu(cpu_efficiency, cpu);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_OF
|
#ifdef CONFIG_OF
|
||||||
struct cpu_efficiency {
|
struct cpu_efficiency {
|
||||||
const char *compatible;
|
const char *compatible;
|
||||||
|
@ -266,6 +273,7 @@ static int __init parse_dt_topology(void)
|
||||||
for_each_possible_cpu(cpu) {
|
for_each_possible_cpu(cpu) {
|
||||||
const u32 *rate;
|
const u32 *rate;
|
||||||
int len;
|
int len;
|
||||||
|
u32 efficiency;
|
||||||
|
|
||||||
/* too early to use cpu->of_node */
|
/* too early to use cpu->of_node */
|
||||||
cn = of_get_cpu_node(cpu, NULL);
|
cn = of_get_cpu_node(cpu, NULL);
|
||||||
|
@ -274,13 +282,27 @@ static int __init parse_dt_topology(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cpu_eff = table_efficiency; cpu_eff->compatible; cpu_eff++)
|
/*
|
||||||
if (of_device_is_compatible(cn, cpu_eff->compatible))
|
* The CPU efficiency value passed from the device tree
|
||||||
|
* overrides the value defined in the table_efficiency[]
|
||||||
|
*/
|
||||||
|
if (of_property_read_u32(cn, "efficiency", &efficiency) < 0) {
|
||||||
|
|
||||||
|
for (cpu_eff = table_efficiency;
|
||||||
|
cpu_eff->compatible; cpu_eff++)
|
||||||
|
|
||||||
|
if (of_device_is_compatible(cn,
|
||||||
|
cpu_eff->compatible))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (cpu_eff->compatible == NULL)
|
if (cpu_eff->compatible == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
efficiency = cpu_eff->efficiency;
|
||||||
|
}
|
||||||
|
|
||||||
|
per_cpu(cpu_efficiency, cpu) = efficiency;
|
||||||
|
|
||||||
rate = of_get_property(cn, "clock-frequency", &len);
|
rate = of_get_property(cn, "clock-frequency", &len);
|
||||||
if (!rate || len != 4) {
|
if (!rate || len != 4) {
|
||||||
pr_err("%s missing clock-frequency property\n",
|
pr_err("%s missing clock-frequency property\n",
|
||||||
|
@ -288,7 +310,7 @@ static int __init parse_dt_topology(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
capacity = ((be32_to_cpup(rate)) >> 20) * cpu_eff->efficiency;
|
capacity = ((be32_to_cpup(rate)) >> 20) * efficiency;
|
||||||
|
|
||||||
/* Save min capacity of the system */
|
/* Save min capacity of the system */
|
||||||
if (capacity < min_capacity)
|
if (capacity < min_capacity)
|
||||||
|
|
Loading…
Add table
Reference in a new issue