auto_hotplug.c: ditch NVIDIA's load averaging usage on this driver - according to @thalamus its not cheaper than his original implementation.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
drivers: gpu: use original ringbuffer code to average cpu load - using cpu load to ramp GPU frequencies is not great, but it should work for now until I find a better way to account for GPU stress.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
drivers: gpu: fix second condition thresholds for GPU ramps.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
drivers: gpu: we don't want it to be calling the clk_set_rate all the time if the avg_running is within the if-else conditions. This should reduce some overhead in the GPU driver from my initial code.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
auto_hotplug.c: since we're sampling for longer periods and in 100ms rates this can be a little lower if one needs the performance.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Prevent MSM_RUN_QUEUE_STATS to be automatically set on compilation because its useless to us.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
drivers: thermal: properly limit CPU frequency when the temperature is too hot: if we throttle too much games will lag so we'll only scale down to 1026MHz until the device cools down, then back to 1512MHz again. Added other smaller routine changes to make it work properly.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Revert "drivers: gpu: we don't want it to be calling the clk_set_rate all the time if the avg_running is within the if-else conditions. This should reduce some overhead in the GPU driver from my initial code."

This reverts commit 0703fa8fdebbffd08a9c3c913ceb2dcc1e10f489.
Revert "drivers: gpu: fix second condition thresholds for GPU ramps."

This reverts commit 3bcf43f66a1351f3153272a3d73f90da91c0585d.
Revert "drivers: gpu: use original ringbuffer code to average cpu load - using cpu load to ramp GPU frequencies is not great, but it should work for now until I find a better way to account for GPU stress."

This reverts commit 276416bb2d74e0b8a23bbcd12c6b519a7b158f32.
Revert "drivers: gpu: change pwrctrl routines to scale better and more according CPU load - testing at the moment, might be working, might not"

This reverts commit d1c91aac845abcfb4e7ca3844b6c212520e44b43.
Revert "Fix derp from latest commit."

This reverts commit 2a459c65e75205f71f77e4f26bb9479e5948d195.
Revert "arm: Move to upstream udelay via timer implementation"

This reverts commit 1bacb4f838661d042207c9186870f0b3586fab05.
Revert "binfmt_elf.c: use get_random_int() to fix entropy depleting. Original commit: https://patchwork.kernel.org/patch/1745611/"

This reverts commit d8620109360bb51ddc4a7759cd70f48c01a3ab68.
Revert "auto_hotplug.c: this device boots up faster than any other so we can start the hotplug works sooner - sometimes the previous 20 seconds timer started exactly when I started to swipe the App Drawer after the device was booted and that would create a 1 time lag and that was annoying every time I rebooted. Should be ok now."

This reverts commit 5dea4777e62df79833e33de2cd7a3507635b714e.
auto_hotplug.c: since the sampling rate was adjusted a few patches ago I never got to update the timers in the delayed works to be according the new rate and the more sampling periods. Should be more snappy now when the device needs the extra processing power, without sacrificing battery. Also added contact info in the top of the file and more info regarding OMAP4460.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
USB: Allow skipping device resume during system resume.

Some buses would like to keep their devices in suspend state during system
resume.  For example HSIC controller driver prevent system suspend when
HSIC device is active.  If this device is resumed, during system resume
HSIC controller acquire wake lock and prevent the subsequent suspend till
HSIC device is auto suspended.

CRs-Fixed: 403975
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
(cherry picked from commit 6f199aa800253a69e5679d1057823039f1bd65c9)

Change-Id: Ic8ab631ec1f15685cc35823aa7c57d699738d5fc
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
USB: Prevent system suspend when HSIC device is active

Some buses like HSIC would like to keep device in suspend state
after system resume.  The remote wakeup or interface activity
later will auto resume the device.  This will work only if the
device is auto suspended before system suspend.  If the device
runtime state had been active during system suspend and system
suspend routine put the device in suspend, it will not be resumed
during system resume.  When remote wakeup happen for this device,
the runtime resume will not bring the device to active as runtime
core think it is already active.

The HSIC bus ensure that device is auto suspended prior to system
suspend by holding a wakelock till the bus is suspended.  HSIC bus
is not handling the case where device is auto resumed immediately
after system suspend begins.  HSIC bus simply put the device into
suspend in system suspend routine.

This patch fixes above issue by returning an error code if the device
is not auto suspended during system suspend.  Also add a safe guard
check in HSIC system resume routine to skip device resume only if it
is auto suspended prior to system suspend.

(cherry picked from commit 41d004c4eaa5565cb8d9113862c3cef1e51be648)
CRs-Fixed: 422876

Change-Id: I07063d1fe2ef054adc5c593691d417272e66221e
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
sync: Fix race condition between merge and signal

The copied sync_pt was activated immediately. If the sync_pt was
signaled before the entire merge was completed, the new fence's pt_list
could be iterated over while it is still in the process of being
created.

Moving the the sync_pt_activate call for all new sync_pts to after both
the sync_fence_copy_pts and the sync_fence_merge_pts calls ensure that
the pt_list is complete and immutable before it can be reached from the
timeline's active list.

Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
cgroup: Take css_set_lock from cgroup_css_sets_empty()

As indicated in the comment above cgroup_css_sets_empty it needs the
css_set_lock. But neither of the 2 call points have it, so rather then fixing
the callers just take the lock inside cgroup_css_sets_empty().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Change-Id: If7aea71824f6d0e3f2cc6c1ce236c3ae6be2037b
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>