Reduce number of cpu frequencies
We liked this for mako, let's slowly try this for hammerhead
Tweak a bit
cpufreq: interactive: make sure boosted_time is initialized with jiffies and use standard jiffies API to detect if time is after or before jiffes.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
net: wireless: bcmdhd: support Hotspot 2.0 release 1.0

Change-Id: I0d893b85741da628cb5c49c0a1b70c9d2d1ffac9
Signed-off-by: Ecco Park <eccopark@broadcom.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
timekeeping: utilize the suspend-nonstop clocksource to count suspended time

There are some new processors whose TSC clocksource won't stop during
suspend. Currently, after system resumes, kernel will use persistent
clock or RTC to compensate the sleep time, but with these nonstop
clocksources, we could skip the special compensation from external
sources, and just use current clocksource for time recounting.

This can solve some time drift bugs caused by some not-so-accurate or
error-prone RTC devices.

The current way to count suspended time is first try to use the persistent
clock, and then try the RTC if persistent clock can't be used. This
patch will change the trying order to:
	suspend-nonstop clocksource -> persistent clock -> RTC

When counting the sleep time with nonstop clocksource, use an accurate way
suggested by Jason Gunthorpe to cover very large delta cycles.

CRs-fixed: 536881
Change-Id: I59c21b1ce5ae81cebc8cf3e817d9b3f951302a3d
Signed-off-by: Feng Tang <feng.tang@intel.com>
[jstultz: Small optimization, avoiding re-reading the clocksource]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Git-commit: e445cf1c4257cc0238d72e4129eb4739f46fd3de)
[sboyd: Took tk and clock local variables]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
clocksource: Add new feature flag CLOCK_SOURCE_SUSPEND_NONSTOP

Some x86 processors have a TSC clocksource, which continues to run
even when system is suspended. Also most OMAP platforms have a
32 KHz timer which has similar capability. Add a feature flag so that
it could be utilized.

CRs-fixed: 536881
Change-Id: I863678fec5a3021158240f2c5b144c552ba0b16a
Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Git-commit: 5caf4636259ae3af0efbb9bfc4cd97874b547c7d
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
clocksource: arm_arch_timer: Use clocksource for suspend timekeeping

The ARM architected timers keep counting during suspend so we can
mark this clocksource with the CLOCK_SOURCE_SUSPEND_NONSTOP. This
flag will indicate that this clocksource can be used for
calculating suspend time and injecting sleep time into the
timekeeping core. This will usually be more accurate than using
an external RTC or architecture specific persistent clock.

CRs-fixed: 536881
Change-Id: I882bf19a87ceb642aa069bbf26802c66c96b4426
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
msm: pm-8x60: Fix suspend time tracking

Calls to sched_clock() after syscore devices have been suspend
will return the same value until the syscored devices are
resumed. Furthermore, the value won't jump forward to account for
the time left in suspend so we can't use it to calculate how much
time we spent in suspend.

We could expose the hardware directly to the pm code but it's
better to use generic interfaces. Move to using the timekeeping
APIs to determine how long we were in suspend. Unfortunately, we
can't use the timekeeping APIs this early in the resume path, so
we must read the current time of day before we suspend the
timekeeping core and after we resume the timekeeping core. Move
the calls to the suspend_late() and wake() callbacks so we can
properly read the amount of suspend time.

CRs-fixed: 536881
Change-Id: I3b47511afb75926e51e82fc83929f405404fbf07
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
msm: kgsl: Print a message when tz_init fails

When the tz_init fails to initialize the GPU busy percentage
based algorithm, print an error message and revert to the old
algorithm.

Change-Id: I55a09db7d6f33f6496584fd24c9cfc8a70d13e3d
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
PM / devfreq: improve devfreq->data support

This field is treated as governer specific data for
a devfreq instance. But there's currently no way to
set the correct data when switching governors through
sysfs. Add support for optionally passing a set of
name / data pairs in struct devfreq_dev_profile,
representing the data for each governor.

Change-Id: I5523ce94f8b0045974f0635fb734cb1282512f91
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
PM / devfreq: allow governors to use devfreq_get_freq_level

Level based governors may need to perform this lookup to
interpret the current frequency of the device.

Change-Id: Idf7246b05775a52f088c52b898d98fbab4fd942c
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
PM / devfreq: fix find_governor_data() function

find_governor_data() was added to the devfreq infrastructure earlier.
It uses an incorrect condition in an if-statement when it searches
a governor by its name. Fixing the condition.

Change-Id: Ib297caad3e23984651217a43d2fdde1f6fcbdf7a
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
Revert "Simple GPU governor: fix a merge derp"

This reverts commit 37bc6b80efaa07617c4d9b5ae78f52a7670c19ab.
Revert "GPU Simple Governor: adapt GPU Simple Governor for Snapdrgaon 800 SOCs"

This reverts commit 9033c6ee3fab06f399b4a7834172693460998f7a.
msm: kgsl: convert pwrscale framework to use devfreq

Convert the clock frequency scaling infrastructure to
be based on devfreq.

Change-Id: I1a60ba339db5715a8836b835bd1b29b46e151af6
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>

Conflicts:
	drivers/gpu/msm/kgsl_pwrscale.c
	drivers/gpu/msm/kgsl_pwrscale.h
	drivers/gpu/msm/kgsl_pwrscale_trustzone.c
PM / devfreq: add msm-adreno-tz governor

This governor can be used to control adreno GPUs.
It is unlikely to be useful for other devices.

Change-Id: Icf481322454b814d2f41019f2f01286062409952
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
msm: kgsl: make msm-adreno-tz the default governor for adreno

On targets where trustzone is available, use the trustzone
based governor instead of simple_ondemand.

Change-Id: Ie11c57684fc63a26e82a5c4816a35a327a1bf945
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Vladimir Razgulin <vrazguli@codeaurora.org>
PM / devfreq: Allow the governors to set the target flag

The devfreq framework calls a frequency targeting function with
a flag parameter.  Allow the governors to influence that parameter.

Change-Id: I4058bd9dcd027dd246ccdb90d25c68f1dc055901
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
msm: kgsl: convert pwrscale to use bus_mod

Use a bus specific speed flag rather than overloading
the least upper bound flag.

Change-Id: I343726e6e0d9885f39c343ed56c1667ab2008aee
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>