This patch adds protection from accidental enable of boost at systems,
which supports software boosting.

Boost software mode can be only enabled when up to one busy (with heavy
load) core is available on the system. Such approach brings extra
protection from over heating.

Moreover the boost is automatically disabled, when cpufreq core detects
more busy cores.

Signed-off-by: Lukasz Majewski <l.majew...@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo....@samsung.com>

Changes for v4:
- New patch
---
 drivers/cpufreq/cpufreq.c          |    9 +++++++--
 drivers/cpufreq/cpufreq_governor.c |    3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index f785273..59d2cac 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1932,12 +1932,17 @@ static struct notifier_block __refdata 
cpufreq_cpu_notifier = {
 /*********************************************************************
  *               BOOST                                              *
  *********************************************************************/
-static int cpufreq_boost_trigger_state_sw(void)
+static int cpufreq_boost_trigger_state_sw(int state)
 {
        struct cpufreq_frequency_table *freq_table;
        struct cpufreq_policy *policy;
        int ret = -EINVAL;
 
+       if (state && cpufreq_num_busy_cpu() > 1) {
+               boost_enabled = 0;
+               return 0;
+       }
+
        list_for_each_entry(policy, &cpufreq_policy_list, policy_list) {
                freq_table = cpufreq_frequency_get_table(policy->cpu);
                if (freq_table)
@@ -1959,7 +1964,7 @@ int cpufreq_boost_trigger_state(int state)
                if (cpufreq_driver->enable_boost)
                        ret = cpufreq_driver->enable_boost(state);
                else
-                       ret = cpufreq_boost_trigger_state_sw();
+                       ret = cpufreq_boost_trigger_state_sw(state);
 
                if (ret) {
                        boost_enabled = 0;
diff --git a/drivers/cpufreq/cpufreq_governor.c 
b/drivers/cpufreq/cpufreq_governor.c
index 3402533..9383ab9 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -162,6 +162,9 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)
                        max_load = load;
        }
 
+       if (cpufreq_boost_supported() && cpufreq_num_busy_cpu() > 1)
+               cpufreq_boost_trigger_state(0);
+
        dbs_data->cdata->gov_check_cpu(cpu, max_load);
 }
 EXPORT_SYMBOL_GPL(dbs_check_cpu);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to