]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
MLK-10271 cpufreq: imx6: improve busfreq operation when wehn setpoint lower than...
authorBai Ping <b51503@freescale.com>
Sat, 28 Feb 2015 11:19:56 +0000 (19:19 +0800)
committerBai Ping <b51503@freescale.com>
Wed, 4 Mar 2015 10:50:39 +0000 (18:50 +0800)
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 <b51503@freescale.com>
drivers/cpufreq/imx6q-cpufreq.c

index 601326ca6408d6781fc71e0fc030c89295c81ff5..e62ef8a6108b9f1961e2a9d20b78fe8bff6dae9e 100644 (file)
@@ -22,6 +22,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 */
@@ -169,7 +170,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);
 
        mutex_unlock(&set_cpufreq_lock);
@@ -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;
 }