cpufreq: interactive: Ignore hispeed_freq logic for notification

When governor gets a notification from scheduler, scheduler provides
exact load that is required by the workload. Ignore hispeed_freq logic
and directly use choose_freq result for notifications.

Also use is_notif field to distinguish notifications instead of
MAX_LOCAL_LOAD.

Change-Id: I409ea66c00f4277adf32d18c339631e1a8b0f97b
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c
index a909317..15a9e6d 100644
--- a/drivers/cpufreq/cpufreq_interactive.c
+++ b/drivers/cpufreq/cpufreq_interactive.c
@@ -147,8 +147,10 @@
 	 */
 	unsigned int max_freq_hysteresis;
 
-	/* Whether to change frequency immediately for notification */
-	bool fast_ramp_up;
+	/* Ignore hispeed_freq and above_hispeed_delay for notification */
+	bool ignore_hispeed_on_notif;
+
+	/* Ignore min_sample_time for notification */
 	bool fast_ramp_down;
 };
 
@@ -451,7 +453,6 @@
 	return now;
 }
 
-#define MAX_LOCAL_LOAD 100
 static void __cpufreq_interactive_timer(unsigned long data, bool is_notif)
 {
 	u64 now;
@@ -531,9 +532,10 @@
 	cpu_load = loadadjfreq / ppol->target_freq;
 	tunables->boosted = tunables->boost_val || now < tunables->boostpulse_endtime;
 
-	if (cpu_load >= tunables->go_hispeed_load || tunables->boosted) {
-		if (ppol->target_freq < tunables->hispeed_freq &&
-		    (!tunables->fast_ramp_up || cpu_load <= MAX_LOCAL_LOAD)) {
+	if (tunables->ignore_hispeed_on_notif && is_notif) {
+		new_freq = choose_freq(ppol, loadadjfreq);
+	} else if (cpu_load >= tunables->go_hispeed_load || tunables->boosted) {
+		if (ppol->target_freq < tunables->hispeed_freq) {
 			new_freq = tunables->hispeed_freq;
 		} else {
 			new_freq = choose_freq(ppol, loadadjfreq);
@@ -548,7 +550,7 @@
 			new_freq = tunables->hispeed_freq;
 	}
 
-	if ((!tunables->fast_ramp_up || cpu_load <= MAX_LOCAL_LOAD) &&
+	if ((!tunables->ignore_hispeed_on_notif || !is_notif) &&
 	    ppol->target_freq >= tunables->hispeed_freq &&
 	    new_freq > ppol->target_freq &&
 	    now - ppol->hispeed_validate_time <
@@ -981,7 +983,7 @@
 }
 show_store_one(max_freq_hysteresis);
 show_store_one(align_windows);
-show_store_one(fast_ramp_up);
+show_store_one(ignore_hispeed_on_notif);
 show_store_one(fast_ramp_down);
 
 static ssize_t show_go_hispeed_load(struct cpufreq_interactive_tunables
@@ -1375,7 +1377,7 @@
 show_store_gov_pol_sys(use_migration_notif);
 show_store_gov_pol_sys(max_freq_hysteresis);
 show_store_gov_pol_sys(align_windows);
-show_store_gov_pol_sys(fast_ramp_up);
+show_store_gov_pol_sys(ignore_hispeed_on_notif);
 show_store_gov_pol_sys(fast_ramp_down);
 
 #define gov_sys_attr_rw(_name)						\
@@ -1404,7 +1406,7 @@
 gov_sys_pol_attr_rw(use_migration_notif);
 gov_sys_pol_attr_rw(max_freq_hysteresis);
 gov_sys_pol_attr_rw(align_windows);
-gov_sys_pol_attr_rw(fast_ramp_up);
+gov_sys_pol_attr_rw(ignore_hispeed_on_notif);
 gov_sys_pol_attr_rw(fast_ramp_down);
 
 static struct global_attr boostpulse_gov_sys =
@@ -1430,7 +1432,7 @@
 	&use_migration_notif_gov_sys.attr,
 	&max_freq_hysteresis_gov_sys.attr,
 	&align_windows_gov_sys.attr,
-	&fast_ramp_up_gov_sys.attr,
+	&ignore_hispeed_on_notif_gov_sys.attr,
 	&fast_ramp_down_gov_sys.attr,
 	NULL,
 };
@@ -1457,7 +1459,7 @@
 	&use_migration_notif_gov_pol.attr,
 	&max_freq_hysteresis_gov_pol.attr,
 	&align_windows_gov_pol.attr,
-	&fast_ramp_up_gov_pol.attr,
+	&ignore_hispeed_on_notif_gov_pol.attr,
 	&fast_ramp_down_gov_pol.attr,
 	NULL,
 };