final color config for pa 3.0

Change-Id: I18c901c2d77c77088c4e38977bf6d99c6d16de12
cpufreq/cpufreq_intellidemand: [SQAUSHED] intellidemand cpufreq governor

Intellidemand is inspired by ondemand governor. Its main features are:

 - auto cpu hotplugging based on runnable thread average calculations
 - detection of browsing mode (long screen on activities with moderate run
   queue depth =< 45 )
 - limit max frequencies when in browsing mode to conserve battery for long
   duration tasks

Browsing State Determination:
 1- Browsing state is enabled as power-on default. Browsing state is disabled
    when run queue depth is > 45 (very high instantaneous spikes)

Browsing State Limit Max Freq Logic (sliding window algorithm):
 1- While Screen is ON > 3 min, and average load of the CPU is < 35%, then
    CPU Max frequencies will remain power-on default
 2- While Screen is On, if average CPU load > 35%, both CPUs max frequencies
    will be limited to a lower user configurable max value
 3- While Screen is On, After both CPUs' Max is limited to lowered max, when
    the average CPU load has dropped down to less than < 25%, then both CPUs
    Max freq will be restored to back to power-on default

Runnable Thread Auto-hotplug (fast hotplug / slow unplug algorithm):
 1- When average number of running thread is < threshold, 2nd cpu will be
    unplugged.
 2- When > threshold, 2nd cpu will be hotplugged.
 3- The logic applies a fast hotplug and slow unplug algorithm so 2nd core
    will stay enabled longer to help deal with performance spikes

changes from Ver 2.0 -> Ver 3.0:
  - remove GPU Busy dependency for browsing state detection (this will make
    the governor more portable to other platforms without specific GPU
    architecture knowledge)

dependencies:
  -- Qualcomm's run queue average logic (SOC independent logic)
  -- TI's runnable thread average logic (SOC independent logic)

forward ported to Linux 3.4 for use on Mako

Signed-off-by: faux123 <reioux@gmail.com>
ONDEMAND: Sampling Rate 50k for battery savings
new default values for ondemand
config modules
Mjölnir is reborn

Started work on the kernel again as I think it really needed to go back to basics and really think aout what we are adding to a default/stock kernel
USB force fast charging

-Use base from Chad Froebel <chadfroebel@gmail.com> so we continue to
use the same generic sysfs mechanism

-Referenced franco's git for drivers/usb/otg/msm_otg.c changes
https://github.com/franciscofranco/mako/commit/5a8a4c8e23c7e1df39c740b9ce1d5dda20b0ede3

Off by default

Turn on:
echo 1 > /sys/kernel/fast_charge/force_fast_charge

Turn off:
echo 0 > /sys/kernel/fast_charge/force_fast_charge
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
No modding version
Not use.
ARM: add auto hotplug driver

This driver is simple and cheap and aims to avoid unnecessary hotplug
events and unnecessary task migrations. The design is simple. The value
of nr_running() (which is the current number of runnable threads) is
averaged over X samples by a ringbuffer. If the value is over a
dynamically calculated value, all CPUs are onlined. When the value falls
under another dynamically calculated value, the CPUs are offlined with a
2 second delay. If there is persistent load on the system, the CPUs will
not continually thrash between onlining and offlining and continually
migrate tasks. The number of online CPUs will remain constant until the
load has dropped below the dynamically calculated value. The online and
offline values are dynamically scaled based on the number of CPUs
online, as is the sampling rate of the driver. This aims to reduce the
expense of the driver and also reduce the number of unless hotplug
transitions which could have been avoided had cpufreq been given the
chance to ramp the online CPUs up and deal with the load. This driver
will also offline secondary cores when the screen is turned off,
providing earlysuspend is available.

It also has a module param to set
the minimum number of online CPUs:
/sys/module/auto_hotplug/parameters/min_online_cpus
This value is ignored when the device enters earlysuspend, as the
secondary CPUs are all offlined, but is set again when the screen is
turned back on.
auto_hotplug: enable the min_online_cpus value

Use a module_param_cb to set the minimum number of online CPUs when the screen is on.

The values are between 1-4.

usage:
echo '1' < /sys/module/auto_hotplug/parameters/min_online_cpus
Reduce the amount of time system has before hotplug driver starts
Battery Life eXtender (BLX)

This is a simple port of Ezekeel's BLX mod to the Nexus 4.

See this thread for more information: http://forum.xda-developers.com/showthread.php?t=1257497

Let's keep the same sysfs implementation so that apps, such as Trickster MOD, can support this.
Change the max charge to 100
Some ondemand governor tweaks
Added optimized ARM RWSEM algorithm.
ondemand: Add support to consider other cpu load when scaling frequencies

Currently only current cpu load is considered when frequency scaling.
As a side effect of this when scheduler migrates a thread to a slower
core, the execution time increases unexpectedly.

The new algorithm not only considers current cpu load for frequency
scaling, but also takes into account load of other online cpus. The
treshold for this can be controlled using up_threshold_any_cpu_load.
When the up_threshold_any_cpu_load is crossed in any cpu then the
current cpu is set to sync_freq.

Also, when more than one cpu is online a two step ramp-up mechanism
is used. When the up_threshold_multi_core is crossed the cpu is ramped
up to optimal_freq which is less than policy->max and set to a power
friendly value.

Change-Id: I64bed1b142cde1f239e73aa1f78981c78aaf59ce
Signed-off-by: Narayanan Gopalakrishnan <nargop@codeaurora.org>

Conflicts:
	drivers/cpufreq/cpufreq_ondemand.c
auto_hotplug: some tweaks

Several tweaks to try to improve battery life.
msm: cpufreq: fix a race between hotplug and cpufreq

When msm_cpufreq_target() is called without holding the policy
semaphore, there is a rare chance that the cpu gets hotplugged in
the acpuclk_set_rate. The probability of this issue increases
when cross-calling is used or using interactive governor which
tries to set all cpu frequencies from a single thread.

Add a hotplug notifier and set the device_suspended flag holding
the suspend mutex, when cpu is going down. This mutex is always
held when frequency changes are done.

Change-Id: Ide3aa6927ad60d2512d63761c51bb15117461250
Signed-off-by: Narayanan Gopalakrishnan <nargop@codeaurora.org>
auto_hotplug: various tweaks
color base set finetuning

Change-Id: Iaf33c441209db363d6289fc04e5e6edad7473b19

Conflicts:
	arch/arm/mach-msm/lge/devices_lge.c