cpufreq: Move get_cpu_idle_time() to cpufreq.c

Governors other than ondemand and conservative can also use
get_cpu_idle_time() and they aren't required to compile
cpufreq_governor.c. So, move these independent routines to
cpufreq.c instead.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Git-commit: 72a4ce340a7ebf39e1c6fdc8f5feb4f974d6c635
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[junjiew@codeaurora.org: update non-upstream files]
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>

Change-Id: I3227454599250011a19a752c962e3cacb1fb0301
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: hotplug: fix after moving get_cpu_idle_time() to cpufreq.c

Signed-off-by: Dan Trifan <jimsth@gmail.com>
cpufreq: return early from __cpufreq_driver_getavg()

There is no need to do cpufreq_get_cpu() and cpufreq_put_cpu() for drivers that
don't support getavg() routine.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
cpufreq: Fix sparse warning by making local function static

cpufreq_disabled() is a local function, so should be marked static.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
cpufreq: Remove unnecessary initialization of a local variable

Remove an unnecessary initializer for the 'ret' variable in
__cpufreq_set_policy().

[rjw: Modified the subject and changelog slightly.]
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Signed-off-by: Dan Trifan <jimsth@gmail.com>
Revert "cpufreq: interactive: don't scale beyond min if the load is low"

This reverts commit fd2d4b84071c25840bba6af387d558cf7f6566e6.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
Revert "cpufreq: interactive: Initialize spinlocks"

This reverts commit f2bf2908629a2af0abeb828e9e2c8194c5fb94f7.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
Revert "cpufreq: interactive: Honor boosted state when entering idle"

This reverts commit a664c5d1b1929b3b2befdc9a2eb7a2ac7bdd92b7.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
Revert "cpufreq: interactive: Use frequency dependent per cpu timings"

This reverts commit e7af6e5ecb207d9c510db2705c0b8242b7276a18.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
cpufreq: interactive: Allow go_hispeed to be disabled

Specify 0 for go_hispeed_load to disable it.

Change-Id: Iff956e1784295e8d373ff8ad6ba4a306ff233f19
Signed-off-by: Dan Trifan <jimsth@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.

Change-Id: I0b199f3aa9f451cf500ec3c73ef3352f1661b0c0
Signed-off-by: Dan Trifan <jimsth@gmail.com>
cpufreq: interactive: Disable idle notifier

Instead, just always poll using the timer.

Change-Id: Iee3de7c348ce98f3fa5ae2f17abec14ad49b1794
Signed-off-by: Dan Trifan <jimsth@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>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
cpufreq: interactive: Round up timer_rate to match jiffy

Timers are scheduled in unit of jiffies. Round up timer_rate so that
it matches the actual sampling period.

Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
Revert "qup_i2c: Initialize I2C resource before registering."

* Thanks @Dorimanx and @neobuddy89 for reporting higher power drain.

This reverts commit 020ea2daa55ca5d421e19053703de3a052aa8f6d.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
asoc: msm: Fix compress capture

 * Capture endpoints were not being properly registered, resulting in
   failure to record AMR_WB formats. Fix it.

Change-Id: I898cfdabce862ab4f551c2903e53fe1d3d76a368
Signed-off-by: Dan Trifan <jimsth@gmail.com>
cgroup: fix exit() vs rmdir() race

In cgroup_exit() put_css_set_taskexit() is called without any lock,
which might lead to accessing a freed cgroup:

thread1                           thread2
---------------------------------------------
exit()
  cgroup_exit()
    put_css_set_taskexit()
      atomic_dec(cgrp->count);
                                   rmdir();
      /* not safe !! */
      check_for_release(cgrp);

rcu_read_lock() can be used to make sure the cgroup is alive.

Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm_rq_stats: Tone down mpdecision

Add a new Kconfig to enable more conservative computations sent
to mpdecision:

 * Do not make IO busy
 * Do a time window weighted load computation instead of just a sum
 * Do an sliding window averaged time computation for number runnable

The purpose of these changes is to make mpdecision less likely to
keep extra cores online.  It currently has a tendancy to run more
cores running than needed and this can even cause some lag issues.

Change-Id: Ibbe9dca04c8b3425e288afef9ef6166fbc4a0613
Signed-off-by: Dan Trifan <jimsth@gmail.com>
defconfig: add option for the new rq_stats computation

Signed-off-by: Dan Trifan <jimsth@gmail.com>
net: wireless: bcmdhd: Disable OOB interrupt when WLAN is off

b/17446901

Signed-off-by: Ritter Yeh <ryeh@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Dan Trifan <jimsth@gmail.com>