From 054b019c789430d10ea3d33f665b6e92514825ed Mon Sep 17 00:00:00 2001 From: Bai Ping Date: Sat, 28 Feb 2015 19:19:56 +0800 Subject: [PATCH] MLK-10271 cpufreq: imx6: improve busfreq operation when wehn setpoint lower than 396MHz for i.MX6SX, according to the latest datasheet, added a 198MHz setpoint in cpufreq driver. The 198MHz setpoint is NOT enough to support playing mp3,the system will stay at a higher setpoint and high_bus_mode. So when having a setpoint lower than 396MHz, make sure when the cpufreq is at 396MHz or lower, the busfreq is always in low_bus_mode to save more power. Signed-off-by: Bai Ping (cherry picked from commit 3ba9548200ffb2c85111dd84946046ae0c7b09c4) --- drivers/cpufreq/imx6q-cpufreq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 6955a0e77a42..479979fbade6 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -20,6 +20,7 @@ #define PU_SOC_VOLTAGE_NORMAL 1250000 #define PU_SOC_VOLTAGE_HIGH 1275000 #define FREQ_1P2_GHZ 1200000000 +#define FREQ_396_MHZ 396000 static struct regulator *arm_reg; static struct regulator *pu_reg; @@ -76,7 +77,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) * CPU freq is increasing, so need to ensure * that bus frequency is increased too. */ - if (old_freq == freq_table[0].frequency) + if (old_freq <= FREQ_396_MHZ && new_freq > FREQ_396_MHZ) request_bus_freq(BUS_FREQ_HIGH); /* scaling up? scale voltage before frequency */ @@ -170,7 +171,7 @@ 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) + if (old_freq > FREQ_396_MHZ && new_freq <= FREQ_396_MHZ) release_bus_freq(BUS_FREQ_HIGH); return 0; @@ -188,9 +189,8 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy) dev_err(cpu_dev, "imx6 cpufreq init failed!\n"); return ret; } - if (policy->cur > freq_table[0].frequency) + if (policy->cur > FREQ_396_MHZ) request_bus_freq(BUS_FREQ_HIGH); - return 0; } -- 2.17.1