cpufreq: boost cpufreq when remote key input
authorJiamin Ma <jiamin.ma@amlogic.com>
Fri, 19 Jan 2018 08:54:32 +0000 (16:54 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 8 Mar 2018 06:02:09 +0000 (22:02 -0800)
PD#158772: cpufreq: boost cpufreq when remote key input

Change-Id: I0bc536737380d51f7f14b00d1fa34a52ccd528c0
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
arch/arm64/configs/meson64_defconfig
drivers/amlogic/cpufreq/Kconfig
drivers/cpufreq/cpufreq_interactive.c
drivers/input/input.c
include/linux/cpufreq.h

index ffbe9e6..c0a4173 100644 (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
index f4661b0..0afc861 100644 (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.
+
index cd8057b..0229989 100644 (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;
index d95c34e..9e93736 100644 (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);
index 0b98599..ebb596a 100644 (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 */