From 0c129441c2f3dec0a6e4c68dccf992535f0e9eca Mon Sep 17 00:00:00 2001 From: Bai Ping Date: Fri, 24 Oct 2014 16:13:51 +0800 Subject: [PATCH] MLK-9739 cpufreq: imx: add request busfreq support for cpufreq Request high bus frequency before scaling up the CPU frequency and release high bus frequency after scaling down the CPU frequency Doing so makes a balance between high performance and lower power consumption. Signed-off-by: Bai Ping (cherry picked from commit 35c91da2591a70858d5eec184c662851e39082d2) --- drivers/cpufreq/imx6q-cpufreq.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index e63fa3293dbd..4059228677ae 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -6,6 +6,7 @@ * published by the Free Software Foundation. */ +#include #include #include #include @@ -71,6 +72,12 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) dev_dbg(cpu_dev, "%u MHz, %ld mV --> %u MHz, %ld mV\n", old_freq / 1000, volt_old / 1000, new_freq / 1000, volt / 1000); + /* + * CPU freq is increasing, so need to ensure + * that bus frequency is increased too. + */ + if (old_freq == freq_table[0].frequency) + request_bus_freq(BUS_FREQ_HIGH); /* scaling up? scale voltage before frequency */ if (new_freq > old_freq) { @@ -159,6 +166,12 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) } } } + /* + * If CPU is dropped to the lowest level, release the need + * for a high bus frequency. + */ + if (new_freq == freq_table[0].frequency) + release_bus_freq(BUS_FREQ_HIGH); return 0; } -- 2.17.1