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

Commit fc903471 authored by Vikram Mulukutla's avatar Vikram Mulukutla Committed by David Collins
Browse files

clk: qcom: clock-cpu-8994: Rework the cpu clock round rate function



In order to return only the frequencies supported in the voltage
plan (since CPR parameters are optimized for those frequencies),
use the fmax table in the CPU clock structure to return supported
frequencies from the round_rate op. This also provide a slight
speed benefit while selecting frequencies before a set_rate.

Sneak in a formatting fix (a newline) that makes kernel log
look less ugly.

Change-Id: I2da2efc1a28bc1159faaa0434895c7efb30ffc60
Signed-off-by: default avatarVikram Mulukutla <markivx@codeaurora.org>
parent c5f1b031
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -739,7 +739,18 @@ static enum handoff cpu_clk_8994_handoff(struct clk *c)

static long cpu_clk_8994_round_rate(struct clk *c, unsigned long rate)
{
	return clk_round_rate(c->parent, rate);
	unsigned long fmax = c->fmax[c->num_fmax - 1];
	unsigned long fmin = c->fmax[1];
	int i = 1;

	if (rate <= fmin)
		return fmin;
	if (rate >= fmax)
		return fmax;
	while ((c->fmax[i++] < rate) && (i < c->num_fmax))
		;

	return c->fmax[i-1];
}

static void do_nothing(void *unused) { }
@@ -1397,7 +1408,7 @@ static void populate_opp_table(struct platform_device *pdev)
	}

	/* One time print during bootup */
	pr_info("clock-cpu-8994: OPP tables populated (cpu %d and %d)",
	pr_info("clock-cpu-8994: OPP tables populated (cpu %d and %d)\n",
		a53_cpu, a57_cpu);

	print_opp_table(a53_cpu, a57_cpu);