diff --git a/arch/arm64/configs/meson64_defconfig b/arch/arm64/configs/meson64_defconfig index ffbe9e614da0..c0a417393415 100644 --- a/arch/arm64/configs/meson64_defconfig +++ b/arch/arm64/configs/meson64_defconfig @@ -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 diff --git a/drivers/amlogic/cpufreq/Kconfig b/drivers/amlogic/cpufreq/Kconfig index f4661b038c8f..0afc861081a1 100644 --- a/drivers/amlogic/cpufreq/Kconfig +++ b/drivers/amlogic/cpufreq/Kconfig @@ -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. + diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index cd8057bf788c..0229989ce78d 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -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; diff --git a/drivers/input/input.c b/drivers/input/input.c index d95c34ee5dc1..9e93736e67b0 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -28,6 +28,9 @@ #include #include #include "input-compat.h" +#ifdef CONFIG_AMLOGIC_INPUT_BOOST +#include +#endif MODULE_AUTHOR("Vojtech Pavlik "); 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); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 0b985998643a..ebb596af6e42 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -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 */