Revert "cpufreq: ondemand: Fix hotplug deadlock with store_powersave_bias"

This reverts commit 437a2d215393bd817a4554c2b1efc5aab65eee20.
Revert "cpufreq: Adding traces to the cpufreq"

This reverts commit e78b3ff2f49944af46efbf0f5b4a2dee9e969b60.
Revert "cpufreq: ondemand: Fix update_sampling_rate race with hotplug"

This reverts commit 126c30bf269bcc7eabffa881c2de9bd05ceffb83.
Revert "cpufreq: ondemand: add input_boost interface"

This reverts commit 186488e91562a325d5e2aa6f0c29ad937f7e5ec1.
Revert "cpufreq: Avoid using smp_processor_id() in preemptible context"

This reverts commit 398cf85ab714107107956a890bf807a703f2ea95.
Revert "msm: cpufreq: Only apply driver limits for scaling_min/max_freq writes"

This reverts commit 32e31dc20f1b12c1a253cf4eb2c6a45d1e914119.
Revert "cpufreq: ondemand: Boost CPU frequency only for touch input"

This reverts commit 3eb3173449c6c5f359600f369df2aefd7fd56eaa.
Revert "cpufreq: ondemand: Disable freq sync feature in store_powersave_bias"

This reverts commit b893789ad322e30bb97e63a2ac07c2b5e3979b00.
Revert "cpufreq: ondemand: Fix locking issue in store_powersave_bias"

This reverts commit 05c32d485ec98bf9d7266def49fc475338b9d1b8.
cpufreq_ondemand: sync with jb-4.3 branch
Revert "ondemand: Add support to consider other cpu load when scaling frequencies"

This reverts commit 8011fdc939cd99cd94223f54989ba4599a0277d1.
Revert "msm: cpufreq: Fix the race between dbs_refresh and hotplug."

This reverts commit 67677bb6caf0ab029626256d55f46907be0272a8.
cpufreq: ondemand: Replace down_differential tuner with adj_up_threshold

In order to avoid the calculation of up_threshold - down_differential
every time that the frequency must be decreased, we replace the
down_differential tuner with the adj_up_threshold which keeps the
difference across multiple checks.

Update the adj_up_threshold only when the up_theshold is also updated.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: ondemand: Fix typos in comments

Fix some typos in comments.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: governors: Calculate iowait time only when necessary

Currently we always calculate the CPU iowait time and add it to idle
time.
If we are in ondemand and we use io_is_busy, we re-calculate iowait time
and we subtract it from idle time.

With this patch iowait time is calculated only when necessary avoiding
the double call to get_cpu_iowait_time_us. We use a parameter in
function get_cpu_idle_time to distinguish when the iowait time will be
added to idle time or not, without the need of keeping the prev_io_wait.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.,org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
cpufreq: ondemand: Calculate gradient of CPU load to early
increase frequency

Instead of checking only the absolute value of CPU load_freq to increase
frequency, we detect forthcoming CPU load rise and increase frequency
earlier.

Every sampling rate, we calculate the gradient of load_freq. If it is
too steep we assume that the load most probably will go over
up_threshold in next iteration(s) and we increase frequency immediately.

New tuners are introduced:
- early_demand: to enable this functionality (disabled by default).
- grad_up_threshold: over this gradient of load we will increase
frequency immediately.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
cpufreq: ondemand: Calculate the next frequency proportional to current load

If load_freq < adj_up_threshold adjust the frequency proportional to
current load.
So, we don't wait for load to saturate the min frequency until
up_threshold. We adjust frequency immediately to a higher frequency.

Also, update the MICRO_FREQUENCY_UP_THRESHOLD to 95 and
MICRO_FREQUENCY_DOWN_DIFFERENTIAL to 3. We don't need more aggresive
values anymore.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
cpufreq: ondemand: freq_next should be proportional to cpuinfo.max_freq

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
cpufreq: ondemand: Fix frequency increase comparison

up_threshold should compared against max_load. Fix it.

Also cleanup unused code from calculation change of freq_target method.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
cpufreq: ondemand: Drop early_demand

Since we changed the calculation of target frequency early demand is
kind of useless.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>