diff options
| author | Pavankumar Kondeti <pkondeti@codeaurora.org> | 2015-05-07 17:14:48 +0530 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:25:59 -0700 |
| commit | 6c98c21f9e7253ba25b831bd13852e295b341cfa (patch) | |
| tree | e7a2d445c52e86f542a5392f7673f7ce5d71bbf1 /arch | |
| parent | 5796af4921425206827a6005412f43622cbfc0db (diff) | |
arm64: topology: Allow specifying the CPU efficiency from device tree
The efficiency of a CPU can vary across SoCs depending on the cache size,
bus interconnect frequencies etc. Allow specifying this from the device
tree. This value overrides the default values hardcoded in the efficiency
table.
Change-Id: Ie9ba69e11317e6eb6462630226355747d1def646
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/arm64/kernel/topology.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index e562e0f43a42..67fc833a26af 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -278,6 +278,7 @@ static void __init parse_dt_cpu_power(void) for_each_possible_cpu(cpu) { const u32 *rate; int len; + u32 efficiency; /* Too early to use cpu->of_node */ cn = of_get_cpu_node(cpu, NULL); @@ -286,16 +287,29 @@ static void __init parse_dt_cpu_power(void) continue; } - for (cpu_eff = table_efficiency; cpu_eff->compatible; cpu_eff++) - if (of_device_is_compatible(cn, cpu_eff->compatible)) - break; + /* + * 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) { - if (cpu_eff->compatible == NULL) { - pr_warn("%s: Unknown CPU type\n", cn->full_name); - continue; + for (cpu_eff = table_efficiency; + cpu_eff->compatible; cpu_eff++) + + if (of_device_is_compatible(cn, + cpu_eff->compatible)) + break; + + if (cpu_eff->compatible == NULL) { + pr_warn("%s: Unknown CPU type\n", + cn->full_name); + continue; + } + + efficiency = cpu_eff->efficiency; } - per_cpu(cpu_efficiency, cpu) = cpu_eff->efficiency; + per_cpu(cpu_efficiency, cpu) = efficiency; rate = of_get_property(cn, "clock-frequency", &len); if (!rate || len != 4) { @@ -304,7 +318,7 @@ static void __init parse_dt_cpu_power(void) continue; } - capacity = ((be32_to_cpup(rate)) >> 20) * cpu_eff->efficiency; + capacity = ((be32_to_cpup(rate)) >> 20) * efficiency; /* Save min capacity of the system */ if (capacity < min_capacity) |
