Revert "msm: Synchronize CPU frequency on thread migration"

This reverts commit 292520ddaf5d0b77e26900b30c25313959d7c75a.
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: 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>

Conflicts:

	drivers/cpufreq/cpufreq_ondemand.c
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>
cpufreq: Remove unused function cpufreq_notify_utilization

After drop of mpdecision cpufreq_notify_utilization is useless.
Let's remove it.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
cpufreq: ondemand: Introduce touch_load and touch_delay tunables

Introduce touch_load and touch_delay tunables that used to
boost frequency on touch.

Also remove unused input workqueue after drop of mpdecision.

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
cpufreq: ondemand: Export touch tunables to sysfs

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
cpufreq: ondemand: Fix checkpatch warnings

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
cpufreq: ondemand: Calculate the timer delay jiffies once

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Revert "cpufreq: Remove unused function cpufreq_notify_utilization"

This reverts commit a8ecc475660dab9e9d2e104ba845a1036d47d196.
cpufreq: ondemand: Change default values for touch tunables

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
cpufreq: Increase utilization threshold to 25

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
cpufreq: ondemand: Add missing call to cpufreq_notify_utilization

Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
cpufreq: ondemand: Boost CPU frequency only for touch input

Originally CPU frequency were boosted for any input event.
In some case, sensor sends a lot of input event, which
keep CPU in high frequency.  CPU frequency only need to
be boosted when real user interaction happens.

Change-Id: Ia3ad755b98d8363a17729926610b5dd6f0075288
CR-Fixed: 507519
Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>