Sound Control: WCD9320: expose additional controls

Signed-off-by: Paul Reioux <reioux@gmail.com>
sound control 3.x: Initial GPL release for WCD9320 Audio Codec

This is first official GPL release based on my private implementation.

This release has been tested for xperia Z officially.  It may work
with other devices using the same WCD9320 Audio Codec as well, but not tested

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

Conflicts:

	sound/soc/codecs/Makefile
sound control: WCD9320: update speaker gain control for Z1

Signed-off-by: Paul Reioux <reioux@gmail.com>
board-8974: enable ram console

inspired from imoseyon/leanKernel-note3

https://github.com/imoseyon/leanKernel-note3/commit/222e2a5f749684aacf9a770f99a800f035efe7eb
gpio_keys: add flip cover wake/suspend event (arter97)

AOSP doesn't take care of flip covers.

Let make it aware from the kernel side.

gpio_keys: fix registration order

gpio-keys must be in /sys/class/input/input18,
flip_powerkey must be in /sys/class/input/input19

for device/samsung/hlte/power/power_ext.c to properly suspend GPIO_KEYS_POWER.

Re-order registration(flip_powerkey after gpio-keys).

 gpio_keys: return early when flip_cover == gpio_flip_cover

This prevents ghost turn-off or turn-on
when there really wasn't a flip-cover event changed,
but flip_cover_work() is just called.

To prevent this, compare ddata->flip_cover with gpio_get_value(ddata->gpio_flip_cover)
and proceed only on when those datas are different.

gpio_keys: fix typo during flip_powerkey registration
input_register_device() returns 1 on errors, not 0

gpio_keys: remove filesystem sync, dynamic fsync already handles this (Yank555.lu)

gpio_keys: add a semaphore so powerkey action never happen more than once at the same time (Yank555.lu)

- use shorter delay between press & release
mm/swap: fix race on swap_info reuse between swapoff and swapon

Date	Thu, 09 Jan 2014 13:39:55 +0800

swapoff clear swap_info's SWP_USED flag prematurely and free its resources
after that. A concurrent swapon will reuse this swap_info while its previous
resources are not cleared completely.

These late freed resources are:
- p->percpu_cluster
- swap_cgroup_ctrl[type]
- block_device setting
- inode->i_flags &= ~S_SWAPFILE

This patch clear SWP_USED flag after all its resources freed, so that swapon
can reuse this swap_info by alloc_swap_info() safely.

Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
Signed-off-by: Paul Reioux <reioux@gmail.com>
mm/zswap: fix compilation issue
zswap: use LZ4 if available

Signed-off-by: Paul Reioux <reioux@gmail.com>
ARM: add support for kernel mode NEON

In order to safely support the use of NEON instructions in
kernel mode, some precautions need to be taken:
- the userland context that may be present in the registers (even
  if the NEON/VFP is currently disabled) must be stored under the
  correct task (which may not be 'current' in the UP case),
- to avoid having to keep track of additional vfpstates for the
  kernel side, disallow the use of NEON in interrupt context
  and run with preemption disabled,
- after use, re-enable preemption and re-enable the lazy restore
  machinery by disabling the NEON/VFP unit.

This patch adds the functions kernel_neon_begin() and
kernel_neon_end() which take care of the above. It also adds
the Kconfig symbol KERNEL_MODE_NEON to enable it.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
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>
sched: scale cpu load for judgment of group imbalance

Date	Mon, 17 Jun 2013 21:00:24 +0800

We cannot compare two load directly from two cpus, since the cpu power
over two cpu may vary largely.

Suppose we meet such two kind of cpus.
CPU A:
	No real time work, and there are 3 task, with rq->load.weight
being 512.
CPU B:
	Has real time work, and it take 3/4 of the cpu power, which
makes CFS only take 1/4, that is 1024/4=256 cpu power. And over its CFS
runqueue, there is only one task with weight as 128.

Since both cpu's CFS task take for half of the CFS's cpu power, it
should be considered as balanced in such case.

But original judgment like:
        if ((max_cpu_load - min_cpu_load) >= avg_load_per_task &&
            (max_nr_running - min_nr_running) > 1)
It makes (512-128)>=((512+128)/4), and lead to imbalance conclusion...
Make the load as scaled, to avoid such case.

Signed-off-by: Lei Wen <leiwen@marvell.com>

modified for Mako kernel from LKML reference
Signed-off-by: Paul Reioux <reioux@gmail.com>
scheduler: Re-compute time-average nr_running on read

Re-compute time-average nr_running when it is read. This would
prevent reading stalled average value if there were no run-queue
changes for a long time. New average value is returned to the reader,
but not stored to avoid concurrent writes. Light-weight sequential
counter synchronization is used to assure data consistency for
re-computing average.

Change-Id: I8e4ea1b28ea00b3ddaf6ef7cdcd27866f87d360b
Signed-off-by: Alex Frid <afrid@nvidia.com>
(cherry picked from commit 527a759d9b40bf57958eb002edd2bb82014dab99)
Reviewed-on: http://git-master/r/111637
Reviewed-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Tested-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

forward ported to Linux 3.4 for use on Mako

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

Conflicts:

	kernel/sched/sched.h
arm/crypto: Add optimized AES and SHA1 routines

Add assembler versions of AES and SHA1 for ARM platforms.  This has provided
up to a 50% improvement in IPsec/TCP throughout for tunnels using AES128/SHA1.

Platform   CPU SPeed    Endian   Before (bps)   After (bps)   Improvement

IXP425      533 MHz      big     11217042        15566294        ~38%
KS8695      166 MHz     little    3828549         5795373        ~51%

Signed-off-by: David McCullough <ucdevel@gmail.com>
Signed-off-by: faux123 <reioux@gmail.com>
Optimized ARM RWSEM algorithm

RWSEM implementation for ARM using atomic functions.
Heavily based on arch/sh/include/asm/rwsem.h

Signed-off-by: Ashwin Chaugule <ashwinc@codeaurora.org>
LED eXtended ConTRoLs v1.1 (Yank555.lu)

  - Fixes Samsung LED pattern not repecting the user changes

 * SysFs interface :
 *
 * /sys/class/sec/led/led_intensity : 0 - 255 (100 = stock)
 *
 *     Set the relative intensity of the LED respecting the userspace's request
 *
 * /sys/class/sec/led/led_speed_on  : 1 - 5 (1 = stock)
 *
 *     Devider for delayon  (1 - 5 times shorter than requested by userspace)
 *
 * /sys/class/sec/led/led_speed_off  : 1 - 5 (1 = stock)
 *
 *     Devider for delayoff (1 - 5 times shorter than requested by userspace)
 *
 * /sys/class/sec/led/led_xctrl_version :
 *
 *     Display the current version of the eXtended ConTRoLs
 *
 * /sys/class/sec/led/led_xctrl_info :
 *
 *     Display the current settings in human readable format

LED eXtended ConTRoLs v1.0 (Yank555.lu)

 - Allow for customized brightness and delayon / delayoff control by user

 * SysFs interface :
 * -----------------
 *
 * /sys/class/sec/led/led_intensity : 0 - 255 (100 = stock)
 *
 *     Set the relative intensity of the LED respecting the userspace's request
 *
 * /sys/class/sec/led/led_speed_on  : 1 - 5 (1 = stock)
 *
 *     Devider for delayon  (1 - 5 times shorter than requested by userspace)
 *
 * /sys/class/sec/led/led_speed_off  : 1 - 5 (1 = stock)
 *
 *     Devider for delayoff (1 - 5 times shorter than requested by userspace)
 *
 * /sys/class/sec/led/led_xctrl_version :
 *
 *     Display the current version of the eXtended ConTRoLs
 *
 * /sys/class/sec/led/led_xctrl_info :
 *
 *     Display the current settings in human readable format
fs/dyn_sync_cntrl: dynamic sync control v1.5 (faux123)

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>;

fs/dyn_sync_cntrl: keep dynamic sync control off by default (Yank555.lu)
char-random: increase default entropy settings to (512,2048)
Asynchronous Fsync: initial extraction of Async Fsync from HTC

Signed-off-by: Paul Reioux <reioux@gmail.com>
Forced Fast Charge for Samsung Note 3 v1.1 by Yank555.lu

- redone fast charge for new KK kernel sourcedrop

SysFS interface :

 * /sys/kernel/fast_charge/force_fast_charge (rw)
 *
 *   0 - disabled (default)
 *   1 - substitute AC to USB
 *   2 - use custom mA configured through sysfs interface (see below)
 *
 * /sys/kernel/fast_charge/ac_charge_level (rw)
 *
 *   rate at which to charge when on AC (1.0A/h to 2.1A/h)
 *
 * /sys/kernel/fast_charge/usb_charge_level (r/w)
 *
 *   rate at which to charge when on USB (0.460A/h to 1.0A/h)
 *
 * /sys/kernel/fast_charge/failsafe (rw)
 *
 *   0 - disabled - allow anything up to 2.1A/h to be used as AC / USB custom current
 *   1 - enabled  - behaviour as described above (default)
 *
 * /sys/kernel/fast_charge/ac_levels (ro)
 *
 *   display available levels for AC (for failsafe enabled mode)
 *
 * /sys/kernel/fast_charge/usb_levels (ro)
 *
 *   display available levels for USB (for failsafe enabled mode)
 *
 * /sys/kernel/fast_charge/version (ro)
 *
 *   display fast charge version information
 *
 * /sys/kernel/fast_charge/info (ro)
 *
 *   display complete fast charge configuration in human readable format

Credits to Chad Froebel <chadfroebel@gmail.com> for the base idea.