diff --git a/drivers/cpufreq/cpu-boost.c b/drivers/cpufreq/cpu-boost.c index 8494e2bbe8c5..400bf2e1f75f 100644 --- a/drivers/cpufreq/cpu-boost.c +++ b/drivers/cpufreq/cpu-boost.c @@ -27,6 +27,7 @@ #include #include #include +#include struct cpu_sync { struct task_struct *thread; @@ -155,6 +156,9 @@ static int boost_adjust_notify(struct notifier_block *nb, unsigned long val, if (!b_min && !ib_min) break; + ib_min = min((s->input_boost_min == UINT_MAX ? + policy->max : s->input_boost_min), policy->max); + min = max(b_min, ib_min); min = min(min, policy->max); @@ -204,6 +208,25 @@ static void update_policy_online(void) put_online_cpus(); } +void do_input_boost_max() +{ + unsigned int i; + struct cpu_sync *i_sync_info; + + cancel_delayed_work_sync(&input_boost_rem); + + for_each_possible_cpu(i) { + i_sync_info = &per_cpu(sync_info, i); + i_sync_info->input_boost_min = UINT_MAX; + } + + update_policy_online(); + + queue_delayed_work(system_power_efficient_wq, + &input_boost_rem, msecs_to_jiffies( + !input_boost_ms ? 1500 : input_boost_ms)); +} + static void do_input_boost_rem(struct work_struct *work) { unsigned int i; diff --git a/include/linux/cpu_boost.h b/include/linux/cpu_boost.h new file mode 100644 index 000000000000..6e01f7b2a9b0 --- /dev/null +++ b/include/linux/cpu_boost.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2018, Francisco Franco + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#ifndef _CPU_BOOST_H_ +#define _CPU_BOOST_H_ + +#ifdef CONFIG_CPU_BOOST +void do_input_boost_max(void); +#else +static inline void do_input_boost_max(void) +{ +} +#endif + +#endif /* _CPUBOOST_H_ */