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

Conflicts:
	drivers/video/msm/mipi_lgit.c
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>
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>

Conflicts:
	drivers/misc/Makefile
rq_stats: remove the sysfs entries, they are not needed now.

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

Conflicts:
	arch/arm/mach-msm/msm_rq_stats.c
mako_hotplug: add some flags to the WQ.

Signed-off-by: Francisco Franco <franciscofranco.1990@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>
mako_hotplug: change load thresholds.

Signed-off-by: Francisco Franco <franciscofranco.1990@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>
mako_hotplug: sync the threshold with the driver.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
rq_stats: add report_load_at_max_freq to the header file.

Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Revert "rq_stats: remove the sysfs entries, they are not needed now."

This reverts commit feca6d2e08eaf8c78998028426a9730f2900fa1d.

Conflicts:
	include/linux/rq_stats.h
rq_stats: don't need to call the update_average_load every POSTCHANGE transition, specially because we're already calling update_average_load every msecs_to_jiffies(HZ) from the Hotplug driver. With all the locks & unlocks involved plus all the time calling and making some calculations (divisions as well) we may as well don't have the stats driver to call it that much.

Signed-off-by: Francisco Franco <franciscofranco.1990@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>
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>
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>
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>

Conflicts:
	drivers/cpufreq/cpufreq_interactive.c
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>
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>