cpufreq: interactive: Revert timer start modification

commit f3944527f57acde3162f8daeaffc4b11323a670f
(cpufreq: Sync on thread migration optimizations)
introduced a change to cpufreq_interactive_timer_start() in order
to reschedule the timer differently based on whether min or max
is changed. A better way is to reschedule the timer only when
necessary.

Revert timer start modification in preparation for the final fix.

Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: restructure CPUFREQ_GOV_LIMITS

The cpufreq_interactive_timer gets cancelled and rescheduled
whenever the cpufreq_policy is changed. When the cpufreq policy is
changed at a rate faster than the sampling_rate of the interactive
governor, then the governor misses to change the target frequency
for long duration. The patch removes the need of cancelling the
timers when policy->min is changed.

Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Simplify frequency calculations

Previously, complicated calculations led to oscillating cpu
frequencies that ruined user experience even on high-end
devices. Revert to the classic calculations based on a
percentage of current max frequency.  This way, we're using
freqs more evenly and much more predictable.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Consider changed min limit a frequency boost

A changed policy->min can safely be considered a frequency boost.
Process this change analogous to the cpufreq_interactive_boost()
routine.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Honor boosted state in several timer calculations

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Revert "cpufreq: interactive: Simplify frequency calculations"

This reverts commit dab8fc00db2dbef858e1f441444b8ddff32ea2fe.
cpufreq: interactive: Allow go_hispeed to be disabled

Specify 0 for go_hispeed_load to disable it.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Do not consider changed limits

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Cleanup hardcoded values

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Support variable frequency calculations

Use a threshold value up to which we are evaluating the current
speed weighted by current load against each new choice of speed.
Above switch to the original frequency calculation proportional to
load relative to the max possible frequency which allows for more
dynamic and fair changes.

Default threshold is cpuinfo min which guarantees minimal freqs
and energy usage during (offloaded) media playback.

Also, choose the highest frequency below or at target, which
generally saves us one freq level.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Add check_fast mode to raise freqs faster

It takes too long to scale from min_freq to max_freq. If you ignore
go_hispeed, then it takes over 100ms to step up through all the
frequencies. Even with go_hispeed, I think I figured it was 90ms to go
from idle to max speed.

The core of the problem is that a cpu_load << 100% is meaningful for
scaling.  As that load approaches 100% though, this estimate becomes
meaningless.

Here "meaningful" means that the speed adjusted load is a good approximation
of the total processing work needed and therefore good for estimating the
target frequency.

At 100% it is not meaningful because either it is a perfect estimate (had
we been running faster there is no more work we would have done) or off by
a factor of max_freq/min_freq in the worst case.

This patch recognizes this case and scales more aggressively.  At the same
time it also re-estimates in a shorter time to correct over/under scaling.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Disable idle notifier

Instead, just always poll using the timer.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
cpufreq: interactive: Best of all worlds

* We already have optimizations bt different pro
  developers. This patch just stitches all together.
* Needs to be tested. DO NOT MERGE without userspace
  changes.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Revert "autosmp: suspend/resume and work fixes and improvements"

This reverts commit c2a027d748c14c219186f6bcc0f85f47a81e77c9.
Revert "autosmp: hammerhead fixes, lcd hooks"

This reverts commit b3d2e49b4d6c957b712c6031528a450d623faf31.
fix freqs in autosmp
Update version to 77u-r3 to fix autosmp issues
Revert "adjust reset delay and lower clockspeed"

This reverts commit 4d8764a1b6ff317e9fffdb9d62bbd72454d02bab.
Revert "msm: footswitch-8x60: Allow specification of per-fs reset delays"

This reverts commit 32481ed9f6c3ecff2d63101def2b7973b88ad5ec.
Revert "msm: clock-8960: Add 1.8MHz rate to 8064's gfx3d_clk plan"

This reverts commit 51f356ac1b39bb08cb26e62b18bc52fa3c1154ea.