intelli_plug: clean port from faux's n5 kernel (squashed commits)

This is a combination of 21 commits.
The first commit's message is:

Revert previous intelli_plug porting attempt (squashed commits)

This is a combination of 3 commits
This is the first commit message:

Revert "intelliplug: dirty fix to allow build"

This reverts commit b5750e37dc3614f45e9078dd736b83cb47ca98b9.

This is the 2nd commit message:

Revert "intelliplug: update to latest version"

This reverts commit 550dc64ad8d83cde74d7c1634512f130220a1f91.

This is the 3rd commit message:

Revert "intelli_plug: intelligent hotplug cpu driver with eco mode"

This reverts commit 0a54f9cd26bb8ba6f9d9403c9e0c0a697975cfb5.

Conflicts:
	arch/arm/mach-msm/Kconfig

Change-Id: I6e18c9287dfaeabe91d5b4f5aab0cd09ffd5e6a2

Port intelli_plug hotplug driver from faux's n5 kernel (squashed commits)

This is a combination of 19 commits.
The first commit's message is:

intelli_plug: intelligent hotplug cpu driver with eco mode

Signed-off-by: Paul Reioux <reioux@gmail.com>

Conflicts:
	arch/arm/mach-msm/Kconfig
	arch/arm/mach-msm/Makefile

Change-Id: Idc3e94d1fdbb9076090b0e7c318c373f06c0c4fe

This is the 2nd commit message:

intelli_plug: tweak for faster wakeup from suspend

bump version to 1.1

Signed-off-by: faux123 <reioux@gmail.com>

This is the 3rd commit message:

intelli_plug: increase cores on persistence

also replace hardcoded values with Macros for ease of updating later

Signed-off-by: faux123 <reioux@gmail.com>

This is the 4th commit message:

intelli_plug: make it gcc-4.6.x eabi compatible :p

Signed-off-by: faux123 <reioux@gmail.com>

This is the 5th commit message:

intelli_plug: use rq_stats to help detect artificial or constant loads

benchmarks often create fake / artificial loads at a constant rate.  These
type of loads are not detected corectly by run average algorithms. Use
the run queue stats to help detect these cases and bring up the cores in
correspondence.

bump version to 1.2

Signed-off-by: faux123 <reioux@gmail.com>

This is the 6th commit message:

intelli_plug: use mp_decision() algorithm for core 3 and 4

This replaces the simplistic check for run queue thresholds with a more
sophisticate algorithm with time awareness

bump version to 1.3

Signed-off-by: faux123 <reioux@gmail.com>

This is the 7th commit message:

intelli_plug: tweak mp_decsion parameters and remove unused logic

Signed-off-by: faux123 <reioux@gmail.com>

This is the 8th commit message:

intelli_plug: bump threshold slightly for better response

Signed-off-by: faux123 <reioux@gmail.com>

This is the 9th commit message:

wip: intelli_plug: change logic for better benchmark performance

Signed-off-by: faux123 <reioux@gmail.com>

This is the 10th commit message:

intelli_plug: use mp_decision to reduce online persistence count for cores

this should bring down the cores faster when run queue is low
also optimized code a bit using local vars

Signed-off-by: faux123 <reioux@gmail.com>

This is the 11th commit message:

intelli_plug: disable by default

let the user enable via sysfs so it won't clash with mpdecision which is
enabled by default for qualcomm phones

Signed-off-by: faux123 <reioux@gmail.com>

This is the 12th commit message:

intelli_plug: slow down hotplug activity from 50ms to 200ms

this will reduce the hotplug chaos which may in turn save more power

Signed-off-by: faux123 <reioux@gmail.com>

Conflicts:
	arch/arm/mach-msm/intelli_plug.c

This is the 13th commit message:

intelli_plug: code clean up and minor bug fixes

bump to version 1.6

Signed-off-by: Paul Reioux <reioux@gmail.com>

This is the 14th commit message:

intelli_plug: add dynamic load sampling rate logic

Add dynamic sampling logic based on load. If load is high and required more
than 2 cores, increase the sampling rate for a duration of 3 seconds to help
manage the load better during this time.  Once duration expires, revert back
to lazier sampling rate for better batter performance.

Signed-off-by: Paul Reioux <reioux@gmail.com>

Conflicts:
	arch/arm/mach-msm/intelli_plug.c

Change-Id: I6890cc03b24fdd620dad4a746d0bde4e93619ac4

This is the 15th commit message:

intelli_plug: add new power_suspend PM driver

bump version to 1.9

Signed-off-by: Paul Reioux <reioux@gmail.com>

Conflicts:
	arch/arm/mach-msm/intelli_plug.c

Change-Id: Ia0aecd8c42c067d8b012152dd916b4e103548008

This is the 16th commit message:

intelli_plug: add touch input logic

changed intelli_plug sampling rates and bump to version 2.0

Signed-off-by: Paul Reioux <reioux@gmail.com>

This is the 17th commit message:

intelli_plug: use a context safe function call instead

Signed-off-by: Paul Reioux <reioux@gmail.com>

This is the 18th commit message:

intelli_plug: performance tune-up continued...

Signed-off-by: Paul Reioux <reioux@gmail.com>

This is the 19th commit message:

intelli_plug: switch to use dedicated high priority workqueue

from the shared global workqueue.  This should prevent hang ups while the
global workqueue is busy and cleaned up some logic issues.

give input boost its own workqueue

bump to version 2.2

Signed-off-by: Paul Reioux <reioux@gmail.com>

Conflicts:
	arch/arm/mach-msm/Kconfig
	arch/arm/mach-msm/intelli_plug.c
intelli_plug is OFF by default. + tuning
intelli_plug: fix some merge derps

Change-Id: Ieaa0ebc15cf5d54413dd99d1019927fb32286928
defconfig: enable intelli_plug

Change-Id: I79c47ec0a2301942b131b08f1d31b384ce5e155d
Import Alucard Hotplug by @Alucard24

Change-Id: Ie5644ab10811bd565f8b5fed4f9e8257e64db30d

Conflicts:
	arch/arm/mach-msm/Kconfig
	arch/arm/mach-msm/Makefile
Merged CPU GOVS + HotPlug Driver from @Alucard24 dear friend Thanks!

new GOVS

HYPER
PEGASUSQ
NIGHTMARE

and new Hotplug driver by alucard24 as OFF by default.

Conflicts:
	arch/arm/configs/dorimanx_d800_defconfig
	arch/arm/configs/dorimanx_d801_defconfig
	arch/arm/configs/dorimanx_d802_defconfig
	arch/arm/configs/dorimanx_d803_defconfig
	arch/arm/configs/dorimanx_ls980_defconfig
	arch/arm/configs/dorimanx_vs980_defconfig
	arch/arm/mach-msm/Kconfig
	arch/arm/mach-msm/Makefile
	arch/arm/mach-msm/alucard_hotplug.c
	drivers/cpufreq/Kconfig
	drivers/cpufreq/Makefile
	drivers/cpufreq/cpu-boost.c
	drivers/cpufreq/cpufreq.c
	drivers/cpufreq/cpufreq_ondemand.c
	include/linux/cpufreq.h

Change-Id: If941256bc9f3ddb6dff850e40ae5ff6ff5add85b

Conflicts:
	drivers/cpufreq/Kconfig
	drivers/cpufreq/Makefile
	drivers/cpufreq/cpufreq.c
	include/linux/cpufreq.h
cpufreq: uncapitalize hyper governor

Change-Id: I3caa105d9517ff15159d3584b01f7b85e78270ad
Alucard Hotlug: fix merge derps

Change-Id: Ia770020d35888cedd0b47297f197dea3754c6d19
defconfig: enable Alucard hotplug

Change-Id: I2509af1e06cfd1c93000e8526fb5fa6c9d0274a8
decompressor: Add LZ4 decompressor module

Date	Tue, 26 Feb 2013 15:24:27 +0900

This patch adds support for LZ4 decompression in the Linux Kernel.
LZ4 Decompression APIs for kernel are based on LZ4 implementation
by Yann Collet.

LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
LZ4 source repository : http://code.google.com/p/lz4/

Signed-off-by: Kyungsik Lee <kyungsik.lee@lge.com>

v2:
- Clean up code
- Enable unaligned access for ARM v6 and above with
  CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
- Add lz4_decompress() for faster decompression with
  uncompressed output size

Signed-off-by: Paul Reioux <reioux@gmail.com>
lib: Add support for LZ4-compressed kernel

Date	Tue, 26 Feb 2013 15:24:28 +0900

This patch adds support for extracting LZ4-compressed kernel images,
as well as LZ4-compressed ramdisk images in the kernel boot process.

This depends on the patch below
decompressor: Add LZ4 decompressor module

Signed-off-by: Kyungsik Lee <kyungsik.lee@lge.com>

v2:
- Clean up code
- Use lz4_decompress() for LZ4-compressed kernel during boot-process

Signed-off-by: Paul Reioux <reioux@gmail.com>
arm: Add support for LZ4-compressed kernel

Date	Tue, 26 Feb 2013 15:24:29 +0900

This patch integrates the LZ4 decompression code to the arm pre-boot code.
And it depends on two patchs below

lib: Add support for LZ4-compressed kernel
decompressor: Add LZ4 decompressor module

Signed-off-by: Kyungsik Lee <kyungsik.lee@lge.com>

v2:
- Apply CFLAGS, -Os to decompress.o to improve decompress
  performance during boot-up process

Signed-off-by: Paul Reioux <reioux@gmail.com>

Conflicts:

	arch/arm/boot/compressed/.gitignore
lib: Add lz4 compressor module

From	Chanho Min <>

This patch adds support for LZ4 compression in the Linux Kernel.
LZ4 Compression APIs for kernel are based on LZ4 implementation
by Yann Collet and changed with kernel coding style.

LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
LZ4 source repository : http://code.google.com/p/lz4/
svn revision : r90

Two APIs are added:
lz4_compress() support basic lz4 compression whereas lz4hc_compress() support
high compression or CPU performance get lower but compression ratio get higher.
Also, we require the pre-allocated working memory with the defined size and
destination buffer must be allocated with the size of lz4_compressbound.

Signed-off-by: Chanho Min <chanho.min@lge.com>

Signed-off-by: Paul Reioux <reioux@gmail.com>
crypto: Add lz4 Cryptographic API

From	Chanho Min <>

This patch adds support for lz4 and lz4hc compression algorithm
using the lib/lz4/* codebase.
Signed-off-by: Chanho Min <chanho.min@lge.com>

Signed-off-by: Paul Reioux <reioux@gmail.com>
lib/lz4/lz4_compress: fix macro usage error

Signed-off-by: Paul Reioux <reioux@gmail.com>
LZ4: compression/decompression signedness mismatch (v2)

LZ4 compression and decompression functions require different
in signedness input/output parameters: unsigned char for
compression and signed char for decompression.

Change decompression API to require "(const) unsigned char *".

v2: minor coding style fix.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

Signed-off-by: Paul Reioux <reioux@gmail.com>
GPU Simple Governor: adapt GPU Simple Governor for Snapdrgaon 800 SOCs

initial coding for a Simple GPU governor based on my own work 2 years ago
from Sensation GB kernel commit: c1ea8f6

Signed-off-by: Paul Reioux <reioux@gmail.com>

Conflicts:
	drivers/gpu/msm/kgsl_pwrscale_trustzone.c

Change-Id: Ib8619874e883e8042ab3d9215a12d9411ef18508
kgsl: Implement conservative scaling policy

This behaves similarly to the conservative cpufreq governor,
which is similar to how most Mali GPU scaling algorithms behave.

The "trustzone" policy that is default relies on an undocumented
black box to make scaling decisions.

How to enable:
echo conservative > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/policy

Conservative attr group:
/sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/policy_config/conservative

Polling interval (10-1000):
/sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/policy_config/conservative/polling_interval

Enable stats printing (causes microlags on low polling intervals):
echo 1 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/policy_config/conservative/print_stats

NOTE:
- perms are set to 666 for testing purposes

Change-Id: I9d854a73981515fc9850104302804928b04c4687
Signed-off-by: Andrew Dodd <atd7@cornell.edu>

Conflicts:

	drivers/gpu/msm/kgsl_pwrscale.c

Conflicts:
	drivers/gpu/msm/kgsl_pwrscale.c
	drivers/gpu/msm/kgsl_pwrscale.h
Simple GPU governor: fix a merge derp

Signed-off-by: Paul Reioux <reioux@gmail.com>
fs/dyn_sync_cntrl: dynamic sync control

The dynamic sync control interface uses new power_suspend interface

While screen is on, file sync is disabled
when screen is off, a file sync is called to flush all outstanding writes
and restore file sync operation as normal.

updated for 8974 kernels

Signed-off-by: Paul Reioux <reioux@gmail.com>

Conflicts:

	fs/Kconfig

Signed-off-by: DooMLoRD <metoo.mememe@gmail.com>