flo: Enable cpu-boost driver

Signed-off-by: Zhao Wei Liew <zhaoweiliew@gmail.com>
build.sh: Make boot images more differentiable

Signed-off-by: Zhao Wei Liew <zhaoweiliew@gmail.com>
ramdisk: Configure interactive and cpu-boost driver

Signed-off-by: Zhao Wei Liew <zhaoweiliew@gmail.com>
msm: kgsl: Fix policy sysfs implementation

When switching to another governor, the pwrscale kobject will be deleted
and sysfs_create_group fails due to the uninitialized kobj. This patch
deletes the kobject before attaching the file group.

[   36.270044] [<c0134304>] (__kmalloc_track_caller+0x80/0x194) from [<c010a6d0>] (kstrdup+0x2c/0x54)
[   36.270166] [<c010a6d0>] (kstrdup+0x2c/0x54) from [<c019cc98>] (create_dir+0x24/0x204)
[   36.270257] [<c019cc98>] (create_dir+0x24/0x204) from [<c019d154>] (sysfs_create_subdir+0x24/0x2c)
[   36.270318] [<c019d154>] (sysfs_create_subdir+0x24/0x2c) from [<c019e878>] (sysfs_create_group+0x40/0x1d8)
[   36.270441] [<c019e878>] (sysfs_create_group+0x40/0x1d8) from [<c0389e40>] (kgsl_pwrscale_policy_add_files+0x44/0x68)
[   36.270563] [<c0389e40>] (kgsl_pwrscale_policy_add_files+0x44/0x68) from [<c038e714>] (conservative_init+0xc/0x18)
[   36.270654] [<c038e714>] (conservative_init+0xc/0x18) from [<c0389c6c>] (pwrscale_policy_store+0xcc/0x154)
[   36.270776] [<c0389c6c>] (pwrscale_policy_store+0xcc/0x154) from [<c0389a90>] (pwrscale_sysfs_store+0x20/0x2c)
[   36.270868] [<c0389a90>] (pwrscale_sysfs_store+0x20/0x2c) from [<c019b2a4>] (sysfs_write_file+0x168/0x198)
[   36.270990] [<c019b2a4>] (sysfs_write_file+0x168/0x198) from [<c01382c4>] (vfs_write+0x9c/0x170)
[   36.271112] [<c01382c4>] (vfs_write+0x9c/0x170) from [<c0138440>] (sys_write+0x38/0x70)
[   36.271173] [<c0138440>] (sys_write+0x38/0x70) from [<c000f000>] (ret_fast_syscall+0x0/0x30)
[   36.271265] Code: e7925001 e3550000 0a000033 e5942014 (e795a002)
[   36.271661] ---[ end trace ef0d8b9c8acc7bbb ]---
ramdisk: Disable FSync and software CRCs, enable fast charge AC

Signed-off-by: Zhao Wei Liew <zhaoweiliew@gmail.com>
decompressor: add LZ4 decompressor module

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

Benchmark Results(PATCH v3)
Compiler: Linaro ARM gcc 4.6.2

1. ARMv7, 1.5GHz based board
   Kernel: linux 3.4
   Uncompressed Kernel Size: 14MB
        Compressed Size  Decompression Speed
   LZO  6.7MB            20.1MB/s, 25.2MB/s(UA)
   LZ4  7.3MB            29.1MB/s, 45.6MB/s(UA)

2. ARMv7, 1.7GHz based board
   Kernel: linux 3.7
   Uncompressed Kernel Size: 14MB
        Compressed Size  Decompression Speed
   LZO  6.0MB            34.1MB/s, 52.2MB/s(UA)
   LZ4  6.5MB            86.7MB/s
- UA: Unaligned memory Access support
- Latest patch set for LZO applied

This patch set is for adding support for LZ4-compressed Kernel.  LZ4 is a
very fast lossless compression algorithm and it also features an extremely
fast decoder [1].

But we have five of decompressors already and one question which does
arise, however, is that of where do we stop adding new ones?  This issue
had been discussed and came to the conclusion [2].

Russell King said that we should have:

 - one decompressor which is the fastest
 - one decompressor for the highest compression ratio
 - one popular decompressor (eg conventional gzip)

If we have a replacement one for one of these, then it should do exactly
that: replace it.

The benchmark shows that an 8% increase in image size vs a 66% increase
in decompression speed compared to LZO(which has been known as the
fastest decompressor in the Kernel).  Therefore the "fast but may not be
small" compression title has clearly been taken by LZ4 [3].

[1] http://code.google.com/p/lz4/
[2] http://thread.gmane.org/gmane.linux.kbuild.devel/9157
[3] http://thread.gmane.org/gmane.linux.kbuild.devel/9347

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>
Signed-off-by: Yann Collet <yann.collet.73@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib: add support for LZ4-compressed kernel

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

Signed-off-by: Kyungsik Lee <kyungsik.lee@lge.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Florian Fainelli <florian@openwrt.org>
Cc: Yann Collet <yann.collet.73@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arm: add support for LZ4-compressed kernel

Integrates the LZ4 decompression code to the arm pre-boot code.

Signed-off-by: Kyungsik Lee <kyungsik.lee@lge.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Florian Fainelli <florian@openwrt.org>
Cc: Yann Collet <yann.collet.73@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Conflicts:
	arch/arm/Kconfig
	arch/arm/boot/compressed/Makefile
	arch/x86/boot/compressed/Makefile
lz4: fix compression/decompression signedness mismatch

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 *".

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Kyungsik Lee <kyungsik.lee@lge.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Yann Collet <yann.collet.73@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lz4: ensure length does not wrap

Given some pathologically compressed data, lz4 could possibly decide to
wrap a few internal variables, causing unknown things to happen.  Catch
this before the wrapping happens and abort the decompression.

Reported-by: "Don A. Bailey" <donb@securitymouse.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lz4: fix another possible overrun

There is one other possible overrun in the lz4 code as implemented by
Linux at this point in time (which differs from the upstream lz4
codebase, but will get synced at in a future kernel release.)  As
pointed out by Don, we also need to check the overflow in the data
itself.

While we are at it, replace the odd error return value with just a
"simple" -1 value as the return value is never used for anything other
than a basic "did this work or not" check.

Reported-by: "Don A. Bailey" <donb@securitymouse.com>
Reported-by: Willy Tarreau <w@1wt.eu>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lz4: add overrun checks to lz4_uncompress_unknownoutputsize()

Jan points out that I forgot to make the needed fixes to the
lz4_uncompress_unknownoutputsize() function to mirror the changes done
in lz4_decompress() with regards to potential pointer overflows.

The only in-kernel user of this function is the zram code, which only
takes data from a valid compressed buffer that it made itself, so it's
not a big issue.  But due to external kernel modules using this
function, it's better to be safe here.

Reported-by: Jan Beulich <JBeulich@suse.com>
Cc: "Don A. Bailey" <donb@securitymouse.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ramdisk: Disable setting of ondemand governor

PowerHAL communicates with ondemand governor
to raise minimum frequency to 1 GHz on touch.
After setting to interactive governor, PowerHAL
no longer communicates and thus min frequency
will be stuck at 1 GHz.

Signed-off-by: Zhao Wei Liew <zhaoweiliew@gmail.com>
ramdisk: Disable both PowerHALs

Signed-off-by: Zhao Wei Liew <zhaoweiliew@gmail.com>
lib/lz4: correct the LZ4 license

The LZ4 code is listed as using the "BSD 2-Clause License".

Signed-off-by: Richard Laager <rlaager@wiktel.com>
Acked-by: Kyungsik Lee <kyungsik.lee@lge.com>
Cc: Chanho Min <chanho.min@lge.com>
Cc: Richard Yao <ryao@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
[ The 2-clause BSD can be just converted into GPL, but that's rude and
  pointless, so don't do it   - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Conflicts:
	lib/lz4/lz4_compress.c
	lib/lz4/lz4hc_compress.c
flo: Compress kernel with LZ4

Signed-off-by: Zhao Wei Liew <zhaoweiliew@gmail.com>