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

Commit 1dc40b06 authored by Maria Yu's avatar Maria Yu
Browse files

arm: topology: Export update_cpu_power_capacity API



Export update_cpu_power_capacity API since it can be called
by the modules. Update topology header file too.

Change-Id: I262348c9c94559dbf84d58f69c85817ce451d17b
Signed-off-by: default avatarMaria Yu <aiquny@codeaurora.org>
parent e7325167
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -32,6 +32,9 @@ unsigned long arch_get_cpu_efficiency(int cpu);
#define arch_scale_cpu_capacity scale_cpu_capacity
extern unsigned long scale_cpu_capacity(struct sched_domain *sd, int cpu);

#define arch_update_cpu_capacity update_cpu_power_capacity
extern void update_cpu_power_capacity(int cpu);

#else

static inline void init_cpu_topology(void) { }
+27 −0
Original line number Diff line number Diff line
@@ -42,6 +42,16 @@
 */
static DEFINE_PER_CPU(unsigned long, cpu_scale) = SCHED_CAPACITY_SCALE;

unsigned long arch_scale_freq_power(struct sched_domain *sd, int cpu)
{
	return per_cpu(cpu_scale, cpu);
}

static void set_power_scale(unsigned int cpu, unsigned long power)
{
	per_cpu(cpu_scale, cpu) = power;
}

unsigned long scale_cpu_capacity(struct sched_domain *sd, int cpu)
{
#ifdef CONFIG_CPU_FREQ
@@ -397,6 +407,23 @@ const struct cpumask *cpu_corepower_mask(int cpu)
	return &cpu_topology[cpu].thread_sibling;
}

static void update_cpu_power(unsigned int cpu)
{
	if (!cpu_capacity(cpu))
		return;

	set_power_scale(cpu, cpu_capacity(cpu) / middle_capacity);

	pr_info("CPU%u: update cpu_power %lu\n",
		cpu, arch_scale_freq_power(NULL, cpu));
}

void update_cpu_power_capacity(int cpu)
{
	update_cpu_power(cpu);
	update_cpu_capacity(cpu);
}

static void update_siblings_masks(unsigned int cpuid)
{
	struct cputopo_arm *cpu_topo, *cpuid_topo = &cpu_topology[cpuid];