cpufreq: boost cpufreq when remote key input

PD#158772: cpufreq: boost cpufreq when remote key input

Change-Id: I0bc536737380d51f7f14b00d1fa34a52ccd528c0
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
This commit is contained in:
Jiamin Ma
2018-01-19 16:54:32 +08:00
committed by Jianxin Pan
parent f0ec553988
commit 4b3b3ab348
5 changed files with 57 additions and 0 deletions

View File

@@ -199,6 +199,7 @@ CONFIG_MAC80211=y
CONFIG_RFKILL=y
CONFIG_AMLOGIC_DRIVER=y
CONFIG_AMLOGIC_MODIFY=y
CONFIG_AMLOGIC_INPUT_BOOST=y
CONFIG_AMLOGIC_UART=y
CONFIG_AMLOGIC_SERIAL_MESON_CONSOLE=y
CONFIG_AMLOGIC_IOMAP=y

View File

@@ -21,3 +21,22 @@ config AMLOGIC_M8B_CPUFREQ
it if your chip belongs this group
endchoice #AMLOGIC_CPUFREQ
config AMLOGIC_INPUT_BOOST
bool "Meson BOOST cpufreq when key input"
depends on CPU_FREQ_GOV_INTERACTIVE
help
This adds boost cpuferq support when key input detected.
This adds boost cpuferq support when key input detected.
When key input, cpufreq is boosted.
And boost_duration is decideded by AMLOGIC_INPUT_BOOST_DURATION
config AMLOGIC_INPUT_BOOST_DURATION
int "Input boost duration"
range 0 5000
default 1000
depends on AMLOGIC_INPUT_BOOST
help
This set boost cpuferq duration.
unit is ms.

View File

@@ -1152,6 +1152,33 @@ static void interactive_tunables_free(struct interactive_tunables *tunables)
kfree(tunables);
}
#ifdef CONFIG_AMLOGIC_INPUT_BOOST
void set_boostpulse(void)
{
struct interactive_tunables *tunables;
struct interactive_cpu *icpu;
icpu = &per_cpu(interactive_cpu, smp_processor_id());
if (!down_read_trylock(&icpu->enable_sem))
return;
if (!icpu->ipolicy) {
up_read(&icpu->enable_sem);
return;
}
tunables = icpu->ipolicy->tunables;
tunables->boostpulse_endtime = ktime_to_us(ktime_get()) +
CONFIG_AMLOGIC_INPUT_BOOST_DURATION * 1000;
trace_cpufreq_interactive_boost("pulse");
if (!tunables->boosted)
cpufreq_interactive_boost(tunables);
up_read(&icpu->enable_sem);
}
EXPORT_SYMBOL(set_boostpulse);
#endif
int cpufreq_interactive_init(struct cpufreq_policy *policy)
{
struct interactive_policy *ipolicy;

View File

@@ -28,6 +28,9 @@
#include <linux/mutex.h>
#include <linux/rcupdate.h>
#include "input-compat.h"
#ifdef CONFIG_AMLOGIC_INPUT_BOOST
#include <linux/cpufreq.h>
#endif
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
MODULE_DESCRIPTION("Input core");
@@ -292,6 +295,10 @@ static int input_get_disposition(struct input_dev *dev,
break;
}
#ifdef CONFIG_AMLOGIC_INPUT_BOOST
set_boostpulse();
#endif
if (!!test_bit(code, dev->key) != !!value) {
__change_bit(code, dev->key);

View File

@@ -933,4 +933,7 @@ int cpufreq_generic_init(struct cpufreq_policy *policy,
struct sched_domain;
unsigned long cpufreq_scale_freq_capacity(struct sched_domain *sd, int cpu);
unsigned long cpufreq_scale_max_freq_capacity(int cpu);
#ifdef CONFIG_AMLOGIC_INPUT_BOOST
void set_boostpulse(void);
#endif
#endif /* _LINUX_CPUFREQ_H */