Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cdd5967f authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

arm: 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.

CRs-Fixed: 1003878
Change-Id: If2885675ce3d7b43c3b2568fe1e29a76f48a5c3d
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent c32889f5
Loading
Loading
Loading
Loading
+20 −7
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ static int __init parse_dt_topology(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);
@@ -281,14 +282,26 @@ static int __init parse_dt_topology(void)
			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;

			if (cpu_eff->compatible == NULL)
				continue;

		per_cpu(cpu_efficiency, cpu) = cpu_eff->efficiency;
			efficiency = cpu_eff->efficiency;
		}

		per_cpu(cpu_efficiency, cpu) = efficiency;

		rate = of_get_property(cn, "clock-frequency", &len);
		if (!rate || len != 4) {
@@ -297,7 +310,7 @@ static int __init parse_dt_topology(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)