lib: use asm-generic hash.h
arm: atomic.h: defined relaxed atomic_read

Defining relaxed version of atomic read as cpu_relaxed_read_atomic.

bug 1440421

Change-Id: I39303d72350985890c7eb5a1afc768c3f8064b47
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
(cherry picked from commit 6c20e8c2aed05ad1a9d1b41cfdd875dc377db44c)
Reviewed-on: http://git-master/r/415637
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
arm: asm: relaxed.h: defined relaxed.h

Defined a new header file relaxed.h, which uses generic
definitions of some macros used by arm64 for improving
power efficiency.

bug 1440421

Change-Id: I654dcef609812e3bb54e6c892c1554f9cbb4bd3d
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/398766
(cherry picked from commit a96e59b1959f3ee216503b4f9df3cb75f7093ed6)
Reviewed-on: http://git-master/r/422211
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
cpufreq: add input-cfboost

Add a module which can be used alongside any cpufreq governor to
temporarily raise CPU frequency upon input events.

Change-Id: Id0c69e5c7194c0e27ec176787cdc076b461d749e
Signed-off-by: Michal Pecio <mpecio@nvidia.com>
Reviewed-on: http://git-master/r/122180
Reviewed-by: Satya Popuri <spopuri@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>

Rebase-Id: R427bcac22db4ffc04b1df133c07cc8bf2fdb0581

Conflicts:
	drivers/input/Kconfig
	drivers/input/Makefile

Conflicts:
	drivers/input/Makefile
input-cfboost: improve boost latency

Place a request for one online CPU core to eliminate a 70ms delay before
transition to the G-core on Tegra3.

Change-Id: Ie81f37c0b85a574d9f1432c67818bdd4c3436c9b
Signed-off-by: Michal Pecio <mpecio@nvidia.com>
Reviewed-on: http://git-master/r/122188
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>

Rebase-Id: Rab3671e4a3f14753cfd5a467a507ea76f551c96f
input-cfboost: monitor keypad & joystick events

Add signatures of keypad & joystick devices to id table so
as to provide cpu boost for events from those devices.

Bug 1229219

Change-Id: If5e9f2669e437808e26a66bb9cd8b4cbfe97c286
Signed-off-by: Yogish Kulkarni <yogishk@nvidia.com>
Reviewed-on: http://git-master/r/197968
(cherry picked from commit 1fc8b47ac04c0978d0a218ed30de0727c90529f3)
Reviewed-on: http://git-master/r/200775
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
input-cfboost: add trace points

Add trace points to log time stamp when the input event is received
and time at which boost work is scheduled. This is for detailed
profiling of touch latency.

Bug 1229219

Change-Id: I5f2f4f3d821d93b550fa9f86dc8fd562fa5d460a
Signed-off-by: Yogish Kulkarni <yogishk@nvidia.com>
Reviewed-on: http://git-master/r/197954
(cherry picked from commit 04f7d704a071ecf4fc1f70841d020c08e58fe563)
Reviewed-on: http://git-master/r/200783
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
input: cfboost: Fix pm_qos_add_request

cf_core is used to set how many cpu cores to be brought
online. The pm_qos_class is set to be the wrong value.
Change it from PM_QOS_CPU_FREQ_MIN to PM_QOS_MIN_ONLINE_CPUS.

Change-Id: I0905ef1afbc2bc3724367e6d6e69da3dcc566632
Signed-off-by: Xiaohui Tao <xtao@nvidia.com>
(cherry picked from commit 78e77f377560188d57a894146c57425cc809bb60)
Signed-off-by: Yogish Kulkarni <yogishk@nvidia.com>
Reviewed-on: http://git-master/r/266160
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mitch Luban <mluban@nvidia.com>
input: cfboost: Add module parameter callback

Cancel PM QoS request upon frequency changing to zero.

Change-Id: Ie6bba1eb3f3177751449d53d9237e021140edf82
Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
Reviewed-on: http://git-master/r/280744
(cherry picked from commit 8623a52d17f0e0788d393fbc4e8a9b2987ae492d)
Reviewed-on: http://git-master/r/298662
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
input-cfboost: use RT kthread for PM QoS request

It has been observed that input drivers worker thread gets scheduled
before boost worker thread, specifically in case of Raydium touch.
The delayed scheduling of boost works adds to first touch latency
when cpu is idle and running at lower clock rate. Hence use RT
kthread for fast scheduling of boost work. Thread Priority is set to
MAX_RT_PRIO-10 so that the highest RT priority level is left for
EMC DVFS.

Bug 1245419
Bug 1229219
Bug 1364240

Change-Id: I342161532a7b8407d1ecfad29710e13a47331bff
Signed-off-by: Yogish Kulkarni <yogishk@nvidia.com>
Reviewed-on: http://git-master/r/249716
(cherry picked from commit 851e0df306161be573b1a94c6eb3fdfdb5107167)
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/288807
Reviewed-by: Automatic_Commit_Validation_User
input: cfboost: Add GPU wake-up

Add interface for registering a GPU device. Whenever touch event is
received, ask the domain not to be powered off.

Bug 1364240

Change-Id: I2e61b6969ecdf89dcf00f57565eefdf0a93b3acd
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/288809
Reviewed-by: Automatic_Commit_Validation_User
input: cfboost: Update raydium touch evbit

New raydium driver code sets BTN_TOOL_RUBBER
instead of BTN_TOUCH. This failed the input
handler event matching. Updated code to handle
this change.

Bug 1408316
Bug 1408317
Bug 1408322

Signed-off-by: Vikas Jain <vjain@nvidia.com>

Change-Id: If37af3d2f51d4f25b25f9b9c9ceda51f379e489a
Reviewed-on: http://git-master/r/350668
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Vikas Jain <vjain@nvidia.com>
Tested-by: Vikas Jain <vjain@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Antti Miettinen <amiettinen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
input: cfboost: Export symbols

The GPU driver needs to register itself to the cfboost framework
despite it can be compiled as a module. This patch adds necessary
exports to the cfboost driver.

Bug 1476801

Change-Id: Ia0be866eeb13aa3d561bcc88dc24bcda76c48b51
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/387608
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
input: cfboost: Explicitly turn on the GPU

Currently we inform the QoS that the GPU should be powered, however,
we need to also restore the state of the GPU. This patch adds explicit
pm_runtime_get/put_autosuspend() calls to ensure that the GPU is really
initialised immediately.

Bug 1506585

Change-Id: I1f08ca072f4a7ef038bb4e8e12323846480c6a12
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/403770
(cherry-picked from commit 22665ef35d4d70dda8763d83ad866bc4b145fd11)
Reviewed-on: http://git-master/r/405231
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
cfboost: Boost on MSC_ACTIVITY and any ABS

Modifies cfboost to trigger on EV_MSC=MSC_ACTIVITY and any EV_ABS. Also added
a timeout between boosts equal to half the boost duration since it will be
getting a lot more events now. This makes cfboost more resilient to touch
driver changes.

Bug 1509022

Change-Id: I734cdce22b6a1f65466924a92768c2afd4992960
Reviewed-on: http://git-master/r/404285
Reviewed-on: http://git-master/r/404023
Signed-off-by: Donghan Ryu <dryu@nvidia.com>
Reviewed-on: http://git-master/r/406498
Reviewed-by: Riham Haidar <rhaidar@nvidia.com>
Tested-by: Riham Haidar <rhaidar@nvidia.com>
input: cfboost: Add EMC boost

Change-Id: Id9b7ea216b8c93e291cc95d7522ba21d15701eeb
Reviewed-on: http://git-master/r/397838
Signed-off-by: Donghan Ryu <dryu@nvidia.com>
Reviewed-on: http://git-master/r/402485
Reviewed-by: Riham Haidar <rhaidar@nvidia.com>
Tested-by: Riham Haidar <rhaidar@nvidia.com>
cfboost: add boost_cpus

cfboost might want to change the number of min online cpus.
This change adds a new nodes for that.

Bug 1385013

Change-Id: I69aaa1eb93298f3c8413a77ca5cb2fbe39bb345c
Reviewed-on: http://git-master/r/404690
Signed-off-by: Donghan Ryu <dryu@nvidia.com>
Reviewed-on: http://git-master/r/409699
Reviewed-by: Riham Haidar <rhaidar@nvidia.com>
Tested-by: Riham Haidar <rhaidar@nvidia.com>
cfboost: initialize boost values to 0

boost_freq, boost_emc and boost_cpus should be 0
initially if these parameters are not set.

Bug 1385013

Change-Id: I39a6e1f216eb109915ec0f9bc2cb9f2456fdcaef
Reviewed-on: http://git-master/r/406475
Signed-off-by: Donghan Ryu <dryu@nvidia.com>
Reviewed-on: http://git-master/r/409700
Reviewed-by: Riham Haidar <rhaidar@nvidia.com>
Tested-by: Riham Haidar <rhaidar@nvidia.com>
input: cfboost: disable gpu_wakeup by default

gpu_wakeup causes the GPU to load its firmware, but the partition it's
stored on is not always available.  Instead default to 0; init.rc can
set it 1 after the needed partition is mounted.

Bug: 16777410

Change-Id: I9b03f62c25e491b230f1385e5b0c66fdf4789b63
Signed-off-by: Greg Hackmann <ghackmann@google.com>
PM / QoS: Add return code to pm_qos_get_value function.

pm_qos_get_value don't return a return code in all cases. It's sure that
anything interesting happend after BUG() but this prevent any compilation
warning.

[rjw: Chaneged the new return value to PM_QOS_DEFAULT_VALUE.]

Signed-off-by: Luis Gonzalez Fernandez <luisgf@gmail.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>