Cpufreq: Added input event hook to ramp up cpu frequency

Cpufreq: Added input event hook to ramp up cpu frequency

This will cause switch to maximum opp immediately when user
interaction occurs, i.e. touchscreen input or keypad activity.

Change-Id: I0cfe32479ef62a967f359c1bf57f97eefde7e8f7
Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
Signed-off-by: Jouni Hogander <jouni.hogander@nokia.com>
[bsteuer@quicinc.com: fixed cpu_dbs_info naming, added header]
Signed-off-by: Brian Steuer <bsteuer@codeaurora.org>
cpufreq: Fixed input event handler code

cpufreq: Fixed input event handler code

The input event handler now grabs a semaphore before
accessing internal ondemand governor data. This prevents
conflicts with normal timer based ondemand functions.

Error handling during input handler registration fixed.

Change-Id: I9c4045acac82ee6fe17b126b813ad4f2248895bd
Signed-off-by: Brian Steuer <bsteuer@codeaurora.org>
cpufreq: Fix input handler crash

When input handler is running on a CPU not in ondemand
governor, skip making CPU frequency changes.

CRs-Fixed: 299451
Signed-off-by: David Ng <dave@codeaurora.org>
cpufreq : Fix crash input event handler on governor switch

When an input event and CPU1 hotplug occurs at the same
time, a race condition can happen between cpufreq and
cpu hotplug resulting in a kernel panic.
When a hotplug operation is underway on CPU1,
__cpufreq_remove_dev is called. __cpufreq_remove_dev gets
the lock, proceeds to free the policy info of the current
governor and calls the ondemand governor with a STOP event.
If an input event occurs around the same time, it waits
for __cpufreq_remove_dev to release the lock. Meanwhile,
the ondemand governor clears some of its settings, but
fails to clear its local current policy. As soon as the
input event handler acquires the lock, it now uses the
invalid ondemand current policy handle to make frequency
changes. This results in a kernel panic.

Skip making frequency changes if this condition happens.

CRs-fixed: 327622,319348
Change-Id: I78227352fc66cc3ec5ab095c45eda76a92d1ba46
Signed-off-by: Anitha Anand <anithas@codeaurora.org>

Conflicts:

	drivers/cpufreq/cpufreq_ondemand.c
cpufreq: Extend ondemand powersave_bias for negative range

Original ondemand powersave_bias parameter allows value
range from 0 (no powersave) to 1000 (100% reduction in
calculated CPU frequency).  This change extends powersave_bias
into the negative range (-1 to -1000) to allow a corresponding
boost to CPU frequency.  When set at either limit (-1000 or
1000), ondemand timer is cancelled as periodic load
sampling at sampling_rate is not necessary.

Change-Id: I2ee05729ceec20c2e2a4c6d9ca05cecd16ab161a
Signed-off-by: David Ng <dave@codeaurora.org>

Conflicts:

	drivers/cpufreq/cpufreq_ondemand.c
msm: cpufreq: Fix store_powersave_bias to account for sync' CPUs.

Current code assumes that all online CPUs runs their own timers to
collect CPU samples for demand based switching (dbs). But in case of
synchronous CPUs, ondemand governor registers only one timer at init
time because both CPUs are accounted in the same timer call. Hence
trying to restart/cancel dbs timers for all online CPUs is not legal
for these CPUs. This change fixes above function to restart/cancel
timers only once for group of synchronous CPUs.

Change-Id: I23f1697783a65f125679a07a076620e8fa5e62d5
Signed-off-by: Krishna Vanka <kvanka@codeaurora.org>
cpufreq: Add cpu utilization statistics to aid decisions made by userspace.

Understanding system load as seen by cpufreq can help userspace
algorithms make better decisions to improve system responsiveness.
One such example would be the MP decision algorithm which mines
various system info to make decisions on hotplugging in/out
the additional cores.

Change-Id: I277db7e1a7803a3822b61e7befa25131487cfe17
Signed-off-by: Anitha Anand <anithas@codeaurora.org>
msm: cpufreq: Fix the race between dbs_refresh and hotplug.

The demand based switching responds to input events and schedules
work items on all online cpus to increase the frequency. This will
call the dbs_refresh_callback on respective cpu. If this work item
kicks in while cpu1 is progressing its way through cpufreq_add_dev,
there is a chance that work item grabs the cpu_policy_rwsem of cpu1
and relases that of cpu0, when add device is working through releas-
ing lock of cpu1 and reaquiring that of cpu0. This is locking out
cpu1 when it tries to come up online next time. The fix is hold the
hot plug lock while processing refresh work items.

CRs-Fixed: 362444
Change-Id: I57db7c7a9b58369bf059302896f3bf9eca2bc2bb
Signed-off-by: Krishna Vanka <kvanka@codeaurora.org>
cpufreq: ondemand: Add boost interface

 * Boost interface will boost CPU to max freq. Useful for improving
   userspace interactivity when used in conjunction with Android power
   HAL.

Change-Id: I16a1e01023dcb933ccfe58595b49ddbed74e91df
cpufreq: Added missing defines to cpufreq.h header file.

Change-Id: I9ef248b4f34ed7d41f5ee2f6ee352cd87c5a6d3d