[SQUASH] Add custom Mako Hotplug driver for onlining and offlining cores based on system load.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>

Conflicts:

	arch/arm/kernel/Makefile

Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: fix some bugs, increase load levels by 10% each, queue the works in a dedicated workqueue, reduce the number of divisions every work call, fix a possible memory leak.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: online cpu1 on screen on to remove the lag, also merge the cpu max freq cap from the video driver to this driver. A bunch of other small fixes as well.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: use alloc_workqueue instead of create_*_workqueue because the latter is deprecated. Also online all cores on screen on for 1 sampling_rate for smoother screen on transitions.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: export settings to userspace. Also increase threshold for onlining all four cores to reduce heat at bordeline usages.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: add some flags to the WQ.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: reformat most of the code to be accoring upstream Kernel pedantic conventions.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: change load thresholds.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: fix a bug that was not updating online_cpus accordingly that then uncovered another bugs which led me to add a simple 10 position array for averaging the last 10 loads of the previous 10 samples which allows the driver to stay on quad-core during periods of continous high load. Also removed the sec_threshold temp_diff check for medium load if there is only 1 cpu online thus increasing interactivity between menus and UI interactions. Then after that initial onlining if the load keeps being medium it takes not 2 seconds but 4 seconds interval between onlining the remaining cpus.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: sync the threshold with the driver.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: add hooks so that the driver and the sysfs are synchronized with the defaults if I decide to change them in the future.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: fix a bug where the counter could be 10 sometimes and when trying to write to history_load[10] it derped big time. Also add all the stats to the struct, its cleaner.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: change the load history mechanism a little but based on one TI patch for interactive called timer_view that makes use of this type of ringbuffers.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

cpufreq: interactive: add hooks in the Hotplug driver to scale interactive tunables based on system load.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

cpufreq: interactive: cleanup mess from last commit (it was a proof of concept). Add an intermediate scaling point if the load is just allowing single onlining cpu cores. Also ajust some of the values.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: if the user has lots of widgets in the lock screen and in the home screen the device will lag during unlock if its only single core, so revert partially the last patch.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: add level for early_suspend struct.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: some performance optimizations.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

mako_hotplug: well duh, with the msleep if a user locked&unlocked too fast it would be stuck with black screen until the msleep was finished.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>

cpufreq: interactive: boost cpufreq to 1GHz on input, instead of 702MHz.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Signed-off-by: Derek Cannata <thederekjay@gmail.com>
configs: Update mako_defconfig MAKO_HOTPLUG.

Signed-off-by: Derek Cannata <thederekjay@gmail.com>