samsung-battery: Reduce battery-monitor wakelock timeouts

Idea by AndreiLux
block: SIO scheduler (tweaked)

credits to Gokhanmoral and Andreilux
block: ROW scheduler v4

The ROW I/O scheduler gives priority to READ requests over the WRITE requests when dispatching, without starving WRITE requests. Requests are kept in priority queues. Dispatching is done in a RR manner when the dispatch quantum for each queue is calculated according to queue priority.

Most suitable for mobile devices.

Source : https://patchwork.kernel.org/patch/1862271/

Signed-off-by: andip71 <andreasp@gmx.de>
block: Add Zen scheduler
Remove debug logging for some drivers:

- touchscreen
- modem
- max77686
- sec_watchdog
tcp: Proportional Rate Reduction for TCP

credits to faux123
mmc-core: Increase timeout limits to improve when using bad sd cards

credits to AndreiLux
mmc/core: disable crc to improve performance
random: increase entropy levels (both read and write)
cpufreq: intelliactive: initial coding and introduction!

intelliactive is based on Latest Google Interactive cpufreq governor from
Google.  The original Interactive provides smooth UI operations but suffers
slight battery drain due to its aggressive policies.  Intelliactive is an
improvement built on top of it.

It has the following enhancements added:
1. self-boost capability from input drivers (no need for PowerHAL assist)
2. two phase scheduling (idle/busy phases to prevent from jumping directly to
   max freq
3. Checks for offline cpus and short circuits some unnecessary checks to
   improve code execution paths
4. removed trace calls

All credits to Faux123

intelliactive: fix race condition when unregistering input handlers

Conflicts:
	drivers/cpufreq/Kconfig
	drivers/cpufreq/Makefile
intelliactive: backport to Linux 3.0.x / Linux 3.1.x kernels

Signed-off-by: Paul Reioux <reioux@gmail.com>
cpuidle-exynos4: Remove debug logging
n_tty: Fix n_tty_write crash when echoing in raw mode

The tty atomic_write_lock does not provide an exclusion guarantee for
the tty driver if the termios settings are LECHO & !OPOST.  And since
it is unexpected and not allowed to call TTY buffer helpers like
tty_insert_flip_string concurrently, this may lead to crashes when
concurrect writers call pty_write. In that case the following two
writers:
* the ECHOing from a workqueue and
* pty_write from the process
race and can overflow the corresponding TTY buffer like follows.

If we look into tty_insert_flip_string_fixed_flag, there is:
  int space = __tty_buffer_request_room(port, goal, flags);
  struct tty_buffer *tb = port->buf.tail;
  ...
  memcpy(char_buf_ptr(tb, tb->used), chars, space);
  ...
  tb->used += space;

so the race of the two can result in something like this:
              A                                B
__tty_buffer_request_room
                                  __tty_buffer_request_room
memcpy(buf(tb->used), ...)
tb->used += space;
                                  memcpy(buf(tb->used), ...) ->BOOM

B's memcpy is past the tty_buffer due to the previous A's tb->used
increment.

Since the N_TTY line discipline input processing can output
concurrently with a tty write, obtain the N_TTY ldisc output_lock to
serialize echo output with normal tty writes.  This ensures the tty
buffer helper tty_insert_flip_string is not called concurrently and
everything is fine.

Note that this is nicely reproducible by an ordinary user using
forkpty and some setup around that (raw termios + ECHO). And it is
present in kernels at least after commit
d945cb9cce20ac7143c2de8d88b187f62db99bdc (pty: Rework the pty layer to
use the normal buffering logic) in 2.6.31-rc3.

js: add more info to the commit log
js: switch to bool
js: lock unconditionally
js: lock only the tty->ops->write call

References: CVE-2014-0196
Reported-and-tested-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.4: output_lock is a member of struct tty_struct]

Change-Id: I9530780b811e0ce9b0216e943822210b3131a8d6
slub.c: little tweak for performance improvements
lowmemorykiller: Lower default debug_level
sched_fair: Reduce latencies
writeback: Fix occasional slow sync

In case when system contains no dirty pages, wakeup_flusher_threads()
will submit WB_SYNC_NONE writeback for 0 pages so wb_writeback() exits
immediately without doing anything. Thus sync(1) will write all the
dirty inodes from a WB_SYNC_ALL writeback pass which is slow.

Fix the problem by using get_nr_dirty_pages() in
wakeup_flusher_threads() instead of calculating number of dirty pages
manually. That function also takes number of dirty inodes into account.
mach-exynos: Don't compile unused 4210 objects on 4x12
mali: update driver from r3p2 rel3 to r3p2 rel4 + set older mali api for compatibility reasons

credits to JustArchi
cypress-touchkey : add sysfs interface to control hardwarekey backlight

- include new CM philosophy of handling h/w keys backlight from the ROM (Yank555.lu)
- kept the old sysfs interface and handling for older ROMs (Yank555.lu)
- kept the sysfs interface to enable/disable lighting hardwarekey backlight on screen touch (Yank555.lu)
- add force_disable handling also for rom controlled scenario (andip71)
- cypress-touchkey - add keydisabler  (andip71)

SysFS interface :

 * /sys/class/sec/sec_touchkey/touch_led_handling (rw)
 *
 *   0 - handled by ROM (newer CM10.2, default)
 *   1 - handled by kernel (older CM10.2)
 *
 * /sys/class/sec/sec_touchkey/touch_led_on_screen_touch (rw)
 *
 *   0 - hardware keys backlight only lights up if h/w keys are used
 *   1 - hardware keys backlight lights up if h/w keys are used or screen is touched (default)