cpufreq: Add cpu-boost driver

When certain bursty and important events take place, it might take a while
for the current cpufreq governor to notice the new load and react to it.
That would result in poor user experience. To alleviate this, the cpu-boost
driver boosts the frequency of a CPU for a short duration to maintain good
user experience while the governor catches up.

Specifically, this commit deals with ensuring that when "important" tasks
migrate from a fast CPU to a slow CPU, the frequency of the slow CPU is
boosted to be at least as high as the fast CPU for a short duration.

Since this driver enforces the boost by hooking into standard cpufreq
ADJUST notifiers, it has several advantages:
- More portable across kernel versions where the cpufreq internals might
  have been rewritten.
- Governor agnostic and hence works with multiple governors like
  conservative, ondemand, interactive, etc.
- Does not affect the sampling period/logic of existing governors.
- Can have the boost period adjusted independent of governor sampling
  period.

Signed-off-by: Saravana Kannan <skannan@codeaurora.org>

Change-Id: Ibd814a20043d0aba64ee7637a4a79b9ffa1b0991
cpufreq: Add a sync limit to cpu-boost

Perform frequency synchronization only when source CPU's frequency
is less than sync_threshold, else sync to the sync_threshold.

Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>

Change-Id: I544c414568d4e015b80ce5891dd215275bac95da
cpufreq: interactive: sync android-3.0 with android-3.4

Change-Id: I71443db4edbe43a08fe58a54a742b4c788ef11e3
Signed-off-by: Todd Poynor <toddpoynor@google.com>

Conflicts:
	Documentation/cpu-freq/governors.txt
	drivers/cpufreq/cpufreq_interactive.c
cpufreq: interactive: add io_is_busy interface

compatibility fix included

Previously the idle time returned from get_cpu_idle_time_us included the
iowait time. So the iowait time was always calculated as idle time.

But now the idle time returned from get_cpu_idle_time_us does not include
the iowait time anymore because of below commit which cause the iowait time
always calculated as busy time:
    6beea0c nohz: Fix update_ts_time_stat idle accounting

Add the io_is_busy interface, as does the ondemand governor, and let the user
configure the iowait time as busy or idle through the io_is_busy sysfs
interface.

By default, io_is_busy is disabled.

[toddpoynor@google.com: minor updates]
Change-Id: If7d70ff864c43bc9c8d7fd7cfc66f930d339f9b4
Signed-off-by: Lianwei Wang <lian-wei.wang@motorola.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>

Signed-off-by: Dan Trifan <jimsth@gmail.com>
drivers:cpufreq:interactive: hardcode tuntable values

Signed-off-by: Dan Trifan <jimsth@gmail.com>
cpufreq: interactive: don't remove sysfs nodes

Signed-off-by: Dan Trifan <jimsth@gmail.com>
cpufreq: interactive: handle errors from cpufreq_frequency_table_target

Add checks for error return from cpufreq_frequency_table_target, and be
less noisy on the existing call with an error check.  CPU hotplug and
system shutdown may cause this call to return -EINVAL.

Bug: 8613560
Change-Id: Id78d8829920462c0db1c7e14e717d91740d6cb44
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
cpufreq: interactive: fix race on cpufreq TRANSITION notifier

The cpufreq TRANSTION notifier callback does not check the
governor_enabled state on affected CPUS, which will case
kernel panic in update_load because the policy object maybe
NULL or invalid when governor_enabled is false.

Change-Id: Ie0f1718124f61e2f9b5da57abc6981ada5b83908
Signed-off-by: Lianwei Wang <a22439@motorola.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
 cpufreq: interactive: proper touch boost implementation, userspace Po…

…werHal is disabled during boot.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
 cpufreq: interactive: fix a wrong behavior of boostpulse freq and his…

…peed_freq. Also increased boosted time to 500ms and decreased hispeed_freq to 729MHz to make up for it.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
drivers: cpufreq: interactive: fix input_boost_freq

Adjust input_boost_freq for DirtyV frequency table. It was jumping to the next higher frequency than the set 1036800 which was 1250 MHz, or the default max on DirtyV.
cpufreq: interactive: Add a sampling_down_factor for max frequencies

Change min_sample_time to 100ms when running at max

Change-Id: Ia7e35b0625bedf20e7ef3a1f52e5828ffbfed93e
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
add ondemandplus governor

Signed-off-by: Dan Trifan <jimsth@gmail.com>

Conflicts:
	drivers/cpufreq/Kconfig
	include/linux/cpufreq.h
ondemandplus: add and enable io_is_busy=2 option, adjust up_threshold and down_differential

Signed-off-by: Dan Trifan <jimsth@gmail.com>
ondemandplus governor: remove adaptive timer_rate logic

It is unlikely this gives any power savings and only
add some ugly code :)

Signed-off-by: Dan Trifan <jimsth@gmail.com>
cpufreq: added HYPER governor

Conflicts:
	drivers/cpufreq/Kconfig
	drivers/cpufreq/Makefile
Added Dynamic Interactive Governor
cpufreq: Add Sakuractive governor
cpufreq: hotplug: don't synch threads on jiffies

cpufreq-hotplug was always designed to run as a single thread that takes
aggregate load of all CPUs into account.  As such there is no need to
synchronize multiple threads to execute at the same time.  This
sychronization mechanism also causes execution of the do_dbs_check function
to be somewhat erratically scheduled.  Removing it causes scheduling of this
function to reliably happen based soley on the supplied sampling_rate
parameter.

Change-Id: If0edc89996f0d5763502236b225835dd9f4ab3c9
Signed-off-by: Mike Turquette <mturquette@ti.com>
cpufreq_hotplug.c: Update to last Cylon Kernel