f2fs: data: AIO optimization compatibility fixup
build beta M v1.0
overall_stats: add overall stats for all available cores

this is much more accurate stats tracking than just displaying core 0's
stats from most other kernels

Signed-off-by: faux123 <reioux@gmail.com>
overall_stats: make dual/quad core stats configurable via meunconfig

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

Conflicts:
	drivers/cpufreq/Kconfig
overall_stats: forward port to kernel 3.4+

by replacing deprecated functions with native add/sub for 64bit data types

Signed-off-by: faux123 <reioux@gmail.com>
cpufreq: Resolve CPUFREQ_NOTIFY issue

When the cpufreq_stat receives the frequency policy notification,
it checks if the frequency table and stats table are present for the cpu.
If both are present, it returns with -EBUSY error to the notification.
Due to this, none of the other registered modules receive this
notification.

If the stat table and sysfs nodes are already created, return 0 instead
of returning EBUSY error.

Change-Id: I1fd4a46e6a65edfc6253c4271288f10912ae2ad7
Signed-off-by: Archana Sathyakumar <asathyak@codeaurora.org>
msm: kgsl: show current power level for 8974 SOCs.

since 8974 uses duplicate frequencies in its table, it's not possible to tell
which of the duplicates is actually in use

Signed-off-by: Paul Reioux <reioux@gmail.com>
clock-krait/cpufreq: custom voltage control v1

* TODO: control only available frequencies
kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.2 (Yank555.lu)

- make kernel / userspace mode switchable

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.1 (Yank555.lu)

- make powersuspend not depend on a userspace initiator anymore, but use a hook in autosleep instead.

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend (faux123)

Android early_suspend/late_resume PM kernel driver framework has been
deprecated by Google. This new powersuspend PM kernel driver is a replacement
for it and existing early_suspend drivers can be easily adapted to use this
new replacement driver

Signen-off-by: Paul Reioux <reioux@gmail.com>
kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.3 (Yank555.lu)

- add an alternative hook for screen on / off detection in the display pannel driver
  (sleeps  ~0.1s sooner, wakes up ~1s later then autosleep)

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.2 (Yank555.lu)

- make kernel / userspace mode switchable

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.1 (Yank555.lu)

- make powersuspend not depend on a userspace initiator anymore, but use a hook in autosleep instead.

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend (faux123)

Android early_suspend/late_resume PM kernel driver framework has been
deprecated by Google. This new powersuspend PM kernel driver is a replacement
for it and existing early_suspend drivers can be easily adapted to use this
new replacement driver

Signen-off-by: Paul Reioux <reioux@gmail.com>;
kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.3 (Yank555.lu)

- fix stupid typo

- add an alternative hook for screen on / off detection in the display panel driver
(sleeps ~0.1s sooner, wakes up ~1s later then autosleep)

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.2 (Yank555.lu)

- make kernel / userspace mode switchable

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.1 (Yank555.lu)

- make powersuspend not depend on a userspace initiator anymore, but use a hook in autosleep instead.

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend (faux123)

Android early_suspend/late_resume PM kernel driver framework has been
deprecated by Google. This new powersuspend PM kernel driver is a replacement
for it and existing early_suspend drivers can be easily adapted to use this
new replacement driver

Signen-off-by: Paul Reioux <reioux@gmail.com>;
kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.4 (Yank555.lu)

- add hybrid-kernel mode (autosleep and panel, first wins)
- default to hybrid-kernel mode
- harmonize debug message with my other stuff
- include all 3 modes as default, so it's only commenting out to change

- add an alternative hook for screen on / off detection in the display panel driver
(sleeps ~0.1s sooner, wakes up ~1s later then autosleep)

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.2 (Yank555.lu)

- make kernel / userspace mode switchable

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend v1.1 (Yank555.lu)

- make powersuspend not depend on a userspace initiator anymore, but use a hook in autosleep instead.

kernel/power/powersuspend: new PM kernel driver for Android w/o early_suspend (faux123)

Android early_suspend/late_resume PM kernel driver framework has been
deprecated by Google. This new powersuspend PM kernel driver is a replacement
for it and existing early_suspend drivers can be easily adapted to use this
new replacement driver

Signen-off-by: Paul Reioux <reioux@gmail.com>;
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
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)
TouchWake implementation v1.4b (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 :

- don't use proxy sensor state when suspending to decide whether or not to enable touchwake & small fixes

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)
TouchWake implementation v1.4b (Yank555.lu) - remove debug messages in dmesg
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: 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
cpufreq: CPU max. hardlimit v1.5 (Yank555.lu)

- add user configurable touchboost frequencies

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/touchboost_lo_freq (rw)
 *
 *   set or show touchboost low frequency
 *
 * /sys/kernel/cpufreq/touchboost_hi_freq (rw)
 *
 *   set or show touchboost high frequency
 *
 * /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.6 (Yank555.lu)

- big code review
- added loads of debugging prints to dmesg (not compiled by default)
- fixed scaling_min/max getting stuck

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/touchboost_lo_freq (rw)
*
* set or show touchboost low frequency
*
* /sys/kernel/cpufreq/touchboost_hi_freq (rw)
*
* set or show touchboost high frequency
*
* /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