cpufreq: add yankdemand governor

Full stock (JB) ondemand governor with changed default tunable values aimed at lower battery consumption
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
leds: Add Yank555.lu kernel LED boot signature (for fun)
TouchWake implementation v1.4 (Yank555.lu)

- Finger and Pen working
- Call detection working through proxy detection
- use of wakelock is optional (sysfs switchable)
- fixed for CM11 ROMs
- reviewed digitizer handling

SysFs interface :

 * /sys/class/misc/touchwake/enabled (rw) : 1 - on / 0 - off
 *
 *     Enable / Disable TouchWake (default = disabled)
 *
 *     NB: Turning the device off with the power key will disable touchwake
 *
 * /sys/class/misc/touchwake/delay (rw) :
 *
 *     Sets the delay in ms to keep touchscreen / pen actively listening for touch after screen goes off
 *
 *     NB: A value of 0 equals "infinite", will drain battery !
 *
 * /sys/class/misc/touchwake/proximity_threshold (rw) :
 *
 *     Sets the threshold from which to consider the proxy triggered (which will disable touchwake)
 *
 *     NB: This serves as a kind of in-call detection to not turn the screen on during a call when placing
 *         the device to the ear
 *
 * /sys/class/misc/touchwake/use_wakelock (rw) : 1 - on / 0 - off
 *
 *     Enable / Disable using a wakelock to keep device awake while TouchWake is active (default = enabled)
 *
 * /sys/class/misc/touchwake/version (ro) :
 *
 *     Display the current version of the eXtended ConTRoLs
 *
 * /sys/class/misc/touchwake/debug (ro) :
 *
 *     Display debugging info (only if debugging is active at compilation time)

TouchWake implementation v1.3 (Yank555.lu)

- Finger and Pen working
- Call detection working through proxy detection
- use of wakelock is optional (sysfs switchable)
- fixed for CM11 ROMs

Issues left to resolve :

- Finger detection only works after screen is off for 1-2 seconds (though looks better on CM)

wacom: always disable digitizer when the pen is inserted

Inspired from CM11's, adapted Touchwake :

hlte: power enhancement for wacom hardware.

* always disable digitizer when the pen is inserted

Change-Id: I6c9798682f9f6349b37cb452353bd0c0e6958401

TouchWake implementation v1.2 (Yank555.lu)

- Finger and Pen working
- Call detection working through proxy detection
- use of wakelock is optional (sysfs switchable)

Issues left to resolve :

- Finger detection only works after screen is off for 1-2 seconds

TouchWake implementation v1.1 (Yank555.lu)

- Finger and Pen working
- Call detection working through proxy detection

Issues left to resolve :

- Finger detection only works after screen is off for 1-2 seconds

TouchWake implementation v1.0 (Yank555.lu)

- Finger and Pen working

Issues :

- Finger detection only works after screen is off for 1-2 seconds
- Call detection missing to avoid turning the screen on when placing the device close to the ear
char-random: increase default entropy settings to (512,2048)
TouchWake implementation v1.4a (Yank555.lu)

- finger and pen working
- call detection working through proximity sensor detection
- use of wakelock is optional (sysfs switchable)
- fixed for CM11 ROMs
- reviewed digitizer handling

What's new :

- reduces proximity sensor detection default threshold
- added debug output to dmesg of proximity sensor reading

SysFs interface :

 * /sys/class/misc/touchwake/enabled (rw) : 1 - on / 0 - off
 *
 *     Enable / Disable TouchWake (default = disabled)
 *
 *     NB: Turning the device off with the power key will disable touchwake
 *
 * /sys/class/misc/touchwake/delay (rw) :
 *
 *     Sets the delay in ms to keep touchscreen / pen actively listening for touch after screen goes off
 *
 *     NB: A value of 0 equals "infinite", will drain battery !
 *
 * /sys/class/misc/touchwake/proximity_threshold (rw) :
 *
 *     Sets the threshold from which to consider the proximity sensor triggered (which will disable touchwake)
 *
 *     NB: This serves as a kind of in-call detection to not turn the screen on during a call when placing
 *         the device to the ear
 *
 * /sys/class/misc/touchwake/use_wakelock (rw) : 1 - on / 0 - off
 *
 *     Enable / Disable using a wakelock to keep device awake while TouchWake is active (default = enabled)
 *
 * /sys/class/misc/touchwake/version (ro) :
 *
 *     Display the current version of TouchWake
 *
 * /sys/class/misc/touchwake/debug (ro) :
 *
 *     Display debugging info (only if debugging is active at compilation time)
Cpufreq: create/remove percpu sysfs nodes once

On cpu hotplug on/off, percpu "cpufreq" sysfs node and it's
sub nodes are freshly created and removed. This increases
cpu up/down latency.

Create percpu "cpufreq" sysfs node and it's sub nodes in driver
registration and remove it in unregistration. This decreases
cpu up/down latency significantly.

Change-Id: I5c2b02e74de0ae4fe08dedc959bd7402cd9b7aa5
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Reviewed-on: http://git-master/r/146812
(cherry picked from commit 298382285677fa791098d117ccc0a0a3d9ab0f9a)
Reviewed-on: http://git-master/r/219379
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sachin Nikam <snikam@nvidia.com>

modified for use on Mako by faux123

Signed-off-by: Paul Reioux <reioux@gmail.com>
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.
cpufreq: add yankactive governor

Interactive governor with, fow now :

- hispeed_freq defaulting to lower than policy_max (~1.5GHz)
- target_loads increased to 95
- min_sampling time reduced to 20ms
- timer_rate increased to 60ms
- above_hispeed_delay increased to 80ms
cpufreq: CPU max. hardlimit v1.4a (Yank555.lu)

- fix a derp in wakeupkick, scaling min and max were set to wakeup kick frequency, this was wrong, only scaling min should be raised, scaling max shouldn't be lowered

SysFs Interface :

* /sys/kernel/cpufreq/hardlimit (rw)
*
* set or show the real hard CPU frequency limit when screen is on
*
* /sys/kernel/cpufreq/hardlimit_screen_off (rw)
*
* set or show the real hard CPU frequency limit when screen is off
*
* /sys/kernel/cpufreq/wakeup_kick_freq (rw)
*
* set or show the wakeup kick frequency (scaling_min for delay time)
*
* /sys/kernel/cpufreq/wakeup_kick_delay (rw)
*
* set or show the wakeup kick duration (in ms)
*
* /sys/kernel/cpufreq/available_frequencies (ro)
*
* display list of available CPU frequencies for convenience
*
* /sys/kernel/cpufreq/current_limit_max (ro)
*
* display current applied hardlimit for CPU max
*
* /sys/kernel/cpufreq/current_limit_min (ro)
*
* display current applied hardlimit for CPU min
*
* /sys/kernel/cpufreq/version (ro)
*
* display CPU freq hard limit version information

cpufreq: CPU max. hardlimit v1.4 (Yank555.lu)

- keep scaling min/max from overlapping (through sysfs)

* /sys/kernel/cpufreq/hardlimit (rw)
*
* set or show the real hard CPU frequency limit when screen is on
*
* /sys/kernel/cpufreq/hardlimit_screen_off (rw)
*
* set or show the real hard CPU frequency limit when screen is off
*
* /sys/kernel/cpufreq/wakeup_kick_freq (rw)
*
* set or show the wakeup kick frequency (scaling_min for delay time)
*
* /sys/kernel/cpufreq/wakeup_kick_delay (rw)
*
* set or show the wakeup kick duration (in ms)
*
* /sys/kernel/cpufreq/available_frequencies (ro)
*
* display list of available CPU frequencies for convenience
*
* /sys/kernel/cpufreq/current_limit_max (ro)
*
* display current applied hardlimit for CPU max
*
* /sys/kernel/cpufreq/current_limit_min (ro)
*
* display current applied hardlimit for CPU min
*
* /sys/kernel/cpufreq/version (ro)
*
* display CPU freq hard limit version information

cpufreq: CPU max. hardlimit v1.3 (Yank555.lu)

- add a wakeup kick frequency/delay setting scaling min to given frequency for given delay on powersuspend resume

SysFS interface :

* /sys/kernel/cpufreq/hardlimit (rw)
*
* set or show the real hard CPU frequency limit when screen is on
*
* /sys/kernel/cpufreq/hardlimit_screen_off (rw)
*
* set or show the real hard CPU frequency limit when screen is off
*
* /sys/kernel/cpufreq/wakeup_kick_freq (rw)
*
* set or show the wakeup kick frequency (scaling_min for delay time)
*
* /sys/kernel/cpufreq/wakeup_kick_delay (rw)
*
* set or show the wakeup kick duration (in ms)
*
* /sys/kernel/cpufreq/available_frequencies (ro)
*
* display list of available CPU frequencies for convenience
*
* /sys/kernel/cpufreq/current_limit_max (ro)
*
* display current applied hardlimit for CPU max
*
* /sys/kernel/cpufreq/current_limit_min (ro)
*
* display current applied hardlimit for CPU min
*
* /sys/kernel/cpufreq/version (ro)
*
* display CPU freq hard limit version information

cpufreq: CPU max. hardlimit v1.2 (Yank555.lu)

- add a screen off CPU max hardlimit enforced independantly of the used governor

SysFS interface :

* /sys/kernel/cpufreq/hardlimit (rw)
*
* set or show the real hard CPU frequency limit when screen is on
*
* /sys/kernel/cpufreq/hardlimit_screen_off (rw)
*
* set or show the real hard CPU frequency limit when screen is off
*
* /sys/kernel/cpufreq/available_frequencies (ro)
*
* display list of available CPU frequencies for convenience
*
* /sys/kernel/cpufreq/screen_state (ro)
*
* display current screen state as seen by CPU hardlimit
*
* /sys/kernel/cpufreq/current_limit (ro)
*
* display current applied hardlimit
*
* /sys/kernel/cpufreq/version (ro)
*
* display CPU freq hard limit version information

cpufreq: CPU max. hardlimit v1.1 (Yank555.lu)

 - add a hook in cpufreq_verify_within_limits() in cpufreq.h

SysFS interface :

* /sys/kernel/cpufreq/hardlimit (rw)
*
* set or show the real hard CPU frequency limit
*
* /sys/kernel/cpufreq/version (ro)
*
* display CPU freq hard limit version information

cpufreq: update cpu-boost driver to make it behave with cpufreq hardlimit (Yank555.lu)

cpufreq: introduce a hardlimit that will be respected no matter what userspace is trying to force (Yank555.lu)

SysFS interface :

 * /sys/kernel/cpufreq/hardlimit (rw)
 *
 *   set or show the real hard CPU frequency limit
 *
 * /sys/kernel/cpufreq/version (ro)
 *
 *   display CPU freq hard limit version information