regulator: core: if voltage scaling fails, restore original voltage values

Change-Id: I6f41096966aa5e5f9d834049ca9b2ae2d8156285
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Tested-by: Robert Nelson <robertcnelson@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Git-commit: 92d7a55879c01b30349045501108e775655a4b92
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[keliu@codeaurora.org: resolve merge conflicts]
Signed-off-by: Ke Liu <keliu@codeaurora.org>

Signed-off-by: Dan Trifan <jimsth@gmail.com>
android/lowmemorykiller: Account for total_swapcache_pages

The lowmemorykiller relies on NR_FILE_PAGES when measureing
the amount of reclaimable memory in the system.
However when swap is enabled swap cache pages are counted
in NR_FILE_PAGES, and swap cache pages aren't as reclaimable
in low memory as file cache pages. Therefore a large swap
cache can result in the lowmemorykiller not running and
an OOM occuring.

In order to ensure the lowmemorykiller properly evaluates the
amount of reclaimable memory don't count the swap cache pages.

Change-Id: I38239283e572f814b277c718eaf6be7f92abacbb
Signed-off-by: Liam Mark <lmark@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
lowmemorykiller: sysfs node and notifications

Create node "/sys/kernel/mm/lowmem_notify/notify_trigger_active",
on which an userspace application can poll for notification when
the number of free physical memory pages in the system falls below
a set threshold. The threshold is set by the new module parameter
"/sys/module/lowmemorykiller/parameters/notify_trigger".
The threshold should be typically set to be higher than the largest
free pages value in /sys/module/lowmemorykiller/parameters/minfree,
so that notification happens before any processes get killed.

Change-Id: Iccb2d1ff699e34b2c22687997e428eec27787b82
Signed-off-by: Bhargav Gurappadi <bhargavg1@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
android: lowmemorykiller: notify_trigger_active compatibility

Rename the "/sys/kernel/mm/lowmem_notify/notify_trigger_active" sysfs node
to "/sys/kernel/mm/lowmemorykiller/notify_trigger_active" to present the same
interface used by older kernels.

Change-Id: I49533fa005c965f5a4d6bd2f771e0f7ddfb1a8f3
Signed-off-by: Michael Vines <mvines@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM: devfreq: Fixup device transition and usage statistics

Ignore bogus data during slumber in transition and usage stats that
rendered the output basically useless. Also fix the reported GPU
frequency.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM: devfreq: Use high priority workqueue

It does not make sense to run kgsl on high and devfreq on regular
priority.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM: devfreq: Adapt devfreq_get_freq_level to cpubw requirements

Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM / devfreq: Rewrite devfreq_update_status() to fix multiple bugs

The current devfreq_update_status() has the following bugs:
- When the new frequency doesn't have a valid level, the time spent in the
  new frequency is counted towards the next valid frequency switch instead
  of being ignored.
- The time spent on the previous frequency is added to the new frequency's
  stats instead of the previous frequency's stats.

This patch fixes all of this.

Change-Id: I7bbdafca78d1565cdbf815356556fe6d6cca9e3f
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
PM / devfreq: Check for GPU busy time before sending the sample

Sometimes GPU busy time is very low during sampling. Accumulate
the statistics and send them with the next sample.

Change-Id: I77e568b48afc3a4922c7c341d9478705b7ae3a30
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
lowmemorykiller: Account for highmem during kswapd reclaim

Currenlty most memory reclaim is done through kswapd.
Since kswapd uses a gfp mask of GFP_KERNEL, and because
the lowmemorykiller is zone aware, the lowmemorykiller will
ignore highmem most of the time.
This results in the lowmemorykiller being overly aggressive.

The fix to this issue is to allow the lowmemorykiller to
count highmem when being called by the kswapd if the lowmem
watermarks are satisfied.

Change-Id: I938644584f374763d10d429d835e74daa4854a38
Signed-off-by: Liam Mark <lmark@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>